1- name : Reusable Build Workflow
1+ name : Build CI
22
33on :
4- workflow_call :
4+ push :
5+ branches : [main, develop]
6+ workflow_dispatch :
57 inputs :
68 os :
7- required : true
8- type : string
9- description : " Operating system to build on"
10- ocaml_version :
11- required : false
12- type : string
13- default : " 4.14.2"
14- description : " OCaml version to use"
15- cache-prefix :
9+ description : ' OS to build on. If empty, builds on all supported OSes.'
1610 required : false
11+ default : ' '
1712 type : string
18- default : " "
19- description : " Cache prefix for the build"
20- build-wasm :
21- required : false
22- type : boolean
23- default : false
24- description : " Whether to build WASM targets"
25- rustflags :
26- required : false
27- type : string
28- default : " "
29- description : " Additional RUSTFLAGS to append (e.g., macOS-specific linker flags)"
13+
14+ concurrency :
15+ group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
16+ cancel-in-progress : true
3017
3118env :
3219 CARGO_TERM_COLOR : always
3724
3825jobs :
3926 build :
40- timeout-minutes : 60
41- runs-on : ${{ inputs.os }}
27+ strategy :
28+ matrix :
29+ os : ${{ github.event.inputs.os && fromJSON(format('["{0}"]', github.event.inputs.os)) || fromJSON('["ubuntu-22.04", "ubuntu-24.04", "ubuntu-24.04-arm", "macos-13", "macos-14", "macos-15", "macos-latest"]') }}
30+ runs-on : ${{ matrix.os }}
4231 env :
43- RUSTFLAGS : " -C overflow-checks=off -C debug-assertions=off ${{ inputs.rustflags }}"
32+ RUSTFLAGS : " -C overflow-checks=off -C debug-assertions=off ${{ startsWith(matrix.os, 'macos') && '-C link-args=-Wl,-undefined,dynamic_lookup' || '' }}"
4433 steps :
4534 - name : Git checkout
4635 uses : actions/checkout@v5
@@ -51,13 +40,13 @@ jobs:
5140 - name : Use shared OCaml setting up steps
5241 uses : ./.github/actions/setup-ocaml
5342 with :
54- ocaml_version : ${{ inputs.ocaml_version }}
43+ ocaml_version : ' 4.14.2 '
5544
5645 - name : Setup Rust
5746 uses : ./.github/actions/setup-rust
5847 with :
5948 toolchain : 1.84
60- cache-prefix : build-${{ inputs .os }}-${{ inputs.cache-prefix }}v0
49+ cache-prefix : build-${{ matrix .os }}-${{ matrix.os }}- v0
6150
6251 - name : Release build
6352 run : make build-release
@@ -80,10 +69,12 @@ jobs:
8069 echo "Build info verification passed!"
8170
8271 build-tests :
83- timeout-minutes : 60
84- runs-on : ${{ inputs.os }}
72+ strategy :
73+ matrix :
74+ os : ${{ github.event.inputs.os && fromJSON(format('["{0}"]', github.event.inputs.os)) || fromJSON('["ubuntu-22.04", "ubuntu-24.04", "ubuntu-24.04-arm", "macos-13", "macos-14", "macos-15", "macos-latest"]') }}
75+ runs-on : ${{ matrix.os }}
8576 env :
86- RUSTFLAGS : " -C overflow-checks=off -C debug-assertions=off ${{ inputs.rustflags }}"
77+ RUSTFLAGS : " -C overflow-checks=off -C debug-assertions=off ${{ startsWith(matrix.os, 'macos') && '-C link-args=-Wl,-undefined,dynamic_lookup' || '' }}"
8778 steps :
8879 - name : Git checkout
8980 uses : actions/checkout@v5
@@ -94,22 +85,24 @@ jobs:
9485 - name : Use shared OCaml setting up steps
9586 uses : ./.github/actions/setup-ocaml
9687 with :
97- ocaml_version : ${{ inputs.ocaml_version }}
88+ ocaml_version : ' 4.14.2 '
9889
9990 - name : Setup Rust
10091 uses : ./.github/actions/setup-rust
10192 with :
10293 toolchain : 1.84
103- cache-prefix : build-tests-${{ inputs .os }}-${{ inputs.cache-prefix }}v0
94+ cache-prefix : build-tests-${{ matrix .os }}-${{ matrix.os }}- v0
10495
10596 - name : Build tests
10697 run : make build-tests
10798
10899 build-tests-webrtc :
109- timeout-minutes : 60
110- runs-on : ${{ inputs.os }}
100+ strategy :
101+ matrix :
102+ os : ${{ github.event.inputs.os && fromJSON(format('["{0}"]', github.event.inputs.os)) || fromJSON('["ubuntu-22.04", "ubuntu-24.04", "ubuntu-24.04-arm", "macos-13", "macos-14", "macos-15", "macos-latest"]') }}
103+ runs-on : ${{ matrix.os }}
111104 env :
112- RUSTFLAGS : " -C overflow-checks=off -C debug-assertions=off ${{ inputs.rustflags }}"
105+ RUSTFLAGS : " -C overflow-checks=off -C debug-assertions=off ${{ startsWith(matrix.os, 'macos') && '-C link-args=-Wl,-undefined,dynamic_lookup' || '' }}"
113106 steps :
114107 - name : Git checkout
115108 uses : actions/checkout@v5
@@ -120,23 +113,25 @@ jobs:
120113 - name : Use shared OCaml setting up steps
121114 uses : ./.github/actions/setup-ocaml
122115 with :
123- ocaml_version : ${{ inputs.ocaml_version }}
116+ ocaml_version : ' 4.14.2 '
124117
125118 - name : Setup Rust
126119 uses : ./.github/actions/setup-rust
127120 with :
128121 toolchain : 1.84
129- cache-prefix : build-tests-webrtc-${{ inputs .os }}-${{ inputs.cache-prefix }}v0
122+ cache-prefix : build-tests-webrtc-${{ matrix .os }}-${{ matrix.os }}- v0
130123
131124 - name : Build tests
132125 run : make build-tests-webrtc
133126
134127 build-benches :
135128 needs : [build]
136- timeout-minutes : 60
137- runs-on : ${{ inputs.os }}
129+ strategy :
130+ matrix :
131+ os : ${{ github.event.inputs.os && fromJSON(format('["{0}"]', github.event.inputs.os)) || fromJSON('["ubuntu-22.04", "ubuntu-24.04", "ubuntu-24.04-arm", "macos-13", "macos-14", "macos-15", "macos-latest"]') }}
132+ runs-on : ${{ matrix.os }}
138133 env :
139- RUSTFLAGS : " -C overflow-checks=off -C debug-assertions=off ${{ inputs.rustflags }}"
134+ RUSTFLAGS : " -C overflow-checks=off -C debug-assertions=off ${{ startsWith(matrix.os, 'macos') && '-C link-args=-Wl,-undefined,dynamic_lookup' || '' }}"
140135 steps :
141136 - name : Git checkout
142137 uses : actions/checkout@v5
@@ -147,21 +142,22 @@ jobs:
147142 - name : Use shared OCaml setting up steps
148143 uses : ./.github/actions/setup-ocaml
149144 with :
150- ocaml_version : ${{ inputs.ocaml_version }}
145+ ocaml_version : ' 4.14.2 '
151146
152147 - name : Setup Rust
153148 uses : ./.github/actions/setup-rust
154149 with :
155150 toolchain : 1.84
156- cache-prefix : build-${{ inputs .os }}-${{ inputs.cache-prefix }}v0
151+ cache-prefix : build-${{ matrix .os }}-${{ matrix.os }}- v0
157152
158153 - name : Build benchmarks
159154 run : make build-benches
160155
161156 build-wasm :
162- if : ${{ inputs.build-wasm }}
163- timeout-minutes : 60
164- runs-on : ${{ inputs.os }}
157+ strategy :
158+ matrix :
159+ os : ${{ github.event.inputs.os && fromJSON(format('["{0}"]', github.event.inputs.os)) || fromJSON('["ubuntu-22.04", "ubuntu-24.04", "ubuntu-24.04-arm", "macos-13", "macos-14", "macos-15", "macos-latest"]') }}
160+ runs-on : ${{ matrix.os }}
165161 steps :
166162 - name : Git checkout
167163 uses : actions/checkout@v5
@@ -172,14 +168,14 @@ jobs:
172168 - name : Use shared OCaml setting up steps
173169 uses : ./.github/actions/setup-ocaml
174170 with :
175- ocaml_version : ${{ inputs.ocaml_version }}
171+ ocaml_version : ' 4.14.2 '
176172
177173 - name : Setup WebAssembly environment
178174 uses : ./.github/actions/setup-wasm
179175 with :
180- cache-prefix : wasm-${{ inputs .os }}-${{ inputs.cache-prefix }}v0
176+ cache-prefix : wasm-${{ matrix .os }}-${{ matrix.os }}- v0
181177
182178 - name : Release build
183179 run : make build-wasm
184180 env :
185- RUSTFLAGS : " "
181+ RUSTFLAGS : " "
0 commit comments