|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: ['push', 'pull_request'] |
| 4 | + |
| 5 | +jobs: |
| 6 | + lint: |
| 7 | + name: Lint |
| 8 | + runs-on: ubuntu-latest |
| 9 | + |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v2 |
| 12 | + - name: Use Node.js 16.x |
| 13 | + uses: actions/setup-node@v2 |
| 14 | + with: |
| 15 | + node-version: 16.x |
| 16 | + |
| 17 | + - uses: actions/cache@v2 |
| 18 | + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) |
| 19 | + with: |
| 20 | + path: '**/node_modules' |
| 21 | + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
| 22 | + restore-keys: | |
| 23 | + ${{ runner.os }}-yarn- |
| 24 | +
|
| 25 | + - name: yarn install |
| 26 | + if: steps.yarn-cache.outputs.cache-hit != 'true' # Over here! |
| 27 | + run: yarn install --frozen-lockfile |
| 28 | + |
| 29 | + - name: yarn lint |
| 30 | + run: yarn lint |
| 31 | + |
| 32 | + env: |
| 33 | + CI: true |
| 34 | + |
| 35 | + test: |
| 36 | + name: Test |
| 37 | + runs-on: ubuntu-latest |
| 38 | + |
| 39 | + strategy: |
| 40 | + matrix: |
| 41 | + node-version: [12.x, 14.x, 16.x] |
| 42 | + |
| 43 | + steps: |
| 44 | + - uses: actions/checkout@v2 |
| 45 | + - name: Use Node.js ${{ matrix.node-version }} |
| 46 | + uses: actions/setup-node@v2 |
| 47 | + with: |
| 48 | + node-version: ${{ matrix.node-version }} |
| 49 | + |
| 50 | + - uses: actions/cache@v2 |
| 51 | + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) |
| 52 | + with: |
| 53 | + path: '**/node_modules' |
| 54 | + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
| 55 | + restore-keys: | |
| 56 | + ${{ runner.os }}-yarn- |
| 57 | +
|
| 58 | + - name: yarn install |
| 59 | + if: steps.yarn-cache.outputs.cache-hit != 'true' # Over here! |
| 60 | + run: yarn install --frozen-lockfile |
| 61 | + |
| 62 | + - name: yarn test |
| 63 | + run: yarn test |
| 64 | + |
| 65 | + env: |
| 66 | + CI: true |
| 67 | + |
| 68 | + coverage: |
| 69 | + name: Coverage |
| 70 | + runs-on: ubuntu-latest |
| 71 | + |
| 72 | + steps: |
| 73 | + - uses: actions/checkout@v2 |
| 74 | + - name: Use Node.js 16.x |
| 75 | + uses: actions/setup-node@v2 |
| 76 | + with: |
| 77 | + node-version: 16.x |
| 78 | + |
| 79 | + - uses: actions/cache@v2 |
| 80 | + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) |
| 81 | + with: |
| 82 | + path: '**/node_modules' |
| 83 | + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
| 84 | + restore-keys: | |
| 85 | + ${{ runner.os }}-yarn- |
| 86 | +
|
| 87 | + - name: yarn install |
| 88 | + if: steps.yarn-cache.outputs.cache-hit != 'true' # Over here! |
| 89 | + run: yarn install --frozen-lockfile |
| 90 | + |
| 91 | + - name: yarn coverage |
| 92 | + run: yarn coverage |
| 93 | + |
| 94 | + - name: Coveralls |
| 95 | + uses: coverallsapp/github-action@master |
| 96 | + with: |
| 97 | + github-token: ${{ secrets.github_token }} |
0 commit comments