|
58 | 58 | # Simply run the tests for the project.
|
59 | 59 | ################################################################################
|
60 | 60 | - name: Run tests
|
| 61 | + if: github.event_name != 'push' || matrix.node-version != '12.x' || matrix.os != 'ubuntu-latest' |
| 62 | + run: npm test -- --no-coverage |
| 63 | + |
| 64 | + ################################################################################ |
| 65 | + # Run coverage check |
| 66 | + # |
| 67 | + # ASSUMPTIONS: |
| 68 | + # - The project has `tap` as a devDependency |
| 69 | + # - There is a script called "coverage" in the package.json |
| 70 | + # |
| 71 | + # Coverage should only be posted once, we are choosing the latest LTS of |
| 72 | + # node, and ubuntu as the matrix point to post coverage from. We limit |
| 73 | + # to the 'push' event so that coverage ins't posted twice from the |
| 74 | + # pull-request event, and push event (line 3). |
| 75 | + ################################################################################ |
| 76 | + - name: Run coverage report |
| 77 | + if: github.event_name == 'push' && matrix.node-version == '12.x' && matrix.os == 'ubuntu-latest' |
61 | 78 | run: npm test
|
| 79 | + env: |
| 80 | + # The environment variable name is leveraged by `tap` |
| 81 | + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} |
| 82 | + |
| 83 | + ################################################################################ |
| 84 | + # Run linting |
| 85 | + # |
| 86 | + # ASSUMPTIONS: |
| 87 | + # - There is a script called "lint" in the package.json |
| 88 | + # |
| 89 | + # We run linting AFTER we run testing and coverage checks, because if a step |
| 90 | + # fails in an GitHub Action, all other steps are not run. We don't want to |
| 91 | + # fail to run tests or coverage because of linting. It should be the lowest |
| 92 | + # priority of all the steps. |
| 93 | + ################################################################################ |
| 94 | + - name: Run linter |
| 95 | + run: npm run lint |
0 commit comments