/
githubmirror
/
oppia
Обзор
Документация
Войти
/
githubmirror
/
oppia
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
.github/workflows/frontend_unit_tests.yml
113 строк
4 KB
kundan
Fix #25031: Pin develop SHA for backend coverage checks to ensure consistency across CI jobs (#25318)
01 апр 2026, 09:59
Не верифицирован
01 апр 2026, 09:59
dd3bb47
Код
Авторство
О чём код?
name: Frontend unit tests permissions: read-all on: merge_group: types: - checks_requested - destroyed push: branches: - develop - release-* pull_request: branches: - develop - release-* types: - opened - synchronize - reopened - closed concurrency: group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.event.merge_group.head_ref || github.ref || github.run_id }} cancel-in-progress: true jobs: setup_merge_sha: name: Capture develop SHA runs-on: ubuntu-22.04 outputs: develop_sha: ${{ steps.get_sha.outputs.sha }} steps: - name: Get latest develop SHA id: get_sha run: | SHA=$(git ls-remote https://github.com/oppia/oppia.git refs/heads/develop | awk '{print $1}') echo "sha=$SHA" >> "$GITHUB_OUTPUT" generate-job-strategy-matrix: name: Generate job strategy matrix needs: setup_merge_sha runs-on: ubuntu-22.04 # Skip the job if we were only launched to cancel running jobs via the concurrency key above. if: ${{ ! ( (github.event_name == 'merge_group' && github.event.action == 'destroyed') || (github.event_name == 'pull_request' && github.event.action == 'closed') ) }} outputs: job-strategy-matrix: ${{ steps.generate.outputs.job-strategy-matrix }} steps: - name: Generate job strategy matrix id: generate env: standard-test-runs: 2 flakes-test-runs: 10 run: | if ${{ github.event_name == 'push' && github.repository == 'oppia/oppia' && github.ref == 'refs/heads/develop'}} then JOB_STRATEGY_MATRIX=$(node -e "let r=[]; for(let i = 1; i <= ${{ env.flakes-test-runs }}; i++) { r.push(i) }; console.log(JSON.stringify(r));") echo "job-strategy-matrix=$JOB_STRATEGY_MATRIX" >> $GITHUB_OUTPUT else JOB_STRATEGY_MATRIX=$(node -e "let r=[]; for(let i = 1; i <= ${{ env.standard-test-runs }}; i++) { r.push(i) }; console.log(JSON.stringify(r));") echo "job-strategy-matrix=$JOB_STRATEGY_MATRIX" >> $GITHUB_OUTPUT fi frontend-karma-tests: name: Run all tests needs: [generate-job-strategy-matrix, setup_merge_sha] runs-on: ubuntu-22.04 strategy: max-parallel: 25 fail-fast: ${{ github.event_name == 'merge_group' }} matrix: num_runs: ${{ fromJson(needs.generate-job-strategy-matrix.outputs.job-strategy-matrix) }} steps: - name: Checkout repository so that local actions can be used uses: actions/checkout@v4 - name: Merge develop and set up dependencies uses: ./.github/actions/merge-develop-and-set-up-dependencies with: merge_sha: ${{ needs.setup_merge_sha.outputs.develop_sha }} - name: Describe filesystem run: | pwd ls /home/runner/work ls /home/runner/work/oppia ls /home/runner/work/oppia/oppia echo $GITHUB_WORKSPACE - name: Suppress ENOSPC error from chokidar file watcher. See https://stackoverflow.com/a/32600959. run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p - name: Run frontend tests (attempt ${{ matrix.num_runs }}) id: run_frontend_tests run: python -m scripts.run_frontend_tests --check_coverage - name: Upload frontend coverage reports as an artifact if: ${{ always() }} uses: actions/upload-artifact@v4 with: name: frontend-coverage-${{ matrix.num_runs }} path: /home/runner/work/oppia/karma_coverage_reports permissions: pull-requests: write report-failure: name: Report failure needs: frontend-karma-tests runs-on: ubuntu-22.04 if: ${{ failure() && github.event_name == 'push' && github.repository == 'oppia/oppia' && github.ref == 'refs/heads/develop'}} steps: - name: Checkout repository uses: actions/checkout@v4 - name: Report failure if failed on oppia/oppia develop branch uses: ./.github/actions/send-webhook-notification with: message: "A frontend test failed on the upstream develop branch." webhook-url: ${{ secrets.BUILD_FAILURE_ROOM_WEBHOOK_URL }}