123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- name: frontend
- on:
- push:
- branches:
- - master
- pull_request:
- concurrency:
- group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
- cancel-in-progress: true
- env:
- SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3
- NODE_OPTIONS: '--max-old-space-size=4096'
- jobs:
- files-changed:
- name: detect what files changed
- runs-on: ubuntu-22.04
- timeout-minutes: 3
-
- outputs:
- eslint_config: ${{ steps.changes.outputs.eslint_config }}
- frontend: ${{ steps.changes.outputs.frontend_all }}
- frontend_components_modified_lintable: ${{ steps.changes.outputs.frontend_components_modified_lintable }}
- frontend_components_modified_lintable_files: ${{ steps.changes.outputs.frontend_components_modified_lintable_files }}
- frontend_modified_lintable_files: ${{ steps.changes.outputs.frontend_modified_lintable_files }}
- yarn_lockfile: ${{ steps.changes.outputs.yarn_lockfile }}
- steps:
- - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- - name: Check for frontend file changes
- uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd
- id: changes
- with:
- token: ${{ github.token }}
- filters: .github/file-filters.yml
- list-files: shell
- typescript-and-lint:
- if: needs.files-changed.outputs.frontend == 'true'
- needs: files-changed
- name: typescript and lint
- runs-on: ubuntu-22.04
- steps:
- - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- - name: Internal github app token
- id: token
- uses: getsentry/action-github-app-token@d4b5da6c5e37703f8c3b3e43abb5705b46e159cc
- continue-on-error: true
- with:
- app_id: ${{ vars.SENTRY_INTERNAL_APP_ID }}
- private_key: ${{ secrets.SENTRY_INTERNAL_APP_PRIVATE_KEY }}
- - uses: getsentry/action-setup-volta@e4939d337b83760d13a9d7030a6f68c9d0ee7581
- - name: Install dependencies
- id: dependencies
- run: yarn install --frozen-lockfile
-
- - name: setup matchers
- run: |
- echo "::remove-matcher owner=masters::"
- echo "::add-matcher::.github/tsc.json"
- echo "::add-matcher::.github/eslint-stylish.json"
- - name: eslint logic
- id: eslint
- if: (github.ref == 'refs/heads/master' || needs.files-changed.outputs.eslint_config == 'true' || needs.files-changed.outputs.yarn_lockfile == 'true')
- run: echo "all-files=true" >> "$GITHUB_OUTPUT"
-
-
-
-
- - name: eslint
- if: steps.eslint.outputs.all-files == 'true'
- env:
-
- SENTRY_ESLINT_RELAXED: 1
- run: yarn lint
-
-
- - name: eslint (changed files only)
- if: steps.eslint.outputs.all-files != 'true'
- run: |
- yarn eslint --fix ${{ needs.files-changed.outputs.frontend_modified_lintable_files }}
- - name: stylelint (changed files only)
- if: github.ref != 'refs/heads/master' && needs.files-changed.outputs.frontend_components_modified_lintable == 'true'
- run: |
- yarn stylelint ${{ needs.files-changed.outputs.frontend_components_modified_lintable_files }}
- - name: biome
- if: github.ref != 'refs/heads/master' && needs.files-changed.outputs.frontend_components_modified_lintable == 'true'
- run: yarn biome check . --apply
-
-
-
- - name: Check for dirty git working tree (forks)
- if: steps.token.outcome != 'success' && github.ref != 'refs/heads/master'
- run: |
- git diff --quiet || (echo '::error ::lint produced file changes, run linter locally and try again' && exit 1)
-
- - name: Commit any eslint fixed files
- if: steps.token.outcome == 'success' && github.ref != 'refs/heads/master'
- uses: getsentry/action-github-commit@31f6706ca1a7b9ad6d22c1b07bf3a92eabb05632
- with:
- github-token: ${{ steps.token.outputs.token }}
- message: ':hammer_and_wrench: apply eslint style fixes'
- - name: tsc
- id: tsc
- if: steps.dependencies.outcome == 'success'
- run: yarn tsc -p config/tsconfig.ci.json
- frontend-jest-tests:
- if: needs.files-changed.outputs.frontend == 'true'
- needs: files-changed
- name: Jest
-
-
- runs-on: ubuntu-22.04
- timeout-minutes: 30
- strategy:
-
-
- fail-fast: false
- matrix:
-
- instance: [0, 1, 2, 3]
- steps:
- - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Checkout sentry
- with:
-
-
- fetch-depth: '2'
- - uses: getsentry/action-setup-volta@e4939d337b83760d13a9d7030a6f68c9d0ee7581
- - name: node_modules cache
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2
- id: nodemodulescache
- with:
- path: node_modules
- key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock', 'api-docs/yarn.lock') }}
- - name: Install Javascript Dependencies
- if: steps.nodemodulescache.outputs.cache-hit != 'true'
- run: yarn install --frozen-lockfile
- - name: jest
- env:
- GITHUB_PR_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
- GITHUB_PR_REF: ${{ github.event.pull_request.head.ref || github.ref }}
-
-
-
-
- CI_NODE_TOTAL: 4
- CI_NODE_INDEX: ${{ matrix.instance }}
-
-
-
-
-
- DEBUG_PRINT_LIMIT: 0
- run: |
- JEST_TESTS=$(yarn -s jest --listTests --json) yarn test-ci --forceExit
-
-
-
-
- - name: Handle artifacts
- uses: ./.github/actions/artifacts
- if: ${{ always() && needs.files-changed.outputs.frontend_all == 'true' }}
- with:
- files: .artifacts/coverage/*
- type: frontend
- token: ${{ secrets.CODECOV_TOKEN }}
-
-
-
- frontend-required-check:
- needs: [files-changed, frontend-jest-tests, typescript-and-lint]
- name: Frontend
-
- if: always()
- runs-on: ubuntu-22.04
- steps:
-
-
- - name: Check for failures
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
- run: |
- echo "One of the dependent jobs have failed. You may need to re-run it." && exit 1
|