forked from LavaMoat/LavaMoat
-
Notifications
You must be signed in to change notification settings - Fork 0
207 lines (200 loc) · 7.42 KB
/
nodejs.yml
File metadata and controls
207 lines (200 loc) · 7.42 KB
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
name: CI
on:
push:
branches:
- main # limit to main, because pushes to pull-requested branches are triggered below
pull_request:
# any pull request
permissions:
contents: read
env:
FORCE_COLOR: '1'
jobs:
test:
name: test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- node-version: 16.x
test-workspaces: >-
--workspace=packages/aa
--workspace=packages/allow-scripts
--workspace=packages/preinstall-always-fail
--workspace=packages/yarn-plugin-allow-scripts
- node-version: 18.x
test-workspaces: >-
--workspace=packages/aa
--workspace=packages/allow-scripts
--workspace=packages/browserify
--workspace=packages/core
--workspace=packages/lavapack
--workspace=packages/laverna
--workspace=packages/lavamoat-node
--workspace=packages/perf
--workspace=packages/preinstall-always-fail
--workspace=packages/survey
--workspace=packages/tofu
--workspace=packages/webpack
--workspace=packages/yarn-plugin-allow-scripts
- node-version: 20.x
test-workspaces: >-
--workspace=packages/aa
--workspace=packages/allow-scripts
--workspace=packages/browserify
--workspace=packages/core
--workspace=packages/lavapack
--workspace=packages/laverna
--workspace=packages/lavamoat-node
--workspace=packages/perf
--workspace=packages/preinstall-always-fail
--workspace=packages/survey
--workspace=packages/tofu
--workspace=packages/webpack
--workspace=packages/yarn-plugin-allow-scripts
- node-version: 22.x
test-workspaces: >-
--workspace=packages/aa
--workspace=packages/allow-scripts
--workspace=packages/browserify
--workspace=packages/core
--workspace=packages/lavapack
--workspace=packages/laverna
--workspace=packages/lavamoat-node
--workspace=packages/perf
--workspace=packages/preinstall-always-fail
--workspace=packages/survey
--workspace=packages/tofu
--workspace=packages/webpack
--workspace=packages/yarn-plugin-allow-scripts
steps:
- name: Checkout (PR)
if: github.event_name == 'pull_request'
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
# fetch-depth: 0 looks like it has a perf impact, so let's not do that if we don't have to.
# see https://github.com/actions/checkout/blob/main/README.md#usage
- name: Checkout (Push)
if: github.event_name != 'pull_request'
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0 # needed for dirty check
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Set npm version
run: |
corepack enable
npm --version
- name: Install Dependencies
uses: bahmutov/npm-install@6cee6086f1bf4467050e9a51e94bfb71b44cbc39 # v1.10.8
with:
useRollingCache: true
install-command: npm ci --foreground-scripts
- name: Test
run: |
npm run --if-present ${{ matrix.test-workspaces }} build
npm run build:types
npm run --if-present ${{ matrix.test-workspaces }} test:prep
npm run --if-present ${{ matrix.test-workspaces }} test
- name: Dirty Check
run: node ./scripts/dirty-check.js
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Install Dependencies
uses: bahmutov/npm-install@6cee6086f1bf4467050e9a51e94bfb71b44cbc39 # v1.10.8
with:
useRollingCache: true
install-command: npm ci --foreground-scripts
# the same thing could be accomplished via `npm lint` but this is helpful for organizing job output
- name: Lint Sources
run: npm run lint:eslint
- name: Lint Dependencies
run: npm run lint:deps
- name: Lint Lockfile
run: npm run lint:lockfile
compatibility-test-windows:
name: Test Windows compatibility
runs-on: windows-latest
strategy:
fail-fast: false
env:
FORCE_COLOR: 1
TEST_WORKSPACES: >-
--workspace=packages/aa
--workspace=packages/allow-scripts
--workspace=packages/core
--workspace=packages/lavapack
--workspace=packages/preinstall-always-fail
--workspace=packages/tofu
--workspace=packages/yarn-plugin-allow-scripts
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4
with:
node-version-file: .nvmrc
cache: npm
- name: Set npm version
run: |
corepack enable
npm --version
- name: Install Dependencies
uses: bahmutov/npm-install@6cee6086f1bf4467050e9a51e94bfb71b44cbc39 # v1.10.8
with:
useRollingCache: true
install-command: npm ci --foreground-scripts
- name: Test
run: |
npm run --if-present ${{ env.TEST_WORKSPACES }} build
npm run build:types
npm run --if-present ${{ env.TEST_WORKSPACES }} test:prep
npm run --if-present ${{ env.TEST_WORKSPACES }} test
compatibility-test-macos:
name: Test macOS compatibility
runs-on: macOS-latest
env:
FORCE_COLOR: 1
TEST_WORKSPACES: >-
--workspace=packages/aa
--workspace=packages/allow-scripts
--workspace=packages/browserify
--workspace=packages/core
--workspace=packages/lavapack
--workspace=packages/laverna
--workspace=packages/lavamoat-node
--workspace=packages/perf
--workspace=packages/preinstall-always-fail
--workspace=packages/survey
--workspace=packages/tofu
--workspace=packages/webpack
--workspace=packages/yarn-plugin-allow-scripts
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4
with:
node-version-file: .nvmrc
cache: npm
- name: Set npm version
run: |
corepack enable
npm --version
- name: Install Dependencies
uses: bahmutov/npm-install@6cee6086f1bf4467050e9a51e94bfb71b44cbc39 # v1.10.8
with:
useRollingCache: true
install-command: npm ci --foreground-scripts
- name: Test
run: |
npm run --if-present ${{ env.TEST_WORKSPACES }} build
npm run build:types
npm run --if-present ${{ env.TEST_WORKSPACES }} test:prep
npm run --if-present ${{ env.TEST_WORKSPACES }} test