|
| 1 | +# This workflow performs basic checks: |
| 2 | +# |
| 3 | +# 1. run a preparation step to install and cache node modules |
| 4 | +# 2. once prep succeeds, lint and test run in parallel |
| 5 | +# |
| 6 | +# The checks only run on non-draft Pull Requests. They don't run on the main |
| 7 | +# branch prior to deploy. It's recommended to use branch protection to avoid |
| 8 | +# pushes straight to 'main'. |
| 9 | + |
| 10 | +name: Checks |
| 11 | + |
| 12 | +on: |
| 13 | + pull_request: |
| 14 | + types: |
| 15 | + - opened |
| 16 | + - synchronize |
| 17 | + - reopened |
| 18 | + - ready_for_review |
| 19 | + |
| 20 | +env: |
| 21 | + NODE: 18 |
| 22 | + |
| 23 | +jobs: |
| 24 | + prep: |
| 25 | + if: github.event.pull_request.draft == false |
| 26 | + runs-on: ubuntu-latest |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: Cancel Previous Runs |
| 30 | + |
| 31 | + with: |
| 32 | + access_token: ${{ github.token }} |
| 33 | + |
| 34 | + - name: Checkout |
| 35 | + uses: actions/checkout@v3 |
| 36 | + |
| 37 | + - name: Use Node.js ${{ env.NODE }} |
| 38 | + uses: actions/setup-node@v3 |
| 39 | + with: |
| 40 | + node-version: ${{ env.NODE }} |
| 41 | + |
| 42 | + - name: Get yarn cache directory path |
| 43 | + id: yarn-cache-dir-path |
| 44 | + run: echo "::set-output name=dir::$(yarn cache dir)" |
| 45 | + working-directory: web-vite |
| 46 | + |
| 47 | + - uses: actions/cache@v3 |
| 48 | + id: yarn-cache |
| 49 | + with: |
| 50 | + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} |
| 51 | + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
| 52 | + restore-keys: | |
| 53 | + ${{ runner.os }}-yarn- |
| 54 | +
|
| 55 | + - name: Install |
| 56 | + run: yarn install |
| 57 | + working-directory: web-vite |
| 58 | + |
| 59 | + lint: |
| 60 | + needs: prep |
| 61 | + runs-on: ubuntu-latest |
| 62 | + |
| 63 | + steps: |
| 64 | + - name: Checkout |
| 65 | + uses: actions/checkout@v3 |
| 66 | + |
| 67 | + - name: Use Node.js ${{ env.NODE }} |
| 68 | + uses: actions/setup-node@v3 |
| 69 | + with: |
| 70 | + node-version: ${{ env.NODE }} |
| 71 | + |
| 72 | + - name: Get yarn cache directory path |
| 73 | + id: yarn-cache-dir-path |
| 74 | + run: echo "::set-output name=dir::$(yarn cache dir)" |
| 75 | + |
| 76 | + - uses: actions/cache@v3 |
| 77 | + id: yarn-cache |
| 78 | + with: |
| 79 | + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} |
| 80 | + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
| 81 | + restore-keys: | |
| 82 | + ${{ runner.os }}-yarn- |
| 83 | +
|
| 84 | + - name: Install |
| 85 | + run: yarn install |
| 86 | + working-directory: web-vite |
| 87 | + |
| 88 | + - name: Lint |
| 89 | + run: yarn lint |
| 90 | + working-directory: web-vite |
0 commit comments