Add job to backfill alerts #9443
Workflow file for this run
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: Pull request build | |
| on: | |
| pull_request: | |
| branches: | |
| - "*" | |
| merge_group: | |
| branches: | |
| - main | |
| permissions: | |
| checks: write | |
| deployments: write | |
| packages: write | |
| pull-requests: write | |
| id-token: write | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-22.04 # Important - later versions of ubuntu have a different .NET SDK which breaks trscli. Review on .NET 9 upgrade | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| - uses: extractions/setup-just@v3 | |
| - uses: actions/setup-dotnet@v5 | |
| with: | |
| global-json-file: TeachingRecordSystem/global.json | |
| - name: Install tools | |
| run: just install-tools | |
| - name: Lint | |
| run: cd TeachingRecordSystem && dotnet format --verify-no-changes --exclude src/TeachingRecordSystem.Core/DataStore/Postgres/Migrations | |
| validate_terraform: | |
| name: Validate Terraform | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: hashicorp/setup-terraform@v4 | |
| with: | |
| terraform_version: 1.14.5 | |
| - name: Check formatting | |
| run: terraform fmt -check -diff | |
| working-directory: terraform/aks | |
| - name: Download terraform modules | |
| run: make ci dev vendor-modules | |
| - name: Validate | |
| run: | | |
| terraform init -backend=false | |
| terraform validate -no-color | |
| working-directory: terraform/aks | |
| - name: Lint | |
| uses: reviewdog/action-tflint@v1.25.0 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| tflint_rulesets: azurerm | |
| working_directory: terraform/aks | |
| continue-on-error: true # temporary- we're getting sporadic 503 errors here in action setup | |
| get_affected_projects: | |
| name: Get affected projects | |
| runs-on: ubuntu-latest | |
| outputs: | |
| project_short_names: ${{ steps.get_test_projects.outputs.project_short_names }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: extractions/setup-just@v3 | |
| - uses: actions/setup-dotnet@v5 | |
| with: | |
| global-json-file: TeachingRecordSystem/global.json | |
| - name: Install tools | |
| run: just install-tools | |
| - name: Get test projects | |
| id: get_test_projects | |
| run: | | |
| set -eo pipefail | |
| TARGET_BRANCH=main | |
| git fetch origin $TARGET_BRANCH --quiet | |
| echo "project_short_names=$(dotnet run scripts/GetTestProjectsToRun.cs -- origin/$TARGET_BRANCH | jq -c --raw-input --slurp 'split("\n") | .[0:-1]')" >> $GITHUB_OUTPUT | |
| tests: | |
| name: Tests | |
| runs-on: ubuntu-22.04 # Important - later versions of ubuntu have a different .NET SDK which breaks trscli. Review on .NET 9 upgrade | |
| needs: [get_affected_projects] | |
| if: needs.get_affected_projects.outputs.project_short_names != '[]' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| project_short_name: ${{ fromJson(needs.get_affected_projects.outputs.project_short_names) }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: extractions/setup-just@v3 | |
| - uses: actions/setup-dotnet@v5 | |
| with: | |
| global-json-file: TeachingRecordSystem/global.json | |
| - name: Install tools | |
| run: just install-tools | |
| - name: Restore cached packages | |
| id: cache-packages-restore | |
| uses: actions/cache/restore@v5 | |
| with: | |
| path: | | |
| ~/.nuget/packages | |
| ~/.local/share/.librarymanager/cache | |
| key: ${{ hashFiles('**/packages.lock.json', '**/libman.json') }} | |
| - name: Restore | |
| run: just restore | |
| - name: Cache restored packages | |
| id: cache-packages-save | |
| uses: actions/cache/save@v5 | |
| with: | |
| path: | | |
| ~/.nuget/packages | |
| ~/.local/share/.librarymanager/cache | |
| key: ${{ steps.cache-packages-restore.outputs.cache-primary-key }} | |
| if: steps.cache-packages-restore.outputs.cache-hit != 'true' | |
| - name: Build project | |
| run: dotnet build -c Release --no-restore | |
| working-directory: TeachingRecordSystem/tests/TeachingRecordSystem.${{ matrix.project_short_name }} | |
| - name: Install Playwright if required | |
| run: | | |
| if [[ "$PROJECT_NAME" =~ .*EndToEndTests ]]; then | |
| pwsh ./bin/Release/net10.0/playwright.ps1 install chromium | |
| fi | |
| working-directory: TeachingRecordSystem/tests/TeachingRecordSystem.${{ matrix.project_short_name }} | |
| env: | |
| PROJECT_NAME: ${{ matrix.project_short_name }} | |
| - name: Run tests | |
| uses: ./.github/workflows/actions/test | |
| with: | |
| test_project_path: TeachingRecordSystem/tests/TeachingRecordSystem.${{ matrix.project_short_name }} | |
| report_name: "${{ matrix.project_short_name }} test results" | |
| dotnet_test_args: >- | |
| --no-build | |
| timeout-minutes: 30 | |
| check_test_results: | |
| name: Check test results | |
| runs-on: ubuntu-latest | |
| needs: [tests] | |
| if: always() | |
| steps: | |
| - uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const testsStepResult = '${{ needs.tests.result }}'; | |
| if (testsStepResult === 'failure') { | |
| core.setFailed('Required tests failed.'); | |
| } | |
| package: | |
| name: Package application | |
| uses: ./.github/workflows/package.yml | |
| secrets: inherit |