feat: Add handling for missing interstitial page #1775
Workflow file for this run
This file contains 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: Code PR Check | |
on: | |
push: | |
branches: ["main", "development"] | |
paths: | |
- 'src/**' | |
- 'tests/**' | |
pull_request: | |
branches: ["main", "development"] | |
paths: | |
- 'src/**' | |
- 'tests/**' | |
- '.github/workflows/code-pr-check.yml' | |
concurrency: | |
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
cancel-in-progress: true | |
env: | |
DOTNET_VERSION: ${{ vars.DOTNET_VERSION }} | |
jobs: | |
get-src-dir-list: | |
name: Get Directories for Linting | |
runs-on: ubuntu-22.04 | |
if: ${{ github.event_name == 'pull_request' }} | |
outputs: | |
directories: ${{ steps.list-dir.outputs.directories }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Get Directories | |
id: list-dir | |
uses: ./.github/actions/list-directory | |
with: | |
source: ./src/ | |
lint-code: | |
name: Lint & Commit | |
runs-on: ubuntu-22.04 | |
if: ${{ github.event_name == 'pull_request' }} | |
needs: [get-src-dir-list] | |
strategy: | |
max-parallel: 1 | |
fail-fast: true | |
matrix: | |
workspace: ${{ fromJson(needs.get-src-dir-list.outputs.directories) }} | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set up .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
cache: false | |
env: | |
DOTNET_INSTALL_DIR: "/usr/share/dotnet" | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
- name: Run Linter | |
uses: wearerequired/lint-action@v2 | |
with: | |
dotnet_format: true | |
dotnet_format_dir: ./src/${{ matrix.workspace }} | |
git_email: "41898282+github-actions[bot]@users.noreply.github.com" | |
git_name: "github-actions[bot]" | |
commit_message: "Linted Code in ${{ matrix.workspace }}" | |
auto_fix: true | |
commit: true | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
build-test-web-app: | |
name: Build and run unit tests | |
runs-on: ubuntu-22.04 | |
if: ${{ always() && ( github.event_name == 'pull_request' && needs.lint-code.result == 'success' ) || ( github.event_name == 'push' && needs.lint-code.result == 'skipped' ) }} | |
needs: [lint-code] | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v1 | |
with: | |
path: ~\sonar\cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Install dotnet coverage | |
run: dotnet tool install --global dotnet-coverage --version 17.9.3 | |
- name: Install SonarCloud scanners | |
run: dotnet tool install --global dotnet-sonarscanner | |
- name: Install latest JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'microsoft' | |
java-version: '17' | |
- name: Start SonarCloud scanner | |
run: | | |
dotnet-sonarscanner begin \ | |
/k:"DFE-Digital_plan-technology-for-your-school" \ | |
/o:"dfe-digital" \ | |
/d:sonar.login="${{ secrets.SONAR_TOKEN }}" \ | |
/d:sonar.host.url="https://sonarcloud.io" \ | |
/d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml \ | |
/d:sonar.coverage.exclusions=src/**/Program.cs,src/Dfe.PlanTech.Web/gulpfile.js,src/Dfe.PlanTech.Web/wwwroot/** \ | |
/d:sonar.issue.ignore.multicriteria=e1 \ | |
/d:sonar.issue.ignore.multicriteria.e1.ruleKey=csharpsquid:S6602 \ | |
/d:sonar.issue.ignore.multicriteria.e1.resourceKey=src/**/*.cs | |
- name: Build web app | |
uses: ./.github/actions/build-dotnet-app | |
with: | |
dotnet_version: ${{ env.DOTNET_VERSION }} | |
solution_filename: plan-technology-for-your-school.sln | |
- name: Run unit tests | |
uses: ./.github/actions/run-unit-tests | |
with: | |
solution_filename: plan-technology-for-your-school.sln | |
- name: Merge test results | |
run: dotnet-coverage merge -f xml -o "coverage.xml" -s "coverage.settings.xml" -r coverage.cobertura.xml | |
- name: End SonarCloud Scanner | |
run: dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: code-coverage-report | |
path: coverage.xml | |
build-database-upgrader: | |
name: Build database upgrader | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Build database upgrader | |
uses: ./.github/actions/build-dotnet-app | |
with: | |
dotnet_version: ${{ env.DOTNET_VERSION }} | |
solution_filename: Dfe.PlanTech.DatabaseUpgrader.sln | |
run-javascript-tests: | |
runs-on: ubuntu-22.04 | |
name: Run javascript tests | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "latest" | |
- name: Install Dependencies | |
run: npm install | |
- name: Run the tests | |
run: npm test | |
- name: Test report | |
uses: dorny/test-reporter@v1 | |
if: success() || failure() # run this step even if previous step failed | |
with: | |
name: JEST Tests # Name of the check run which will be created | |
path: ./junit.xml # Path to test results | |
reporter: jest-junit # Format of test results |