Skip to content

Commit

Permalink
Dotnet format jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
yurvon-screamo committed May 20, 2024
1 parent b4076d2 commit e49ce2e
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 59 deletions.
45 changes: 18 additions & 27 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Note: ci.yaml and release.yaml have some similar steps
# If updating dotnet-version, set in both.

name: CI

on:
Expand All @@ -11,29 +8,23 @@ on:

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 'lts/*' # latest LTS version
- uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x' # SDK Version to use; x will use the latest version of the channel

- name: Run NPM install
run: npm ci
working-directory: ./src/Saunter.UI
- name: Run dotnet build
run: dotnet build --configuration Debug
- name: Run dotnet test
run: dotnet test --no-build

# Below steps run only on CI, not release
- uses: actions/upload-artifact@v2
with:
name: saunter-bin
path: ./src/Saunter/bin
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "lts/*" # latest LTS version
- uses: actions/setup-dotnet@v2
with:
dotnet-version: "6.0.x" # SDK Version to use; x will use the latest version of the channel
- name: Run NPM install
run: npm ci
working-directory: ./src/Saunter.UI
- name: Run dotnet build
run: dotnet build --configuration Debug
- name: Run dotnet test
run: dotnet test --no-build
- uses: actions/upload-artifact@v2 # Below steps run only on CI, not release
with:
name: saunter-bin
path: ./src/Saunter/bin
20 changes: 20 additions & 0 deletions .github/workflows/fmt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: .NET Format Check

on: [push, pull_request]

jobs:
format-check:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: "6.0.x" # Adjust the version as needed
- name: Install dotnet-format tool
run: dotnet tool install -g dotnet-format
- name: Run dotnet format check
run: dotnet format --check
env:
PATH: ${{ github.env.PATH }}:/home/runner/.dotnet/tools
57 changes: 25 additions & 32 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,33 @@ name: Release
on:
push:
tags:
- 'v*.*.*' # e.g. v0.1.0
- "v*.*.*" # e.g. v0.1.0

jobs:
release:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 'lts/*' # latest LTS version
- uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x' # SDK Version to use; x will use the latest version of the channel

- name: Run NPM install
run: npm ci
working-directory: ./src/Saunter.UI
- name: Run dotnet build
run: dotnet build --configuration Debug
- name: Run dotnet test
run: dotnet test --no-build

# Below steps are only on release, not CI.
- name: Set version
# Gets the numeric version from a tag (e.g. v1.2.3 -> 1.2.3)
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: Create Nuget package
run: dotnet pack ./src/Saunter/Saunter.csproj --configuration Release -p:Version="$RELEASE_VERSION" --output ./build
- name: Push Nuget package to Nuget.org
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: dotnet nuget push ./build/*.nupkg --api-key $NUGET_API_KEY --source "https://api.nuget.org/v3/index.json"


- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "lts/*" # latest LTS version
- uses: actions/setup-dotnet@v2
with:
dotnet-version: "6.0.x" # SDK Version to use; x will use the latest version of the channel
- name: Run NPM install
run: npm ci
working-directory: ./src/Saunter.UI
- name: Run dotnet build
run: dotnet build --configuration Debug
- name: Run dotnet test
run: dotnet test --no-build
# Below steps are only on release, not CI.
- name: Set version
# Gets the numeric version from a tag (e.g. v1.2.3 -> 1.2.3)
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: Create Nuget package
run: dotnet pack ./src/Saunter/Saunter.csproj --configuration Release -p:Version="$RELEASE_VERSION" --output ./build
- name: Push Nuget package to Nuget.org
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: dotnet nuget push ./build/*.nupkg --api-key $NUGET_API_KEY --source "https://api.nuget.org/v3/index.json"

0 comments on commit e49ce2e

Please sign in to comment.