Merge branch 'main' into operation #1362
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: Dotnet Build and Test | |
| on: | |
| - push | |
| - workflow_dispatch | |
| permissions: | |
| contents: read | |
| actions: read | |
| checks: write | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| name: Build | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: | | |
| 10.0.x | |
| 9.0.x | |
| 8.0.x | |
| - name: Install dependencies | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: build | |
| path: | | |
| src | |
| test | |
| retention-days: 1 | |
| tests: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| strategy: | |
| matrix: | |
| version: ["8.0", "9.0", "10.0"] | |
| classTests: [true, false] | |
| name: ${{ matrix.classTests && 'Class' || 'All' }} tests for ${{ matrix.version }} | |
| env: | |
| testType: ${{ matrix.classTests && 'Class' || 'All' }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: ${{ matrix.version }}.x | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: build | |
| - name: Install tools | |
| run: | | |
| chmod 777 -R . | |
| dotnet tool restore --tool-manifest .config/dotnet-tools.json | |
| - name: Tests with Coverage | |
| run: pwsh just-coverage.ps1 -Framework ${{ matrix.version }} -ClassTests:${{ matrix.classTests }} | |
| - name: Generate Coverage Report | |
| if: always() | |
| env: | |
| REPORTGENERATOR_LICENSE: ${{ secrets.REPORTGENERATOR_LICENSE }} # Use GitHub Secrets | |
| run: > | |
| dotnet reportgenerator | |
| -reports:${{ github.workspace }}/coverage/Coverage-${{ matrix.version }}.xml | |
| -targetdir:"${{ github.workspace }}/coverage/" | |
| -reporttypes:'MarkdownSummaryGithub;Html' | |
| - name: Tests and Coverage Summary | |
| id: coverage | |
| if: always() | |
| run: pwsh make-summary.ps1 -Framework ${{ matrix.version }} | |
| - name: Tests Report | |
| uses: dorny/test-reporter@v2 | |
| if: always() | |
| with: | |
| name: DotNET Tests (${{ matrix.version }} ${{ env.testType }}) | |
| path: "**/TestResults-${{ matrix.version }}.trx" | |
| reporter: dotnet-trx | |
| list-tests: failed | |
| use-actions-summary: false | |
| - name: Coverage Report | |
| uses: LouisBrunner/checks-action@v2.0.0 | |
| if: always() | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| name: DotNET Coverage (${{ matrix.version }} ${{ env.testType }}) | |
| conclusion: success | |
| output: '{"summary":"${{ steps.coverage.outputs.coverage_badge }}"}' | |
| output_text_description_file: coverage/SummaryGithub.md | |
| - name: Coverage PR Comment | |
| uses: marocchino/sticky-pull-request-comment@v2 | |
| if: github.event_name == 'pull_request' | |
| with: | |
| recreate: true | |
| path: coverage/SummaryGithub.md | |
| - name: Upload Tests artifact | |
| uses: actions/upload-artifact@v7 | |
| if: always() | |
| with: | |
| name: tests-${{ matrix.version }}-${{ env.testType }} | |
| path: "**/TestResults-${{ matrix.version }}.trx" | |
| - name: Upload Coverage artifact | |
| uses: actions/upload-artifact@v7 | |
| if: always() | |
| with: | |
| name: coverage-${{ matrix.version }}-${{ env.testType }} | |
| path: coverage/ | |
| - name: Upload Pages artifact | |
| if: matrix.version == '10.0' && !matrix.classTests | |
| uses: actions/upload-pages-artifact@v4 | |
| with: | |
| path: test/Html | |
| # Deployment job | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: tests | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |