-
Notifications
You must be signed in to change notification settings - Fork 0
226 lines (192 loc) · 8.58 KB
/
run-tests.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
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
name: run-tests
on:
push:
branches:
- "main"
- "ci"
pull_request:
jobs:
elm-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v3
with:
# Choose your Node.js version here:
node-version: 18.x
# Re-use node_modules between runs until package.json or package-lock.json changes.
- name: Cache node_modules
id: cache-node_modules
uses: actions/cache@v3
with:
path: elm-tests/node_modules
key: node_modules-${{ hashFiles('elm-tests/package.json', 'elm-tests/package-lock.json') }}
# Re-use ~/.elm between runs until elm.json, elm-tooling.json or
# review/elm.json changes. The Elm compiler saves downloaded Elm packages
# to ~/.elm, and elm-tooling saves downloaded tool executables there.
- name: Cache ~/.elm
uses: actions/cache@v3
with:
path: ~/.elm
key: elm-${{ hashFiles('elm-tests/elm.json', 'elm-tests/elm-tooling.json', 'example/review/elm.json') }}
# Install npm packages, unless we restored them from cache.
# Since `npm ci` removes the node_modules folder before running it’s
# important to skip this step if cache was restored.
# `npm ci` does two things:
# 1. Installs everything in package-lock.json.
# 2. Checks that package.json and package-lock.json are in sync.
# That’s why the cache depends on both package-lock.json and package.json.
- name: npm ci
if: steps.cache-node_modules.outputs.cache-hit != 'true'
env:
# If you have a `"postinstall": "elm-tooling install"` script in your
# package.json, this turns it into a no-op. We’ll run it in the next
# step because of the caching. If elm-tooling.json changes but
# package-lock.json does not, the postinstall script needs running
# but this step won’t.
NO_ELM_TOOLING_INSTALL: 1
working-directory: elm-tests
run: npm ci
# Install tools from elm-tooling.json, unless we restored them from
# cache. package-lock.json and elm-tooling.json can change independently,
# so we need to install separately based on what was restored from cache.
# This is run even if we restored ~/.elm from cache to be 100% sure
# node_modules/.bin/ contains links to all your tools. `elm-tooling
# install` runs very fast when there’s nothing new to download so
# skipping the step doesn’t save much time.
- name: elm-tooling install
working-directory: elm-tests
run: npx elm-tooling install
# Finally, run whatever you want. For example:
- name: link all packages
run: ./link-all-packages.sh
- run: tree ./elm-home
- run: cp -v -r ./elm-home/* ~/.elm/
- run: tree ~/.elm
- name: elm make
working-directory: elm-tests
run: npx elm make src/Main.elm --output=/dev/null
- name: elm-test
working-directory: elm-tests
run: npx elm-test-rs
js-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v3
with:
# Choose your Node.js version here:
node-version: 18.x
# Re-use node_modules between runs until package.json or package-lock.json changes.
- name: Cache node_modules
id: cache-node_modules
uses: actions/cache@v3
with:
path: js-tests/node_modules
key: node_modules-${{ hashFiles('js-tests/package.json', 'js-tests/package-lock.json') }}
# Re-use ~/.elm between runs until elm.json, elm-tooling.json or
# review/elm.json changes. The Elm compiler saves downloaded Elm packages
# to ~/.elm, and elm-tooling saves downloaded tool executables there.
- name: Cache ~/.elm
uses: actions/cache@v3
with:
path: ~/.elm
key: elm-${{ hashFiles('js-tests/elm.json', 'js-tests/elm-tooling.json') }}
# Install npm packages, unless we restored them from cache.
# Since `npm ci` removes the node_modules folder before running it’s
# important to skip this step if cache was restored.
# `npm ci` does two things:
# 1. Installs everything in package-lock.json.
# 2. Checks that package.json and package-lock.json are in sync.
# That’s why the cache depends on both package-lock.json and package.json.
- name: npm ci
if: steps.cache-node_modules.outputs.cache-hit != 'true'
env:
# If you have a `"postinstall": "elm-tooling install"` script in your
# package.json, this turns it into a no-op. We’ll run it in the next
# step because of the caching. If elm-tooling.json changes but
# package-lock.json does not, the postinstall script needs running
# but this step won’t.
NO_ELM_TOOLING_INSTALL: 1
working-directory: js-tests
run: npm ci
# Install tools from elm-tooling.json, unless we restored them from
# cache. package-lock.json and elm-tooling.json can change independently,
# so we need to install separately based on what was restored from cache.
# This is run even if we restored ~/.elm from cache to be 100% sure
# node_modules/.bin/ contains links to all your tools. `elm-tooling
# install` runs very fast when there’s nothing new to download so
# skipping the step doesn’t save much time.
- name: elm-tooling install
working-directory: js-tests
run: npx elm-tooling install
# Finally, run whatever you want. For example:
- name: link all packages
run: ./link-all-packages.sh
- run: tree ./elm-home
- run: cp -v -r ./elm-home/* ~/.elm/
- run: tree ~/.elm
- name: elm make
working-directory: js-tests
run: npx elm make src/FilePr17.elm --output=/dev/null
- run: npx jest --runInBand
working-directory: js-tests
browser-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v3
with:
# Choose your Node.js version here:
node-version: 18.x
# Re-use node_modules between runs until package.json or package-lock.json changes.
- name: Cache node_modules
id: cache-node_modules
uses: actions/cache@v3
with:
path: browser-tests/node_modules
key: node_modules-${{ hashFiles('browser-tests/package.json', 'browser-tests/package-lock.json') }}
# Install npm packages, unless we restored them from cache.
# Since `npm ci` removes the node_modules folder before running it’s
# important to skip this step if cache was restored.
# `npm ci` does two things:
# 1. Installs everything in package-lock.json.
# 2. Checks that package.json and package-lock.json are in sync.
# That’s why the cache depends on both package-lock.json and package.json.
- name: npm ci
if: steps.cache-node_modules.outputs.cache-hit != 'true'
env:
# If you have a `"postinstall": "elm-tooling install"` script in your
# package.json, this turns it into a no-op. We’ll run it in the next
# step because of the caching. If elm-tooling.json changes but
# package-lock.json does not, the postinstall script needs running
# but this step won’t.
NO_ELM_TOOLING_INSTALL: 1
working-directory: browser-tests
run: npm ci
# Install tools from elm-tooling.json, unless we restored them from
# cache. package-lock.json and elm-tooling.json can change independently,
# so we need to install separately based on what was restored from cache.
# This is run even if we restored ~/.elm from cache to be 100% sure
# node_modules/.bin/ contains links to all your tools. `elm-tooling
# install` runs very fast when there’s nothing new to download so
# skipping the step doesn’t save much time.
- name: elm-tooling install
working-directory: browser-tests
run: npx elm-tooling install
# Finally, run whatever you want. For example:
- name: link all packages
run: ./link-all-packages.sh
- run: tree ./elm-home
- run: cp -v -r ./elm-home/* ~/.elm/
- run: tree ~/.elm
- run: npx playwright install
working-directory: browser-tests
- run: npx playwright test
working-directory: browser-tests