123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- name: js build and lint
- on:
- # Only runs webpack on master to save bundle size info into artifacts
- # which are then used on PRs to compare against
- push:
- branches:
- - master
- pull_request:
- jobs:
- typescript-and-lint:
- name: typescript and lint
- runs-on: ubuntu-18.04
- steps:
- - uses: actions/checkout@v2
- - name: Internal github app token
- id: token
- uses: getsentry/action-github-app-token@v1
- continue-on-error: true
- with:
- app_id: ${{ secrets.SENTRY_INTERNAL_APP_ID }}
- private_key: ${{ secrets.SENTRY_INTERNAL_APP_PRIVATE_KEY }}
- - name: Check for frontend file changes
- uses: getsentry/paths-filter@master
- id: changes
- with:
- list-files: shell
- token: ${{ github.token }}
- filters: .github/file-filters.yml
- - uses: volta-cli/action@v1
- if: steps.changes.outputs.frontend == 'true'
- # See https://github.com/actions/cache/blob/master/examples.md#node---yarn for example
- - name: Get yarn cache directory path
- id: yarn-cache-dir-path
- if: steps.changes.outputs.frontend == 'true'
- run: echo "::set-output name=dir::$(yarn cache dir)"
- - uses: actions/cache@v1 # We are explicitly using v1 due to perf reasons
- if: steps.changes.outputs.frontend == 'true'
- with:
- path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
- key: ${{ runner.os }}-v2-yarn-${{ hashFiles('yarn.lock', 'api-docs/yarn.lock') }}
- - name: Install dependencies
- id: dependencies
- if: steps.changes.outputs.frontend == 'true'
- run: yarn install --frozen-lockfile
- # Setup custom tsc matcher, see https://github.com/actions/setup-node/issues/97
- - name: setup matchers
- if: steps.changes.outputs.frontend == 'true'
- 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: steps.changes.outputs.frontend == 'true' && (github.ref == 'refs/heads/master' || steps.changes.outputs.eslint_config == 'true' || steps.changes.outputs.yarn_lockfile == 'true')
- run: echo "::set-output name=all-files::true"
- # Lint entire frontend if:
- # - this is on main branch
- # - eslint configuration in repo has changed
- # - yarn lockfile has changed (i.e. we bump our eslint config)
- - name: eslint
- if: steps.eslint.outputs.all-files == 'true'
- run: |
- # Run relax config on main branch (and stricter config for changed files)
- yarn lint -c .eslintrc.relax.js
- yarn lint:css
- # Otherwise... only lint modified files
- # Note `eslint --fix` will not fail when it auto fixes files
- - name: eslint (changed files only)
- if: steps.changes.outputs.frontend == 'true' && steps.eslint.outputs.all-files != 'true'
- run: |
- yarn eslint --fix ${{ steps.changes.outputs.frontend_modified_lintable_files }}
- - name: stylelint (changed files only)
- if: github.ref != 'refs/heads/master' && steps.changes.outputs.frontend_components_modified_lintable == 'true'
- run: |
- yarn stylelint ${{ steps.changes.outputs.frontend_components_modified_lintable_files }}
- # Check (and error) for dirty working tree for forks
- # Reason being we need a different token to auto commit changes and
- # forks do not have access to said token
- - name: Check for dirty git working tree (forks)
- if: steps.token.outcome != 'success' && github.ref != 'refs/heads/master' && steps.changes.outputs.frontend == 'true'
- run: |
- git diff --quiet || (echo '::error ::lint produced file changes, run linter locally and try again' && exit 1)
- # If working tree is dirty, commit and update if we have a token
- - name: Commit any eslint fixed files
- if: steps.token.outcome == 'success' && github.ref != 'refs/heads/master' && steps.changes.outputs.frontend == 'true'
- uses: getsentry/action-github-commit@main
- with:
- github-token: ${{ steps.token.outputs.token }}
- - name: tsc
- if: steps.dependencies.outcome == 'success' && steps.changes.outputs.frontend == 'true'
- run: |
- set -o pipefail
- yarn tsc -p config/tsconfig.build.json --diagnostics | tee /tmp/typescript-monitor.log && yarn run ts-node .github/workflows/scripts/monitor-typescript.ts
- - name: storybook
- if: github.ref != 'refs/heads/master' && steps.changes.outputs.frontend == 'true'
- env:
- STORYBOOK_BUILD: 1
- run: |
- yarn storybook-build
- webpack:
- runs-on: ubuntu-18.04
- steps:
- - uses: actions/checkout@v2
- - name: Check for frontend file changes
- uses: getsentry/paths-filter@v2
- id: changes
- with:
- token: ${{ github.token }}
- filters: .github/file-filters.yml
- - uses: volta-cli/action@v1
- if: github.ref == 'refs/heads/master' || steps.changes.outputs.frontend == 'true'
- # See https://github.com/actions/cache/blob/master/examples.md#node---yarn for example
- - name: Get yarn cache directory path
- id: yarn-cache-dir-path
- if: github.ref == 'refs/heads/master' || steps.changes.outputs.frontend == 'true'
- run: echo "::set-output name=dir::$(yarn cache dir)"
- - uses: actions/cache@v1 # We are explicitly using v1 due to perf reasons
- if: github.ref == 'refs/heads/master' || steps.changes.outputs.frontend == 'true'
- with:
- path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
- key: ${{ runner.os }}-v2-yarn-${{ hashFiles('yarn.lock', 'api-docs/yarn.lock') }}
- - name: Install dependencies
- if: github.ref == 'refs/heads/master' || steps.changes.outputs.frontend == 'true'
- run: yarn install --frozen-lockfile
- - uses: getsentry/size-limit-action@v4
- if: github.ref == 'refs/heads/master' || steps.changes.outputs.frontend == 'true'
- env:
- SENTRY_INSTRUMENTATION: 1
- SENTRY_WEBPACK_WEBHOOK_SECRET: ${{ secrets.SENTRY_WEBPACK_WEBHOOK_SECRET }}
- with:
- main_branch: master
- skip_step: install
- build_script: build
- windows_verbatim_arguments: false
- github_token: ${{ secrets.GITHUB_TOKEN }}
|