diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 1bfb788fb8..0ffe6c8735 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -22,8 +22,85 @@ concurrency: cancel-in-progress: true jobs: + + changes: + name: Check code changes + runs-on: ubuntu-latest + outputs: + core: ${{ steps.filter.outputs.core }} + infra1: ${{ steps.filter.outputs.infra1 }} + infra2: ${{ steps.filter.outputs.infra2 }} + feature1: ${{ steps.filter.outputs.feature1 }} + feature2: ${{ steps.filter.outputs.feature2 }} + dashboard: ${{ steps.filter.outputs.feature }} + face: ${{ steps.filter.outputs.face }} + fingerprint: ${{ steps.filter.outputs.fingerprint }} + testing: ${{ steps.filter.outputs.testing }} + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Check directories in test groups + uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + core: + - 'infra/core/**' + - 'infra/ui-base/**' + - 'infra/network/**' + - 'infra/logging/**' + - 'infra/logging-persistent/**' + - 'infra/security/**' + infra1: + - 'infra/orchestrator-data/**' + - 'infra/enrolment-records:repository/**' + - 'infra/enrolment-records:realm-store/**' + - 'infra/enrolment-records:room-store/**' + - 'infra/recent-user-activity/**' + - 'infra/config-store/**' + - 'infra/credential-store/**' + - 'infra/sync/**' + infra2: + - 'infra/events/**' + - 'infra/event-sync/**' + - 'infra/license/**' + - 'infra/images/**' + - 'infra/auth-store/**' + - 'infra/auth-logic/**' + - 'infra/matching/**' + feature1: + - 'feature/orchestrator/**' + - 'feature/client-api/**' + - 'feature/login-check/**' + - 'feature/alert/**' + - 'feature/exit-form/**' + - 'feature/select-subject-age-group/**' + - 'feature/external-credential/**' + feature2: + - 'feature/consent/**' + - 'feature/login/**' + - 'feature/fetch-subject/**' + - 'feature/select-subject/**' + - 'feature/setup/**' + - 'feature/enrol-last-biometric/**' + - 'feature/matcher/**' + - 'feature/validate-subject-pool/**' + dashboard: + - 'feature/dashboard/**' + - 'feature/troubleshooting/**' + face: + - 'face/**' + fingerprint: + - 'fingerprint/**' + testing: + - 'testing/data-generator/**' + + core-unit-tests: name: Core Unit Tests + needs: changes + if: needs.changes.outputs.core == 'true' uses: ./.github/workflows/reusable-run-unit-tests.yml secrets: inherit with: @@ -38,6 +115,8 @@ jobs: infra-unit-tests-1: name: Infra Unit Tests 1 + needs: changes + if: needs.changes.outputs.infra1 == 'true' uses: ./.github/workflows/reusable-run-unit-tests.yml secrets: inherit with: @@ -54,6 +133,8 @@ jobs: infra-unit-tests-2: name: Infra Unit Tests 2 + needs: changes + if: needs.changes.outputs.infra2 == 'true' uses: ./.github/workflows/reusable-run-unit-tests.yml secrets: inherit with: @@ -69,6 +150,8 @@ jobs: feature-unit-tests1: name: Feature Unit Tests 1 + needs: changes + if: needs.changes.outputs.feature1 == 'true' uses: ./.github/workflows/reusable-run-unit-tests.yml secrets: inherit with: @@ -84,6 +167,8 @@ jobs: feature-unit-tests2: name: Feature Unit Tests 2 + needs: changes + if: needs.changes.outputs.feature2 == 'true' uses: ./.github/workflows/reusable-run-unit-tests.yml secrets: inherit with: @@ -100,16 +185,20 @@ jobs: feature-dashboard-unit-tests: name: Feature Dashboard Unit Tests + needs: changes + if: needs.changes.outputs.dashboard == 'true' uses: ./.github/workflows/reusable-run-unit-tests.yml secrets: inherit with: - modules: | + modules: | feature:dashboard feature:troubleshooting reportsId: dashboard face-unit-tests: name: Face Unit Tests + needs: changes + if: needs.changes.outputs.face == 'true' uses: ./.github/workflows/reusable-run-unit-tests.yml secrets: inherit with: @@ -124,6 +213,8 @@ jobs: fingerprint-unit-tests: name: Fingerprint Unit Tests + needs: changes + if: needs.changes.outputs.fingerprint == 'true' uses: ./.github/workflows/reusable-run-unit-tests.yml secrets: inherit with: @@ -140,6 +231,8 @@ jobs: reportsId: fingerprint testing-tools: name: Testing Tools unit tests + needs: changes + if: needs.changes.outputs.testing == 'true' uses: ./.github/workflows/reusable-run-unit-tests.yml secrets: inherit with: @@ -159,5 +252,8 @@ jobs: fingerprint-unit-tests, testing-tools ] uses: ./.github/workflows/reusable-sonar-scan.yml - # Only run if the PR ready for review or triggered manually - if: github.event.pull_request.draft == false || github.event_name == 'workflow_dispatch' + # Only run if the PR ready for review or triggered manually, and if tests passed or matched 'skipped' status (due to smart filter) + if: > + (github.event.pull_request.draft == false || github.event_name == 'workflow_dispatch') && + !contains(needs.*.result, 'failure') && + !contains(needs.*.result, 'cancelled')