| 1 | name: (Shared) Lint |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: [main] |
| 6 | pull_request: |
| 7 | |
| 8 | permissions: {} |
| 9 | |
| 10 | concurrency: |
| 11 | group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.run_id }} |
| 12 | cancel-in-progress: true |
| 13 | |
| 14 | env: |
| 15 | TZ: /usr/share/zoneinfo/America/Los_Angeles |
| 16 | # https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout |
| 17 | SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1 |
| 18 | |
| 19 | jobs: |
| 20 | prettier: |
| 21 | name: Run prettier |
| 22 | runs-on: ubuntu-latest |
| 23 | steps: |
| 24 | - uses: actions/checkout@v4 |
| 25 | - uses: actions/setup-node@v4 |
| 26 | with: |
| 27 | node-version-file: '.nvmrc' |
| 28 | - name: Cache node_modules |
| 29 | uses: actions/cache@v4 |
| 30 | id: node_modules |
| 31 | with: |
| 32 | path: | |
| 33 | **/node_modules |
| 34 | key: shared-lint-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} |
| 35 | - name: Ensure clean build directory |
| 36 | run: rm -rf build |
| 37 | - run: yarn install --frozen-lockfile |
| 38 | if: steps.node_modules.outputs.cache-hit != 'true' |
| 39 | - run: yarn prettier-check |
| 40 | |
| 41 | eslint: |
| 42 | name: Run eslint |
| 43 | runs-on: ubuntu-latest |
| 44 | steps: |
| 45 | - uses: actions/checkout@v4 |
| 46 | - uses: actions/setup-node@v4 |
| 47 | with: |
| 48 | node-version-file: '.nvmrc' |
| 49 | - name: Restore cached node_modules |
| 50 | uses: actions/cache@v4 |
| 51 | id: node_modules |
| 52 | with: |
| 53 | path: | |
| 54 | **/node_modules |
| 55 | key: shared-lint-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} |
| 56 | - name: Ensure clean build directory |
| 57 | run: rm -rf build |
| 58 | - run: yarn install --frozen-lockfile |
| 59 | if: steps.node_modules.outputs.cache-hit != 'true' |
| 60 | - run: node ./scripts/tasks/eslint |
| 61 | |
| 62 | check_license: |
| 63 | name: Check license |
| 64 | runs-on: ubuntu-latest |
| 65 | steps: |
| 66 | - uses: actions/checkout@v4 |
| 67 | - uses: actions/setup-node@v4 |
| 68 | with: |
| 69 | node-version-file: '.nvmrc' |
| 70 | - name: Cache node_modules |
| 71 | uses: actions/cache@v4 |
| 72 | id: node_modules |
| 73 | with: |
| 74 | path: | |
| 75 | **/node_modules |
| 76 | key: shared-lint-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} |
| 77 | - name: Ensure clean build directory |
| 78 | run: rm -rf build |
| 79 | - run: yarn install --frozen-lockfile |
| 80 | if: steps.node_modules.outputs.cache-hit != 'true' |
| 81 | - run: ./scripts/ci/check_license.sh |
| 82 | |
| 83 | test_print_warnings: |
| 84 | name: Test print warnings |
| 85 | runs-on: ubuntu-latest |
| 86 | steps: |
| 87 | - uses: actions/checkout@v4 |
| 88 | - uses: actions/setup-node@v4 |
| 89 | with: |
| 90 | node-version-file: '.nvmrc' |
| 91 | - name: Cache node_modules |
| 92 | uses: actions/cache@v4 |
| 93 | id: node_modules |
| 94 | with: |
| 95 | path: | |
| 96 | **/node_modules |
| 97 | key: shared-lint-node_modules-v7-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} |
| 98 | - name: Ensure clean build directory |
| 99 | run: rm -rf build |
| 100 | - run: yarn install --frozen-lockfile |
| 101 | if: steps.node_modules.outputs.cache-hit != 'true' |
| 102 | - run: ./scripts/ci/test_print_warnings.sh |