4
4
pull_request :
5
5
branches :
6
6
- master
7
+ push :
8
+ branches :
9
+ - release
7
10
8
11
jobs :
9
- build :
10
- name : Build on ${{ matrix.os }}
11
- runs-on : ${{ matrix.os }}
12
+ check :
13
+ name : PR check
14
+ runs-on : ubuntu-latest
15
+ if : ${{ github.event_name == 'pull_request' && github.base_ref == 'master' }}
12
16
strategy :
13
17
matrix :
18
+ os : [ubuntu-latest]
19
+ ocaml-version : [4.14.1]
14
20
node-version : [16.x]
15
- os : [macOS-latest, windows-latest]
16
21
17
22
steps :
18
23
- name : Checkout repo
25
30
26
31
- name : Print Yarn cache
27
32
id : print-yarn-cache
28
- run : echo "::set-output name= yarn-cache:: $(yarn cache dir)"
33
+ run : echo "yarn-cache= $(yarn cache dir)" >> $GITHUB_OUTPUT
29
34
30
35
- name : Restore Yarn cache
31
36
id : yarn-cache
@@ -37,25 +42,16 @@ jobs:
37
42
- name : Install Yarn deps
38
43
run : yarn install
39
44
40
- - name : Install Esy
41
- run :
npm install -g [email protected]
42
-
43
- - name : Install Esy deps
44
- run : esy install
45
-
46
- - name : Print Esy cache
47
- id : print-esy-cache
48
- run : node .github/workflows/scripts/print-esy-cache.js
49
-
50
- - name : Restore Esy cache
51
- id : esy-cache
52
- uses : actions/cache@v1
45
+ - name : Setup OCaml ${{ matrix.ocaml-version }}
46
+ uses : ocaml/setup-ocaml@v2
53
47
with :
54
- path : ${{ steps.print-esy-cache.outputs.esy-cache }}
55
- key : ${{ matrix.os }}-esy-${{ hashFiles('**/index.json') }}
48
+ ocaml-compiler : ${{ matrix.ocaml-version }}
56
49
57
- - name : Build ppx
58
- run : esy build
50
+ - name : Install Opam deps
51
+ run : opam install . --deps-only --with-test
52
+
53
+ - name : Build PPX
54
+ run : opam exec -- dune build
59
55
60
56
- name : Build ReScript lib
61
57
run : |
@@ -64,69 +60,120 @@ jobs:
64
60
cd ../examples
65
61
yarn run build
66
62
67
- - name : Run ppx tests
68
- # FIXME: Snapshot tests are broken on Win
69
- if : matrix.os != 'windows-latest'
70
- run : esy x test.exe
63
+ - name : Run PPX tests
64
+ run : opam exec -- dune exec test.exe
71
65
72
66
- name : Run integration tests
73
67
run : |
74
68
cd specs
75
69
yarn run test
76
70
71
+
72
+ build_linux :
73
+ name : Build on ${{ matrix.container-os }}
74
+ runs-on : ${{ matrix.host-os }}
75
+ # if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/release' }}
76
+ strategy :
77
+ matrix :
78
+ host-os : [ubuntu-latest]
79
+ container-os : [linux-alpine]
80
+ ocaml-version : [4.14.1]
81
+ node-version : [16.x]
82
+ container :
83
+ image : alex35mil/alpine-ocaml-opam-node-yarn:alpine-3.19-ocaml-4.14-node-16.20-yarn-1.22-o5gm
84
+
85
+ steps :
86
+ - name : Checkout repo
87
+ uses : actions/checkout@v2
88
+
89
+ - name : Print Yarn cache
90
+ id : print-yarn-cache
91
+ run : echo "yarn-cache=$(yarn cache dir)" >> $GITHUB_OUTPUT
92
+
93
+ - name : Restore Yarn cache
94
+ id : yarn-cache
95
+ uses : actions/cache@v1
96
+ with :
97
+ path : ${{ steps.print-yarn-cache.outputs.yarn-cache }}
98
+ key : ${{ matrix.container-os }}-yarn-${{ hashFiles('**/yarn.lock') }}
99
+
100
+ - name : Install Yarn deps
101
+ run : yarn install
102
+
103
+ - name : Setup OCaml ${{ matrix.ocaml-version }}
104
+ run : opam init -a --disable-sandboxing --compiler=${{ matrix.ocaml-version }}
105
+
106
+ - name : Install Opam deps
107
+ run : opam install . --deps-only --with-test
108
+
109
+ - name : Build PPX
110
+ run : opam exec -- dune build --profile static
111
+
112
+ - name : Build ReScript lib
113
+ run : |
114
+ cd lib
115
+ yarn run build
116
+ cd ../examples
117
+ yarn run build
118
+
119
+ - name : Run PPX tests
120
+ run : opam exec -- dune exec test.exe
121
+
122
+ # NOTE: Integration tests are broken on Alpine
123
+ # - name: Run integration tests
124
+ # run: |
125
+ # cd specs
126
+ # yarn run test
127
+
77
128
- name : Upload artifacts
78
129
uses : actions/upload-artifact@v1
79
130
with :
80
- name : ${{ matrix.os }}
131
+ name : ${{ matrix.container- os }}
81
132
path : _build/default/ppx/bin/bin.exe
82
133
83
- build_linux :
134
+ build_macos :
84
135
name : Build on ${{ matrix.os }}
85
136
runs-on : ${{ matrix.os }}
137
+ # if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/release' }}
86
138
strategy :
87
139
matrix :
88
- os : [ubuntu-latest]
89
-
90
- container :
91
- image : alexfedoseev/alpine-node-yarn-esy:0.0.10
140
+ os : [macos-13, macos-14]
141
+ ocaml-version : [4.14.1]
142
+ node-version : [16.x]
92
143
93
144
steps :
94
145
- name : Checkout repo
95
146
uses : actions/checkout@v2
96
147
97
- - name : Apply static linking patch
98
- run : git apply linux.patch
148
+ - name : Setup Node ${{ matrix.node-version }}
149
+ uses : actions/setup-node@v1
150
+ with :
151
+ node-version : ${{ matrix.node-version }}
99
152
100
153
- name : Print Yarn cache
101
154
id : print-yarn-cache
102
- run : echo "::set-output name= yarn-cache:: $(yarn cache dir)"
155
+ run : echo "yarn-cache= $(yarn cache dir)" >> $GITHUB_OUTPUT
103
156
104
157
- name : Restore Yarn cache
105
158
id : yarn-cache
106
159
uses : actions/cache@v1
107
160
with :
108
161
path : ${{ steps.print-yarn-cache.outputs.yarn-cache }}
109
- key : ${{ matrix.os }}-yarn-${{ hashFiles('yarn.lock') }}-v1
162
+ key : ${{ matrix.os }}-yarn-${{ hashFiles('**/ yarn.lock') }}
110
163
111
164
- name : Install Yarn deps
112
165
run : yarn install
113
166
114
- - name : Install Esy deps
115
- run : esy install
116
-
117
- - name : Print Esy cache
118
- id : print-esy-cache
119
- run : node .github/workflows/scripts/print-esy-cache.js
120
-
121
- - name : Restore Esy cache
122
- id : esy-cache
123
- uses : actions/cache@v1
167
+ - name : Setup OCaml ${{ matrix.ocaml-version }}
168
+ uses : ocaml/setup-ocaml@v2
124
169
with :
125
- path : ${{ steps.print-esy-cache.outputs.esy-cache }}
126
- key : ${{ matrix.os }}-esy-${{ hashFiles('esy.lock/index.json') }}
170
+ ocaml-compiler : ${{ matrix.ocaml-version }}
171
+
172
+ - name : Install Opam deps
173
+ run : opam install . --deps-only --with-test
127
174
128
- - name : Build ppx
129
- run : esy build
175
+ - name : Build PPX
176
+ run : opam exec -- dune build
130
177
131
178
- name : Build ReScript lib
132
179
run : |
@@ -135,27 +182,29 @@ jobs:
135
182
cd ../examples
136
183
yarn run build
137
184
138
- - name : Run ppx tests
139
- run : esy x test.exe
185
+ - name : Run PPX tests
186
+ run : opam exec -- dune exec test.exe
140
187
141
- # FIXME: Integration tests are broken on Linux
142
- # - name: Run integration tests
143
- # run: |
144
- # cd specs
145
- # yarn run test
188
+ - name : Run integration tests
189
+ run : |
190
+ cd specs
191
+ yarn run test
146
192
147
193
- name : Upload artifacts
148
194
uses : actions/upload-artifact@v1
149
195
with :
150
196
name : ${{ matrix.os }}
151
197
path : _build/default/ppx/bin/bin.exe
152
198
153
- rc :
154
- needs :
155
- - build
156
- - build_linux
157
- name : Prepare RC
158
- runs-on : ubuntu-latest
199
+ build_windows :
200
+ name : Build on ${{ matrix.os }}
201
+ runs-on : ${{ matrix.os }}
202
+ # if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/release' }}
203
+ strategy :
204
+ matrix :
205
+ os : [windows-latest]
206
+ ocaml-version : [4.14.1]
207
+ node-version : [16.x]
159
208
160
209
steps :
161
210
- name : Checkout repo
@@ -164,45 +213,107 @@ jobs:
164
213
- name : Setup Node ${{ matrix.node-version }}
165
214
uses : actions/setup-node@v1
166
215
with :
167
- node-version : 16.x
216
+ node-version : ${{ matrix.node-version }}
168
217
169
- - name : Download Linux artifacts
170
- uses : actions/download-artifact@v1
171
- with :
172
- name : ubuntu-latest
173
- path : _bin/linux
218
+ - name : Print Yarn cache
219
+ id : print-yarn-cache
220
+ run : echo "::set-output name=yarn-cache::$(yarn cache dir)" # Using the old way as the new way doesn't work on windows
174
221
175
- - name : Download macOS artifacts
176
- uses : actions/download-artifact@v1
222
+ - name : Restore Yarn cache
223
+ id : yarn-cache
224
+ uses : actions/cache@v1
177
225
with :
178
- name : macOS-latest
179
- path : _bin/darwin
226
+ path : ${{ steps.print-yarn-cache.outputs.yarn-cache }}
227
+ key : ${{ matrix.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
180
228
181
- - name : Download Windows artifacts
182
- uses : actions/download-artifact@v1
229
+ - name : Install Yarn deps
230
+ run : yarn install
231
+
232
+ - name : Setup OCaml ${{ matrix.ocaml-version }}
233
+ uses : ocaml/setup-ocaml@v2
183
234
with :
184
- name : windows-latest
185
- path : _bin/windows
235
+ ocaml-compiler : ${{ matrix.ocaml-version }}
186
236
187
- - name : Move artifacts
237
+ - name : Install Opam deps
238
+ run : opam install . --deps-only --with-test
239
+
240
+ - name : Build PPX
241
+ run : opam exec -- dune build
242
+
243
+ - name : Build ReScript lib
188
244
run : |
189
- mkdir -p _release/bin
190
- mv _bin/darwin/bin.exe _release/bin/re-formality-ppx-darwin-x64.exe
191
- mv _bin/windows/bin.exe _release/bin/re-formality-ppx-win-x64.exe
192
- mv _bin/linux/bin.exe _release/bin/re-formality-ppx-linux-x64.exe
193
- rm -rf _bin
245
+ cd lib
246
+ yarn run build
247
+ cd ../examples
248
+ yarn run build
194
249
195
- - name : Move lib files
250
+ - name : Run PPX tests
251
+ run : opam exec -- dune exec test.exe
252
+
253
+ - name : Run integration tests
196
254
run : |
197
- mkdir -p _release/src
198
- cp README.md _release/README.md
199
- cp lib/bsconfig.json _release/bsconfig.json
200
- cp -a lib/src/. _release/src/
201
- cp .github/workflows/scripts/postinstall.js _release/postinstall.js
202
- node .github/workflows/scripts/write-package-json.js
203
-
204
- - name : Upload release
255
+ cd specs
256
+ yarn run test
257
+
258
+ - name : Upload artifacts
205
259
uses : actions/upload-artifact@v1
206
260
with :
207
- name : release
208
- path : _release
261
+ name : ${{ matrix.os }}
262
+ path : _build/default/ppx/bin/bin.exe
263
+
264
+ # rc:
265
+ # needs:
266
+ # - build
267
+ # - build_linux
268
+ # name: Prepare RC
269
+ # runs-on: ubuntu-latest
270
+ #
271
+ # steps:
272
+ # - name: Checkout repo
273
+ # uses: actions/checkout@v2
274
+ #
275
+ # - name: Setup Node ${{ matrix.node-version }}
276
+ # uses: actions/setup-node@v1
277
+ # with:
278
+ # node-version: 16.x
279
+ #
280
+ # - name: Download Linux artifacts
281
+ # uses: actions/download-artifact@v1
282
+ # with:
283
+ # name: ubuntu-latest
284
+ # path: _bin/linux
285
+ #
286
+ # - name: Download macOS artifacts
287
+ # uses: actions/download-artifact@v1
288
+ # with:
289
+ # name: macOS-latest
290
+ # path: _bin/darwin
291
+ #
292
+ # - name: Download Windows artifacts
293
+ # uses: actions/download-artifact@v1
294
+ # with:
295
+ # name: windows-latest
296
+ # path: _bin/windows
297
+ #
298
+ # - name: Move artifacts
299
+ # run: |
300
+ # mkdir -p _release/bin
301
+ # mv _bin/darwin/bin.exe _release/bin/re-formality-ppx-darwin-x64.exe
302
+ # mv _bin/windows/bin.exe _release/bin/re-formality-ppx-win-x64.exe
303
+ # mv _bin/linux/bin.exe _release/bin/re-formality-ppx-linux-x64.exe
304
+ # rm -rf _bin
305
+ #
306
+ # - name: Move lib files
307
+ # run: |
308
+ # mkdir -p _release/src
309
+ # cp README.md _release/README.md
310
+ # cp lib/bsconfig.json _release/bsconfig.json
311
+ # cp -a lib/src/. _release/src/
312
+ # cp .github/workflows/scripts/postinstall.js _release/postinstall.js
313
+ # node .github/workflows/scripts/write-package-json.js
314
+ #
315
+ # - name: Upload release
316
+ # uses: actions/upload-artifact@v1
317
+ # with:
318
+ # name: release
319
+ # path: _release
0 commit comments