Require explicit resolution of outstanding finding reviews #874
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: Tests | |
| on: | |
| push: | |
| pull_request: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| actions: read | |
| pull-requests: read | |
| jobs: | |
| dedupe: | |
| name: Avoid Duplicate Test Runs | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| outputs: | |
| should_run: ${{ steps.dedupe.outputs.should_run }} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Decide whether this run owns the tests | |
| id: dedupe | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }} | |
| run: bash .github/scripts/should-run-tests-workflow.sh | |
| scripts: | |
| name: Repository Script Tests | |
| needs: dedupe | |
| if: needs.dedupe.outputs.should_run == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.12.0 | |
| - name: Test workflow and fixture scripts | |
| run: node --test .github/tests/*.test.mjs mock-db/tests/*.test.mjs | |
| detect-changes: | |
| name: Detect Changes | |
| needs: dedupe | |
| if: needs.dedupe.outputs.should_run == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| outputs: | |
| frontend: ${{ steps.filter.outputs.frontend }} | |
| backend: ${{ steps.filter.outputs.backend }} | |
| launcher: ${{ steps.filter.outputs.launcher }} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Detect changed components | |
| id: filter | |
| env: | |
| DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} | |
| PR_BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| PUSH_BEFORE_SHA: ${{ github.event.before }} | |
| run: bash .github/scripts/detect-component-changes.sh | |
| frontend: | |
| name: Frontend Tests | |
| needs: detect-changes | |
| if: needs.detect-changes.outputs.frontend == 'true' && github.repository == 'Modtale/modtale' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Modtale/modtale') | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| defaults: | |
| run: | |
| working-directory: frontend | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.12.0 | |
| cache: npm | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install frontend dependencies | |
| run: npm ci | |
| - name: Check frontend types | |
| run: npm run check | |
| - name: Run frontend tests | |
| run: npm run test | |
| backend: | |
| name: Backend Tests | |
| needs: detect-changes | |
| if: needs.detect-changes.outputs.backend == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| defaults: | |
| run: | |
| working-directory: backend | |
| env: | |
| MONGODB_URI: mongodb://localhost:27017/modtale-test | |
| MONGODB_DATABASE_NAME: modtale-test | |
| R2_BUCKET_NAME: modtale-test | |
| R2_ACCESS_KEY: test-access-key | |
| R2_SECRET_KEY: test-secret-key | |
| R2_ENDPOINT: https://example.com | |
| R2_PUBLIC_DOMAIN: https://cdn.example.com | |
| FRONTEND_URL: http://localhost:5173 | |
| BACKEND_URL: http://localhost:8080 | |
| WARDEN_ENABLED: "false" | |
| PRE_AUTH_SECRET: test-pre-auth-secret | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 21 | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v3 | |
| - name: Ensure Gradle wrapper is executable | |
| run: chmod +x gradlew | |
| - name: Run backend tests | |
| run: ./gradlew test | |
| launcher: | |
| name: Launcher Tests | |
| needs: detect-changes | |
| if: needs.detect-changes.outputs.launcher == 'true' && github.repository == 'Modtale/modtale' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Modtale/modtale') | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| defaults: | |
| run: | |
| working-directory: launcher | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 21 | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v3 | |
| - name: Ensure Gradle wrapper is executable | |
| run: chmod +x gradlew | |
| - name: Install virtual display for JavaFX tests | |
| run: sudo apt-get update && sudo apt-get install -y xvfb xauth libgtk-3-0 | |
| - name: Run launcher tests | |
| run: xvfb-run -a ./gradlew test --no-daemon | |
| - name: Upload launcher test reports | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: launcher-test-reports | |
| path: | | |
| launcher/build/reports/tests/test | |
| launcher/build/test-results/test | |
| if-no-files-found: ignore |