Skip to content

fix(ci): improve artifact handling and test execution in GitHub Actions #106

fix(ci): improve artifact handling and test execution in GitHub Actions

fix(ci): improve artifact handling and test execution in GitHub Actions #106

Workflow file for this run

name: Build and Test
on: [ workflow_dispatch, push, pull_request ]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up .NET 9
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Install linting tools
run: |
dotnet tool restore
- name: Validate code linting with Csharpier
run: |
dotnet dotnet-csharpier --check .
build:
needs: lint
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up .NET 9
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Restore dependencies
run: dotnet restore
- name: Build Solution
run: dotnet build --no-restore --configuration Release
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: app-build
path: |
**/bin/Release/net9.0
!**/bin/Release/net9.0/ref
unit_tests:
runs-on: ubuntu-latest
needs: [lint, build]
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: app-build
path: artifacts
- name: Set up .NET 9
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Run unit tests
run: dotnet test --filter "Category=Unit" --verbosity normal
integration_tests:
runs-on: ubuntu-latest
needs: [lint, build, unit_tests]
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: app-build
path: artifacts
- name: Set up .NET 9
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Run integration tests
run: dotnet test --filter "Category=Integration" --verbosity normal