109 lines (104 loc) · 3.53 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
# 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: {}
push: {}
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 * * *'
jobs:
test-primary:
name: Lint and Test on Node.js * x64 on ubuntu-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
# '*' is "latest":
# 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
node-version: '*'
architecture: x64
- 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@v1
- name: Upload coverage to Coveralls
# Note: @master is currently the only version
# https://github.com/coverallsapp/github-action/issues/11
uses: coverallsapp/github-action@master
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:
- '12.20'
- '*'
exclude:
# Exclude os/version already run in test-primary
- arch: x64
os: ubuntu-latest
node: '*'
steps:
- uses: actions/checkout@v2
- name: Set up Node.js ${{ matrix.node }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
architecture: ${{ matrix.arch }}
- 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@master
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@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true