-
Notifications
You must be signed in to change notification settings - Fork 130
94 lines (83 loc) · 2.5 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# 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@v3
with:
node-version: "16"
# Action Repo: https://github.com/actions/cache
- name: "Cache node_modules"
uses: actions/cache@v3
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"
- "19"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}
# Action Repo: https://github.com/actions/cache
- name: "Cache node_modules"
uses: actions/cache@v3
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@v3