| 1 | name: Test |
| 2 | |
| 3 | on: |
| 4 | - pull_request |
| 5 | - push |
| 6 | |
| 7 | env: |
| 8 | CACHE_PREFIX: v1 |
| 9 | YARN_VERSION: '^1.22.4' |
| 10 | |
| 11 | jobs: |
| 12 | test: |
| 13 | runs-on: ubuntu-latest |
| 14 | steps: |
| 15 | - uses: actions/checkout@v3 |
| 16 | |
| 17 | - uses: actions/setup-node@v3 |
| 18 | with: |
| 19 | node-version-file: '.nvmrc' |
| 20 | |
| 21 | - name: Install yarn |
| 22 | id: yarn |
| 23 | run: | |
| 24 | cd $HOME && yarn policies set-version $YARN_VERSION |
| 25 | echo "::set-output name=cache_dir::$(yarn cache dir)" |
| 26 | |
| 27 | - uses: actions/cache@v3 |
| 28 | with: |
| 29 | path: ${{ steps.yarn.outputs.cache_dir }} |
| 30 | key: yarn_cache-${{ env.CACHE_PREFIX }}-${{ hashFiles('**/yarn.lock') }} |
| 31 | restore-keys: yarn_cache-${{ env.CACHE_PREFIX }}- |
| 32 | |
| 33 | - run: yarn install |
| 34 | - run: yarn audit |
| 35 | |
| 36 | - name: Prettier formatting |
| 37 | run: yarn check:format |
| 38 | |
| 39 | - name: ESLint |
| 40 | run: yarn lint:js |
| 41 | |
| 42 | - name: TypeScript type checking |
| 43 | run: yarn check:ts |
| 44 |