Merge pull request #559 from mjpsyapse/replace-request #581
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
# This is a GitHub workflow defining a set of jobs with a set of steps. | |
# ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions | |
# | |
name: Test | |
on: | |
pull_request: | |
paths-ignore: | |
- "**.md" | |
- ".github/workflows/*" | |
- "!.github/workflows/publish.yml" | |
push: | |
paths-ignore: | |
- "**.md" | |
- ".github/workflows/*" | |
- "!.github/workflows/publish.yml" | |
branches-ignore: | |
- "dependabot/**" | |
- "pre-commit-ci-update-config" | |
tags: | |
- "**" | |
workflow_dispatch: | |
jobs: | |
# Audit dependencies for known vulnerabilities | |
audit-dependencies: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
# Action Repo: https://github.com/actions/cache | |
- name: "Cache node_modules" | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-npm- | |
- name: "Install dependencies (npm ci)" | |
run: | | |
npm ci | |
- name: npm audit | |
run: | | |
# If this fails, run `npm audit fix` | |
npm audit --production --audit-level=moderate | |
test: | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false # Do not cancel all jobs if one fails | |
matrix: | |
# IMPORTANT: Make sure to update package.json's engines.node field to | |
# always require at least the oldest version, as well as our | |
# README.md file under the install section. | |
node_version: | |
# Removing node 10 is dropping support for ubuntu 20.04 LTS | |
- "10" | |
- "12" | |
- "14" | |
- "16" | |
- "18" | |
- "20" | |
- current | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node_version }} | |
# Action Repo: https://github.com/actions/cache | |
- name: "Cache node_modules" | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-npm- | |
- name: "Install dependencies (npm ci)" | |
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@v4 |