[AAP-70430] Shift platform help menu checks to Vitest and trim Playwright #108
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: Platform PR | |
| on: | |
| push: | |
| branches: [main, devel] | |
| pull_request: | |
| env: | |
| IS_GITHUB_ACTION: true | |
| concurrency: | |
| group: platform-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| packages: | |
| name: Packages | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - run: npm version 0.0.0 --no-git-tag-version | |
| - uses: actions/cache@v4 | |
| id: cache | |
| with: | |
| path: ./node_modules | |
| key: modules-${{ hashFiles('package-lock.json') }} | |
| - run: npm ci | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| checks: | |
| name: Checks | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| needs: packages | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| script: | |
| - eslint | |
| - tsc | |
| - prettier | |
| - build | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - run: npm version 0.0.0 --no-git-tag-version | |
| - uses: actions/cache@v4 | |
| id: cache | |
| with: | |
| path: ./node_modules | |
| key: modules-${{ hashFiles('package-lock.json') }} | |
| - run: npm ci | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| - uses: nrwl/nx-set-shas@v4 | |
| - run: npx nx affected -t ${{ matrix.script }} --base=origin/main --head=HEAD --verbose | |
| vitest-awx: | |
| name: Vitest (awx) | |
| needs: packages | |
| uses: ./.github/workflows/vitest.yml | |
| with: | |
| directory: frontend/awx | |
| artifact-prefix: awx | |
| coverage: true | |
| vitest: | |
| name: Vitest (${{ matrix.name }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| needs: packages | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - directory: frontend/eda | |
| name: eda | |
| - directory: frontend/hub | |
| name: hub | |
| - directory: frontend/common | |
| name: common | |
| - directory: frontend/chatbot | |
| name: chatbot | |
| - directory: framework | |
| name: framework | |
| - directory: platform | |
| name: platform | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - run: npm version 0.0.0 --no-git-tag-version | |
| - uses: actions/cache@v4 | |
| id: cache | |
| with: | |
| path: ./node_modules | |
| key: modules-${{ hashFiles('package-lock.json') }} | |
| - run: npm ci | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| - name: Run vitest with coverage | |
| working-directory: ${{ matrix.directory }} | |
| run: npx vitest run --coverage | |
| - name: Upload coverage artifact | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: vitest-coverage-${{ matrix.name }} | |
| path: ${{ matrix.directory }}/coverage/vitest/coverage-final.json | |
| retention-days: 7 | |
| if-no-files-found: ignore | |
| vitest-coverage: | |
| name: Vitest Coverage | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| permissions: | |
| id-token: write | |
| needs: | |
| - vitest-awx | |
| - vitest | |
| if: always() | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - run: npm version 0.0.0 --no-git-tag-version | |
| - uses: actions/cache@v4 | |
| id: cache | |
| with: | |
| path: ./node_modules | |
| key: modules-${{ hashFiles('package-lock.json') }} | |
| - run: npm ci | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| - name: Download all coverage artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: vitest-coverage-* | |
| path: coverage-artifacts | |
| - name: Prepare coverage for merge | |
| run: | | |
| mkdir -p .nyc_output | |
| for dir in coverage-artifacts/vitest-coverage-*/; do | |
| name=$(basename "$dir" | sed 's/vitest-coverage-//' | sed 's|/|-|g') | |
| coverage_file=$(find "$dir" -name "coverage-final.json" -type f | head -n 1) | |
| if [ -n "$coverage_file" ]; then | |
| cp "$coverage_file" ".nyc_output/${name}-vitest.json" | |
| fi | |
| done | |
| echo "Coverage files to merge:" | |
| ls -lh .nyc_output/ | |
| - name: Merge coverage reports | |
| run: npm run nyc-report | |
| - name: Upload combined coverage | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: vitest-coverage | |
| path: coverage/combined | |
| retention-days: 7 | |
| if-no-files-found: error | |
| - name: Upload unit test coverage to Codecov (OIDC) | |
| if: ${{ !vars.CODECOV_URL }} | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| use_oidc: true | |
| files: ./coverage/combined/lcov.info | |
| flags: unit-tests | |
| disable_search: true | |
| fail_ci_if_error: false | |
| - name: Upload unit test coverage to Codecov (Token) | |
| if: ${{ vars.CODECOV_URL }} | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| url: ${{ vars.CODECOV_URL }} | |
| slug: ${{ github.repository }} | |
| files: ./coverage/combined/lcov.info | |
| flags: unit-tests | |
| disable_search: true | |
| fail_ci_if_error: false | |
| - name: Save off PR Number | |
| if: github.event_name == 'pull_request' | |
| run: echo "PR ${{ github.event.number }}" > pr_number.txt | |
| - name: Upload PR Number | |
| if: github.event_name == 'pull_request' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pr_number | |
| path: pr_number.txt | |
| hub-insights: | |
| name: Hub Insights Checks | |
| runs-on: ubuntu-latest | |
| needs: packages | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - run: npm version 0.0.0 --no-git-tag-version | |
| - uses: actions/cache@v4 | |
| id: cache | |
| with: | |
| path: ./node_modules | |
| key: modules-${{ hashFiles('package-lock.json') }} | |
| - run: npm ci | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| - name: Install Insights dependencies | |
| run: npm run insights:install --prefix frontend/hub | |
| - name: ESLint (Insights) | |
| run: npm run insights:eslint --prefix frontend/hub | |
| - name: TypeScript check (Insights) | |
| run: npm run insights:tsc --prefix frontend/hub | |
| sonarqube-code-quality: | |
| name: SonarQube Code Quality | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| needs: vitest-coverage | |
| if: always() | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download combined coverage | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: vitest-coverage | |
| path: coverage/combined | |
| continue-on-error: true | |
| - name: SonarQube Scan (PR) | |
| if: github.event_name == 'pull_request' | |
| uses: SonarSource/sonarqube-scan-action@v6 | |
| env: | |
| SONAR_TOKEN: ${{ secrets[format('{0}', vars.SONAR_TOKEN_SECRET_NAME)] }} | |
| with: | |
| args: > | |
| -Dsonar.organization=${{ vars.SONAR_ORGANIZATION }} | |
| -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }} | |
| -Dsonar.scm.revision=${{ github.event.pull_request.head.sha }} | |
| -Dsonar.pullrequest.key=${{ github.event.pull_request.number }} | |
| -Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }} | |
| -Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }} | |
| - name: SonarQube Scan (Branch) | |
| if: github.event_name == 'push' | |
| uses: SonarSource/sonarqube-scan-action@v6 | |
| env: | |
| SONAR_TOKEN: ${{ secrets[format('{0}', vars.SONAR_TOKEN_SECRET_NAME)] }} | |
| with: | |
| args: > | |
| -Dsonar.organization=${{ vars.SONAR_ORGANIZATION }} | |
| -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY }} | |
| -Dsonar.branch.name=${{ github.ref_name }} | |
| success: | |
| name: Success | |
| runs-on: ubuntu-latest | |
| needs: | |
| - checks | |
| - vitest-awx | |
| - vitest | |
| - vitest-coverage | |
| - hub-insights | |
| if: ${{ always() }} | |
| steps: | |
| - name: Success Check | |
| if: ${{ needs.checks.result == 'success' && needs.vitest-awx.result == 'success' && needs.vitest.result == 'success' && needs.hub-insights.result == 'success' }} | |
| run: echo "All jobs succeeded" | |
| - name: Log dependency results | |
| if: ${{ needs.checks.result != 'success' || needs.vitest-awx.result != 'success' || needs.vitest.result != 'success' || needs.hub-insights.result != 'success' }} | |
| run: | | |
| echo "checks: ${{ needs.checks.result }}" | |
| echo "vitest-awx: ${{ needs.vitest-awx.result }}" | |
| echo "vitest: ${{ needs.vitest.result }}" | |
| echo "vitest-coverage: ${{ needs.vitest-coverage.result }}" | |
| echo "hub-insights: ${{ needs.hub-insights.result }}" | |
| - name: Failure or Cancelled | |
| if: ${{ needs.checks.result != 'success' || needs.vitest-awx.result != 'success' || needs.vitest.result != 'success' || needs.hub-insights.result != 'success' }} | |
| run: | | |
| echo "One or more jobs failed or were canceled." | |
| exit 1 |