Use matrix strategy for debug and release builds #1318
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: | |
| - "*" | |
| tags: | |
| - v* | |
| paths-ignore: | |
| - docs/** | |
| - LICENSE | |
| - "**.md" | |
| pull_request: | |
| branches: | |
| - "*" | |
| paths-ignore: | |
| - docs/** | |
| - LICENSE | |
| - "**.md" | |
| jobs: | |
| build: | |
| name: "Build & package" | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| build-configuration: [ Debug, Release ] | |
| env: | |
| DOTNET_CLI_WORKLOAD_UPDATE_NOTIFY_DISABLE: true | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 # required for minver to create the right version number | |
| filter: tree:0 | |
| - uses: extractions/setup-just@v3 | |
| - uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: | | |
| 8.0.x | |
| - name: Install tools | |
| run: just install-tools | |
| - name: Restore | |
| run: just restore | |
| - name: Format | |
| run: just format --verify-no-changes | |
| - name: Build | |
| run: just build --configuration ${{ matrix.build-configuration }} --no-restore /p:GeneratePackageOnBuild=false | |
| - name: Build samples | |
| run: just build-samples --configuration ${{ matrix.build-configuration }} | |
| - name: Install Playwright | |
| run: just install-playwright | |
| - name: Test | |
| run: | | |
| just unit-tests --configuration ${{ matrix.build-configuration }} --no-build | |
| just conformance-tests --configuration ${{ matrix.build-configuration }} --no-build | |
| just integration-tests --configuration ${{ matrix.build-configuration }} --no-build | |
| - name: Check documentation | |
| if: matrix.build-configuration == 'Release' | |
| run: | | |
| just publish-docs --configuration ${{ matrix.build-configuration }} | |
| changes=$(git status --porcelain docs ':!docs/images' | cut -c 4-) | |
| if [ -n "$changes" ] | |
| then | |
| echo "::error ::Documentation is stale" | |
| exit 1 | |
| fi | |
| - name: Pack | |
| run: just pack --configuration ${{ matrix.build-configuration }} | |
| env: | |
| MINVERBUILDMETADATA: build.${{ github.run_id }}.${{ github.run_attempt}} | |
| - name: Publish package artifact | |
| if: matrix.build-configuration == 'Release' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: GovUk.Frontend.AspNetCore.nupkg | |
| path: packages/*.nupkg | |
| release: | |
| name: "Release" | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download package artifact | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: GovUk.Frontend.AspNetCore.nupkg | |
| - name: NuGet login | |
| uses: NuGet/login@v1 | |
| id: login | |
| with: | |
| user: ${{ secrets.NUGET_USER }} | |
| - name: Publish package to NuGet | |
| run: dotnet nuget push **/*.nupkg --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json |