AI/copilot uplift #497
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'src/**' | |
| - 'tests/**' | |
| - 'samples/**' | |
| - 'gen/**' | |
| - 'servicebus/**' | |
| - 'Directory.Packages.props' | |
| - 'docker-compose.yml' | |
| - '*.slnf' | |
| - '*.sln' | |
| - '.config/dotnet-tools.json' | |
| - '.github/workflows/CI.yml' | |
| pull_request: | |
| paths: | |
| - 'src/**' | |
| - 'tests/**' | |
| - 'samples/**' | |
| - 'gen/**' | |
| - 'servicebus/**' | |
| - 'Directory.Packages.props' | |
| - 'docker-compose.yml' | |
| - '*.slnf' | |
| - '*.sln' | |
| - '.config/dotnet-tools.json' | |
| - '.github/workflows/CI.yml' | |
| workflow_dispatch: | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Start containers | |
| run: docker compose up -d | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: | | |
| 8.x | |
| 9.x | |
| 10.x | |
| - name: Cache NuGet packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.nuget/packages | |
| key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj', '**/Directory.Packages.props') }} | |
| restore-keys: nuget-${{ runner.os }}- | |
| - name: Restore .NET tools | |
| run: dotnet tool restore | |
| - name: Restore (all) | |
| run: dotnet restore CoreEx.sln --verbosity minimal | |
| # --- Core --- | |
| - name: Build core | |
| run: dotnet build CoreEx.Core.slnf --no-restore --configuration Release | |
| - name: Test core (parallel) | |
| run: dotnet test CoreEx.Core.Test.Parallel.slnf --no-build --configuration Release --logger trx --collect "XPlat Code Coverage" --results-directory coverage/core | |
| - name: Test core (sequential) | |
| run: dotnet test CoreEx.Core.Test.Sequential.slnf --no-build --configuration Release --logger trx --collect "XPlat Code Coverage" --results-directory coverage/core -m:1 -p:TestTfmsInParallel=false -p:BuildInParallel=false | |
| - name: Upload core test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: core-test-results | |
| path: "coverage/core/**/*.trx" | |
| retention-days: 30 | |
| # --- Samples --- | |
| - name: Build samples | |
| run: dotnet build CoreEx.Samples.Build.slnf --no-restore --configuration Release | |
| - name: CodeGen tool (samples/src/Contoso.Products.CodeGen) | |
| working-directory: samples/src/Contoso.Products.CodeGen | |
| run: dotnet run refdata --no-build --configuration Release -f net10.0 --expect-no-changes | |
| - name: CodeGen tool (samples/src/Contoso.Shopping.CodeGen) | |
| working-directory: samples/src/Contoso.Shopping.CodeGen | |
| run: dotnet run refdata --no-build --configuration Release -f net10.0 --expect-no-changes | |
| - name: Database tool (samples/src/Contoso.Products.Database) | |
| working-directory: samples/src/Contoso.Products.Database | |
| run: dotnet run all --no-build --configuration Release -f net10.0 --expect-no-changes | |
| - name: Database tool (samples/src/Contoso.Shopping.Database) | |
| working-directory: samples/src/Contoso.Shopping.Database | |
| run: dotnet run all --no-build --configuration Release -f net10.0 --expect-no-changes | |
| - name: Database tool (samples/src/Contoso.Orders.Database) | |
| working-directory: samples/src/Contoso.Orders.Database | |
| run: dotnet run all --no-build --configuration Release -f net10.0 --expect-no-changes | |
| - name: Test samples | |
| run: dotnet test CoreEx.Samples.Test.slnf --no-build --configuration Release --logger trx --collect "XPlat Code Coverage" --results-directory coverage/samples -m:1 -p:TestTfmsInParallel=false -p:BuildInParallel=false | |
| - name: Upload samples test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: samples-test-results | |
| path: "coverage/samples/**/*.trx" | |
| retention-days: 30 | |
| # --- Coverage --- | |
| - name: Merge and generate coverage report | |
| if: always() | |
| run: | | |
| dotnet tool run reportgenerator \ | |
| -reports:"coverage/**/coverage.cobertura.xml" \ | |
| -targetdir:"coverage/report" \ | |
| -reporttypes:"HtmlInline_AzurePipelines;Cobertura;Badges" \ | |
| -assemblyfilters:"-*Test*;-*E2E*" | |
| - name: Upload coverage report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: coverage/report | |
| retention-days: 30 | |
| # --- Cleanup --- | |
| - name: Capture container logs on failure | |
| if: failure() | |
| run: docker compose logs --no-color > container-logs.txt 2>&1 | |
| - name: Upload container logs on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: container-logs | |
| path: container-logs.txt | |
| retention-days: 30 | |
| - name: Stop containers | |
| if: always() | |
| run: docker compose down |