forked from ocaml/ocaml
-
Notifications
You must be signed in to change notification settings - Fork 0
304 lines (295 loc) · 12.2 KB
/
Copy pathbuild.yml
File metadata and controls
304 lines (295 loc) · 12.2 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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
name: Build
on:
push:
branches:
- '4.**'
- '5.**'
- 'trunk'
pull_request:
# Restrict the GITHUB_TOKEN
permissions: {}
env:
# List of test directories for the debug-s4096 and linux-O0 jobs. These
# directories are selected because of their tendencies to reach corner cases
# in the runtime system.
PARALLEL_TESTS: parallel callback gc-roots weak-ephe-final
# Fully print commands executed by Make
# MAKEFLAGS: V=1
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
# Concurrent workflows are grouped by the PR or branch that triggered them
# (github.ref) and the name of the workflow (github.workflow). The
# 'cancel-in-progress' option then make sure that only one workflow is running
# at a time. This doesn't prevent new jobs from running, rather it cancels
# already running jobs before scheduling new jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name == 'pull_request' || github.sha }}
cancel-in-progress: true
jobs:
# This job will do the initial build of the compiler (on linux), with flambda on.
# We then upload the compiler tree as a build artifact to enable re-use in
# subsequent jobs.
build:
runs-on: ubuntu-latest
outputs:
manual_changed: ${{ steps.manual.outputs.manual_changed }}
steps:
- name: Checkout
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
with:
persist-credentials: false
- name: Check for manual changes
id: manual
run: >-
tools/ci/actions/check-manual-modified.sh
"$GITHUB_REF_NAME"
"$EVENT_NAME"
"$PR_BASE_REF"
"$PR_BASE_SHA"
"$PR_HEAD_REF"
"$PR_HEAD_SHA"
"$EVENT_REF"
"$EVENT_BEFORE"
"$EVENT_REF"
"$EVENT_AFTER"
"$REPO_FULL_NAME"
env:
GITHUB_REF_NAME: ${{ github.ref }}
EVENT_NAME: ${{ github.event_name }}
PR_BASE_REF: ${{ github.event.pull_request.base.ref }}
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
EVENT_REF: ${{ github.event.ref }}
EVENT_BEFORE: ${{ github.event.before }}
EVENT_AFTER: ${{ github.event.after }}
REPO_FULL_NAME: ${{ github.event.repository.full_name }}
- name: Configure tree
run: |
MAKE_ARG=-j CONFIG_ARG='--enable-flambda --enable-cmm-invariants --enable-codegen-invariants --enable-dependency-generation --enable-native-toplevel' OCAMLRUNPARAM=b,v=0 bash -xe tools/ci/actions/runner.sh configure
- name: Build
run: |
MAKE_ARG=-j bash -xe tools/ci/actions/runner.sh build
- name: Prepare Artifact
run: tar --zstd -cf /tmp/sources.tar.zstd .
- name: Upload Artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: compiler
path: /tmp/sources.tar.zstd
retention-days: 1
# Full testsuite run, and other sanity checks
# "extra" testsuite runs, reusing the previously built compiler tree.
# debug: running the full testsuite with the
# debug runtime and minor heap verification.
# debug-s4096: select testsuite run with the debug runtime and a small
# minor heap.
normal:
name: ${{ matrix.name }}
needs: [build, config]
runs-on: ubuntu-latest
strategy:
matrix:
include:
- id: normal
name: normal
dependencies: texlive-latex-extra texlive-fonts-recommended texlive-luatex hevea sass gdb lldb
- id: debug
name: extra (debug)
- id: debug-s4096
name: extra (debug-s4096)
fail-fast: true
steps:
- name: Download Artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: compiler
- name: Unpack Artifact
run: |
tar --zstd -xf sources.tar.zstd
rm -f sources.tar.zstd
- name: Packages
if: matrix.dependencies != ''
run: |
sudo apt-get update -y
sudo apt-get install -y ${{ matrix.dependencies }}
- name: Run the testsuite
if: ${{ matrix.id == 'normal' && needs.config.outputs.skip-testsuite != 'true' }}
run: |
MAKE_ARG=-j OCAMLRUNPARAM=b,v=0 bash -xe tools/ci/actions/runner.sh test
- name: Run the testsuite (debug runtime)
if: ${{ matrix.id == 'debug' && needs.config.outputs.skip-testsuite != 'true' }}
env:
OCAMLRUNPARAM: v=0,V=1
USE_RUNTIME: d
run: |
bash -cxe "SHOW_TIMINGS=1 tools/ci/actions/runner.sh test"
- name: Run the testsuite (s=4096, debug runtime)
if: ${{ matrix.id == 'debug-s4096' && needs.config.outputs.skip-testsuite != 'true' }}
env:
OCAMLRUNPARAM: s=4096,v=0
USE_RUNTIME: d
run: |
for dir in $PARALLEL_TESTS; do \
bash -cxe "SHOW_TIMINGS=1 tools/ci/actions/runner.sh test_prefix $dir"; \
done
- name: Build API Documentation
if: matrix.id == 'normal'
run: |
MAKE_ARG=-j OCAMLRUNPARAM=b,v=0 bash -xe tools/ci/actions/runner.sh api-docs
- name: Install
if: matrix.id == 'normal'
run: |
MAKE_ARG=-j OCAMLRUNPARAM=b,v=0 bash -xe tools/ci/actions/runner.sh install
- name: Test in prefix
if: matrix.id == 'normal'
run: |
MAKE_ARG=-j OCAMLRUNPARAM=b,v=0 bash -xe tools/ci/actions/runner.sh test-in-prefix
- name: Build the manual
if: matrix.id == 'normal' && needs.build.outputs.manual_changed == 'true'
run: |
MAKE_ARG=-j OCAMLRUNPARAM=b,v=0 bash -xe tools/ci/actions/runner.sh manual
- name: Other checks
if: matrix.id == 'normal'
run: |
MAKE_ARG=-j OCAMLRUNPARAM=b,v=0 bash -xe tools/ci/actions/runner.sh other-checks
# macOS build+testsuite run, and other Linux configurations (-O0, etc.)
config:
runs-on: ubuntu-latest
outputs:
jobs: ${{ steps.jobs.outputs.result }}
skip-testsuite: ${{ steps.skip.outputs.result }}
steps:
- name: Compute matrix for the "others" job
id: jobs
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0
with:
script: |
// # Default jobs: Linux -O0, Linux arm64 & macOS
let jobs = [
{name: 'linux-O0', os: 'ubuntu-latest',
config_arg: "CFLAGS='-O0'"},
{name: 'linux-arm64', os: 'ubuntu-24.04-arm',
'test-in-prefix': true},
{name: 'macos-x86_64', os: 'macos-13',
'test-in-prefix': true},
{name: 'macos-arm64', os: 'macos-15',
'test-in-prefix': true}];
// # If this is a pull request, see if the PR has the
// # 'CI: Full matrix' label. This is done using an API request,
// # rather than from context.payload.pull_request.labels, since we
// # want the _current_ list of labels. This allows the labelling to
// # be changed, and then forcing a re-run of the workflow, rather
// # than having labelling triggering a fresh workflow event (which
// # is wasteful).
if (context.payload.pull_request) {
const { data: labels } =
await github.rest.issues.listLabelsOnIssue({...context.repo, issue_number: context.payload.pull_request.number});
if (labels.some(label => label.name === 'CI: Full matrix')) {
console.log('Full matrix requested');
// # Add "static" and "minimal" jobs
jobs = jobs.concat([
{name: 'static', os: 'ubuntu-latest',
config_arg: '--disable-native-toplevel --disable-shared',
'test-in-prefix': true},
{name: 'minimal', os: 'ubuntu-latest',
config_arg: '--disable-native-toplevel --disable-native-compiler --disable-shared --disable-debug-runtime --disable-instrumented-runtime --disable-systhreads --disable-str-lib --disable-unix-lib --disable-ocamldoc'}]);
}
}
return jobs;
- name: Determine if the testsuite should be skipped
id: skip
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0
with:
script: |
let skip_testsuite = false;
if (context.payload.pull_request) {
const { data: labels } =
await github.rest.issues.listLabelsOnIssue({...context.repo, issue_number: context.payload.pull_request.number});
skip_testsuite = labels.some(label => label.name === 'CI: Skip testsuite');
}
console.log('Skip testsuite: ' + skip_testsuite);
return skip_testsuite;
others:
name: ${{ matrix.name }}
needs: config
runs-on: ${{ matrix.os }}
strategy:
matrix:
include: ${{ fromJSON(needs.config.outputs.jobs) }}
fail-fast: true
steps:
- name: Checkout
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
with:
persist-credentials: false
- name: macOS Dependencies
if: startsWith(matrix.os, 'macos-')
run: |
brew install parallel
# Allows starting up lldb from a remote terminal
# Note: in order to start lldb, the user must also be in
# one of these groups: "admin" or "_developer".
sudo DevToolsSecurity --enable
spctl developer-mode enable-terminal
# Select latest supported version
sudo xcode-select -s /Applications/Xcode_${{ matrix.os == 'macos-13' && '15.2' || '16.3' }}.app/Contents/Developer
lldb --version
- name: configure tree
run: |
CONFIG_ARG='--enable-codegen-invariants ${{ matrix.config_arg }}' MAKE_ARG=-j bash -xe tools/ci/actions/runner.sh configure
- name: Build
run: |
MAKE_ARG=-j bash -xe tools/ci/actions/runner.sh build
- name: Run the testsuite
if: ${{ matrix.name != 'linux-O0' && needs.config.outputs.skip-testsuite != 'true' }}
run: |
bash -c 'SHOW_TIMINGS=1 tools/ci/actions/runner.sh test'
- name: Run the testsuite (linux-O0)
if: ${{ matrix.name == 'linux-O0' && needs.config.outputs.skip-testsuite != 'true' }}
env:
OCAMLRUNPARAM: v=0,V=1
USE_RUNTIME: d
run: |
for dir in $PARALLEL_TESTS; do \
bash -cxe "SHOW_TIMINGS=1 tools/ci/actions/runner.sh test_prefix $dir"; \
done
- name: Install
if: ${{ matrix.test-in-prefix }}
run: |
MAKE_ARG=-j OCAMLRUNPARAM=b,v=0 bash -xe tools/ci/actions/runner.sh install
- name: Test in prefix
if: ${{ matrix.test-in-prefix }}
run: |
MAKE_ARG=-j OCAMLRUNPARAM=b,v=0 bash -xe tools/ci/actions/runner.sh test-in-prefix
i386:
runs-on: ubuntu-latest
needs: config
container:
image: debian:13
options: --platform linux/i386 --user root
steps:
- name: OS Dependencies
run: |
apt-get update -y
apt-get install -y git gcc make parallel
adduser --disabled-password --gecos '' ocaml
- name: Checkout
# See https://github.com/actions/checkout/issues/334
uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1.2.0
- name: configure tree
run: |
chown -R ocaml:ocaml .
MAKE_ARG=-j CONFIG_ARG='--disable-native-toplevel' su ocaml -c "bash -xe tools/ci/actions/runner.sh configure"
- name: Build
run: |
MAKE_ARG=-j su ocaml -c "bash -xe tools/ci/actions/runner.sh build"
- name: Run the testsuite
if: ${{ needs.config.outputs.skip-testsuite != 'true' }}
run: |
su ocaml -c "bash -xe tools/ci/actions/runner.sh test"
- name: Install
run: |
su ocaml -c "bash -xe tools/ci/actions/runner.sh install"
- name: Test in prefix
run: |
su ocaml -c "bash -xe tools/ci/actions/runner.sh test-in-prefix"