@@ -11,14 +11,53 @@ concurrency:
11
11
# Cancel previous builds for pull requests only.
12
12
cancel-in-progress : ${{ github.event_name == 'pull_request' }}
13
13
14
+ env :
15
+ OCAMLRUNPARAM : b
16
+ DUNE_PROFILE : release
17
+
14
18
jobs :
19
+ # Build statically linked Linux binaries in an Alpine-based Docker container
20
+ # See https://ocamlpro.com/blog/2021_09_02_generating_static_and_portable_executables_with_ocaml
21
+ # for more info.
22
+ # The container already comes with all required tools pre-installed
23
+ # (see https://github.com/rescript-lang/docker-rescript-ci-build/blob/main/Dockerfile).
24
+ static-binaries-linux :
25
+ runs-on : ubuntu-latest
26
+
27
+ container :
28
+ image : ghcr.io/rescript-lang/rescript-ci-build
29
+
30
+ steps :
31
+ - name : Checkout
32
+ uses : actions/checkout@v3
33
+
34
+ - name : Apply static linking patch
35
+ run : git apply scripts/dune-static-linking.patch
36
+
37
+ - name : Build compiler binaries
38
+ run : opam exec -- dune build
39
+
40
+ - name : Build ninja binary
41
+ working-directory : ninja
42
+ env :
43
+ LDFLAGS : -static
44
+ run : python3 configure.py --bootstrap --verbose
45
+
46
+ - name : " Upload artifacts"
47
+ uses : actions/upload-artifact@v3
48
+ with :
49
+ name : static-binaries-linux
50
+ path : |
51
+ _build/install/default/bin
52
+ ninja/ninja
53
+
15
54
build :
55
+ needs : static-binaries-linux
56
+
16
57
strategy :
17
58
fail-fast : false
18
59
matrix :
19
- # Stay on the oldest Ubuntu version that's still supported by Github Actions
20
- # to avoid glibc incompatibilities as far as possible.
21
- os : [macos-latest, ubuntu-20.04, windows-latest, macos-arm]
60
+ os : [macos-latest, ubuntu-latest, windows-latest, macos-arm]
22
61
ocaml_compiler : [4.14.0]
23
62
24
63
runs-on : ${{matrix.os}}
39
78
with :
40
79
fetch-depth : 2 # to be able to check for changes in subfolder res_syntax later
41
80
81
+ - name : Download static linux binaries
82
+ if : runner.os == 'Linux'
83
+ uses : actions/download-artifact@v3
84
+ with :
85
+ name : static-binaries-linux
86
+
87
+ - name : Make static linux binaries executable
88
+ if : runner.os == 'Linux'
89
+ run : |
90
+ chmod +x ninja/ninja
91
+ chmod +x _build/install/default/bin/*
92
+
42
93
- name : Use OCaml ${{matrix.ocaml_compiler}}
43
94
uses : ocaml/setup-ocaml@v2
44
95
with :
@@ -49,19 +100,31 @@ jobs:
49
100
- name : " Install OPAM dependencies"
50
101
run : opam install . --deps-only
51
102
103
+ - name : " Build compiler"
104
+ if : runner.os != 'Linux'
105
+ run : opam exec -- dune build
106
+
52
107
- name : Use Node.js
53
108
uses : actions/setup-node@v3
54
109
with :
55
110
node-version : 16
56
111
57
- - name : " Build compiler"
58
- run : |
59
- opam exec -- dune build
60
- node ./scripts/copyExes.js
61
-
62
112
- name : Install npm packages
63
113
run : npm ci --ignore-scripts
64
114
115
+ - name : " Windows: Use MSVC for ninja build"
116
+ if : runner.os == 'Windows'
117
+ uses : TheMrMilchmann/setup-msvc-dev@v2
118
+ with :
119
+ arch : x64
120
+
121
+ - name : Build ninja
122
+ if : runner.os != 'Linux'
123
+ run : node scripts/buildNinjaBinary.js
124
+
125
+ - name : Copy exes to platform bin dirs
126
+ run : node ./scripts/copyExes.js
127
+
65
128
- name : " Check if syntax subfolder has changed"
66
129
id : syntax-diff
67
130
shell : bash
@@ -74,38 +137,28 @@ jobs:
74
137
75
138
- name : " Syntax: Run roundtrip tests"
76
139
if : ${{ env.syntax_status == 'changed' && runner.os != 'Windows' }}
77
- run : opam exec -- make test-syntax-roundtrip
140
+ run : make test-syntax-roundtrip
78
141
79
142
- name : " Syntax: Run tests (Windows)"
80
143
if : ${{ env.syntax_status == 'changed' && runner.os == 'Windows' }}
81
- run : opam exec -- make test-syntax
82
-
83
- # Required for ninja build
84
- - name : " Windows: Use MSVC"
85
- if : runner.os == 'Windows'
86
- uses : TheMrMilchmann/setup-msvc-dev@v2
87
- with :
88
- arch : x64
89
-
90
- - name : Build ninja
91
- run : node scripts/buildNinjaBinary.js
144
+ run : make test-syntax
92
145
93
146
- name : Build runtime/stdlib
94
147
if : runner.os != 'Windows'
95
148
run : |
96
- opam exec -- dune exec -- node ./scripts/ninja.js config
97
- opam exec -- dune exec -- node ./scripts/ninja.js build
149
+ opam exec -- node ./scripts/ninja.js config
150
+ opam exec -- node ./scripts/ninja.js build
98
151
99
152
- name : Check for changes in lib folder
100
153
run : git diff --exit-code lib/js lib/es6
101
154
102
155
- name : Run tests
103
156
if : runner.os != 'Windows'
104
- run : opam exec -- dune exec -- node scripts/ciTest.js -all
157
+ run : node scripts/ciTest.js -all
105
158
106
159
- name : Run tests (Windows)
107
160
if : runner.os == 'Windows'
108
- run : opam exec -- dune exec -- node scripts/ciTest.js -mocha -theme -format
161
+ run : node scripts/ciTest.js -mocha -theme -format
109
162
110
163
- name : Prepare artifact upload
111
164
run : |
@@ -216,30 +269,3 @@ jobs:
216
269
run : npx rescript -h && npx rescript build && cat src/Test.bs.js
217
270
shell : bash
218
271
working-directory : packages/test
219
-
220
- # The following job tests installation from source on FreeBSD via cross-platform-actions.
221
- # Disabled by default, as it takes ~11m.
222
- # Can be enabled temporarily in a PR to verify that installation from source
223
- # on an "exotic" platform still works.
224
- #
225
- # installationTestFreeBSD:
226
- # needs: package
227
- # runs-on: macos-latest
228
- #
229
- # steps:
230
- # - name: Checkout
231
- # uses: actions/checkout@v3
232
- #
233
- # - name: Download artifacts
234
- # uses: actions/download-artifact@v3
235
- # with:
236
- # name: npm-packages
237
- # path: packages/test
238
- #
239
- # - name: Test installation on FreeBSD
240
- # uses: cross-platform-actions/action@v0.6.2
241
- # with:
242
- # operating_system: freebsd
243
- # version: "13.0"
244
- # shell: bash
245
- # run: cd packages/test && ./test_freebsd.sh
0 commit comments