| 1 | name: CI |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: |
| 6 | - master |
| 7 | pull_request: |
| 8 | |
| 9 | jobs: |
| 10 | build: |
| 11 | runs-on: ubuntu-latest |
| 12 | |
| 13 | strategy: |
| 14 | matrix: |
| 15 | node-version: [12.x, 14.x] |
| 16 | |
| 17 | steps: |
| 18 | - name: Checkout |
| 19 | uses: actions/checkout@v2 |
| 20 | |
| 21 | - name: Set node version to ${{ matrix.node-version }} |
| 22 | uses: actions/setup-node@v1 |
| 23 | with: |
| 24 | node-version: ${{ matrix.node-version }} |
| 25 | |
| 26 | - name: Install |
| 27 | run: npm ci |
| 28 | |
| 29 | - name: Build |
| 30 | run: npm run build --if-present |
| 31 | |
| 32 | - name: Lint |
| 33 | run: npm run lint |
| 34 | |
| 35 | - name: Test |
| 36 | if: github.ref != 'refs/heads/master' |
| 37 | run: npm run test |
| 38 | |
| 39 | - name: Test & Coverage |
| 40 | if: github.ref == 'refs/heads/master' |
| 41 | run: | |
| 42 | npm run test |
| 43 | export COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }} |
| 44 | npm run coverage |
| 45 | env: |
| 46 | CI: true |