-
Notifications
You must be signed in to change notification settings - Fork 1
127 lines (122 loc) · 4.38 KB
/
node.js.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# GitHub Actions Workflow configuration
# https://docs.github.com/actions/reference/workflow-syntax-for-github-actions
# https://docs.github.com/actions/guides/building-and-testing-nodejs
name: Node.js CI
# Note: on key treated as boolean key by YAML
# https://github.com/adrienverge/yamllint/issues/158#issuecomment-454313233
# However, GitHub Actions documentation is consistent in using it unquoted.
on: # yamllint disable-line rule:truthy
pull_request:
branches-ignore:
- template
push:
branches-ignore:
- template
schedule:
# Run once a day (at 8:40 AM UTC) to check for exogenous breakage.
# TODO: Run when dependencies are updated. (Like Dependabot, but on
# in-range updates and without sending a PR.)
- cron: '40 8 * * *'
workflow_dispatch: {}
jobs:
test-primary:
name: Lint and Test on Node.js * x64 on ubuntu-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
# Note: '*' is "latest LTS version" (without check-latest, it would be
# "latest LTS version in local cache") because it first checks
# https://github.com/actions/node-versions/releases then falls back to
# https://nodejs.org/dist/index.json
# For explanation and discussion, see:
# https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#check-latest-version=
# https://github.com/actions/setup-node/issues/61#issuecomment-577548687
# https://github.com/actions/setup-node/issues/164#issuecomment-648999618
# https://github.com/actions/setup-node/pull/104
#
# Support for "current"/"latest"/"node" was added in v3.2.0
# https://github.com/actions/setup-node/pull/483
node-version: latest
architecture: x64
check-latest: true
- name: Display Node.js version
run: node --version
- name: Install dependencies
run: npm install --strict-peer-deps
- name: Lint
run: npm run lint
- name: Run tests
run: npm run test-unit-cov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@v2
# Ignore intermittent server errors (which are out of our control).
# https://github.com/coverallsapp/github-action/issues/9
# https://github.com/coverallsapp/github-action/issues/79
# https://github.com/coverallsapp/github-action/issues/93
continue-on-error: true
with:
flag-name: 'ubuntu-latest_x64_*'
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true
test-secondary:
# Only test secondary platforms if primary test platform passed
needs:
- test-primary
name: >-
Test on Node.js ${{ matrix.node }} ${{ matrix.arch }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
arch:
# Uncomment if package needs testing on different architectures
# - x86
- x64
os:
# Uncomment if package needs testing on macOS:
# - macos-latest
- ubuntu-latest
- windows-latest
node:
- '18.0'
- latest
exclude:
# Exclude os/version already run in test-primary
- arch: x64
os: ubuntu-latest
node: latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
architecture: ${{ matrix.arch }}
check-latest: ${{ matrix.node == '*' }}
- name: Display Node.js version
run: node --version
- name: Install dependencies
run: npm install --strict-peer-deps
- name: Run tests
run: npm run test-unit-cov
# Note: Not uploading to Codecov, due to poor support for matrix builds
# https://github.com/codecov/codecov-action/issues/40
- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
flag-name: ${{ matrix.os }}_${{ matrix.arch }}_${{ matrix.node }}
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true
finish:
needs: test-secondary
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true