Update README.md #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Useful GitHub Actions docs: | |
# | |
# - https://help.github.com/en/actions | |
# - https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions | |
# - https://help.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow | |
# - https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions | |
name: Test | |
on: | |
push: | |
branches-ignore: | |
# don't double-build dependabot PRs | |
- dependabot/** | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
# Job to run linter / autoformat | |
lint: | |
runs-on: ubuntu-20.04 | |
steps: | |
# Action Repo: https://github.com/actions/checkout | |
- name: "Checkout repo" | |
uses: actions/checkout@v2 | |
# Action Repo: https://github.com/actions/setup-node | |
- name: "Setup Node" | |
uses: actions/setup-node@v1 | |
with: | |
node-version: "14" | |
# Action Repo: https://github.com/actions/cache | |
- name: "Cache node_modules" | |
uses: actions/cache@v2 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-npm- | |
- name: "Install" | |
run: | | |
npm ci | |
# Run the pre-commit action | |
# Repo: https://github.com/pre-commit/action | |
- uses: actions/setup-python@v2 | |
- uses: pre-commit/[email protected] | |
- name: npm audit | |
run: | | |
# If this fails, run `npm audit fix` | |
npm audit --production --audit-level=moderate | |
test: | |
# no need to wait for lint | |
# needs: lint | |
runs-on: ubuntu-20.04 | |
# - https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategy | |
strategy: | |
fail-fast: false # Do not cancel all jobs if one fails | |
matrix: | |
node_version: | |
- "10" | |
- "12" | |
- "14" | |
- "15" | |
steps: | |
- name: "Checkout repo" | |
uses: actions/checkout@v2 | |
# Action Repo: https://github.com/actions/setup-node | |
- name: "Setup Node" | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node_version }} | |
# Action Repo: https://github.com/actions/cache | |
- name: "Cache node_modules" | |
uses: actions/cache@v2 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-npm- | |
- name: "Install dependencies" | |
run: | | |
npm ci | |
- name: "Run tests" | |
run: | | |
npm test | |
# Action Repo: https://github.com/codecov/codecov-action | |
- name: "Upload coverage to codecov" | |
uses: codecov/codecov-action@v1 |