Skip to content

Commit 5ae143b

Browse files
Yishuai Liliyishuai
authored andcommitted
ci: add OCaml 5.3
1 parent ca36d8b commit 5ae143b

1 file changed

Lines changed: 89 additions & 60 deletions

File tree

.github/workflows/build.yml

Lines changed: 89 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
setup-version:
17-
- v2
18-
- v3
1916
os:
20-
- macos-13
17+
- macos-15-intel
2118
- macos-latest
2219
- ubuntu-latest
20+
- ubuntu-24.04-arm
2321
- windows-latest
2422
ocaml-version:
2523
- 4.02.x
@@ -38,11 +36,8 @@ jobs:
3836
- 5.0.x
3937
- 5.1.x
4038
- 5.2.x
39+
- 5.3.x
4140
exclude:
42-
- os: macos-13
43-
setup-version: v3 # opam uninstall fails
44-
- os: macos-latest
45-
setup-version: v2
4641
- os: macos-latest
4742
ocaml-version: 4.02.x
4843
- os: macos-latest
@@ -62,76 +57,43 @@ jobs:
6257
- os: macos-latest
6358
ocaml-version: 4.11.x
6459
- os: windows-latest
65-
setup-version: v3
6660
ocaml-version: 4.02.x
6761
- os: windows-latest
68-
setup-version: v3
6962
ocaml-version: 4.03.x
7063
- os: windows-latest
71-
setup-version: v3
7264
ocaml-version: 4.04.x
7365
- os: windows-latest
74-
setup-version: v3
7566
ocaml-version: 4.05.x
7667
- os: windows-latest
77-
setup-version: v3
7868
ocaml-version: 4.06.x
7969
- os: windows-latest
80-
setup-version: v3
8170
ocaml-version: 4.07.x
8271
- os: windows-latest
83-
setup-version: v3
8472
ocaml-version: 4.08.x
8573
- os: windows-latest
86-
setup-version: v3
8774
ocaml-version: 4.09.x
8875
- os: windows-latest
89-
setup-version: v3
9076
ocaml-version: 4.10.x
9177
- os: windows-latest
92-
setup-version: v3
9378
ocaml-version: 4.11.x
9479
- os: windows-latest
95-
setup-version: v3
9680
ocaml-version: 4.12.x
97-
- os: windows-latest
98-
setup-version: v2
99-
ocaml-version: 5.0.x
100-
- os: windows-latest
101-
setup-version: v2
102-
ocaml-version: 5.1.x
103-
- os: windows-latest
104-
setup-version: v2
105-
ocaml-version: 5.2.x
10681

10782
runs-on: ${{ matrix.os }}
10883

10984
env:
85+
# https://github.com/fdopen/uwt/pull/6
86+
# https://github.com/vbrankov/hdf5-ocaml/pull/29
87+
# https://github.com/ocaml/opam/issues/6578
11088
SKIP_BUILD: |
111-
dose
112-
lilis
113-
rotor
114-
camlimages
115-
freetds
116-
frenetic
117-
genprint
118-
hdf5
119-
ocp-index-top
120-
pa_ppx
121-
pla
122-
ppx_deriving_rpc
123-
reed-solomon-erasure
124-
setr
125-
stdcompat
126-
uwt
89+
uwt.0.3.3
90+
hdf5.0.1.5
91+
js_of_ocaml-compiler.3.4.0
92+
12793
OPAMAUTOREMOVE: true
94+
# https://github.com/ocaml/opam-repository/pull/28057#issuecomment-3031287384
12895
SKIP_TEST: |
129-
0install
130-
bisect_ppx
131-
cconv-ppx
132-
decompress
133-
extlib-compat
134-
General
96+
pa_ppx.0.19
13597
13698
steps:
13799
- name: Prepare git
@@ -142,14 +104,17 @@ jobs:
142104
- name: Checkout code
143105
uses: actions/checkout@v6
144106

145-
- name: Setup OCaml ${{ matrix.ocaml-version }} with v2
146-
if: matrix.setup-version == 'v2'
147-
uses: ocaml/setup-ocaml@v2
107+
- name: Setup OCaml ${{ matrix.ocaml-version }} with archive
108+
if: ${{ matrix.ocaml-version == '4.02.x' }}
109+
uses: ocaml/setup-ocaml@v3
148110
with:
149111
ocaml-compiler: ${{ matrix.ocaml-version }}
112+
opam-repositories: |
113+
default: https://github.com/ocaml/opam-repository.git
114+
archive: https://github.com/ocaml/opam-repository-archive.git
150115
151-
- name: Setup OCaml ${{ matrix.ocaml-version }} with v3
152-
if: matrix.setup-version == 'v3'
116+
- name: Setup OCaml ${{ matrix.ocaml-version }}
117+
if: ${{ matrix.ocaml-version != '4.02.x' }}
153118
uses: ocaml/setup-ocaml@v3
154119
with:
155120
ocaml-compiler: ${{ matrix.ocaml-version }}
@@ -177,10 +142,21 @@ jobs:
177142
run: opam install -t .
178143

179144
- name: Test dependants
180-
if: >
181-
(matrix.ocaml-version >= '4.05') && (matrix.os != 'windows-latest')
145+
if: ${{ matrix.os != 'windows-latest' }}
182146
run: |
183-
PACKAGES=`opam list -s --color=never --installable --depends-on cppo,cppo_ocamlbuild`
147+
PACKAGES=$(opam list -a -s -V --color=never --installable --depends-on cppo,cppo_ocamlbuild | \
148+
awk '{
149+
if ($0 ~ /^cppo_ocamlbuild\./) next
150+
line = $0
151+
dot = match(line, /\./)
152+
pkg = substr(line, 1, dot - 1)
153+
seen[pkg] = line
154+
}
155+
END {
156+
for (p in seen) {
157+
print seen[p]
158+
}
159+
}')
184160
echo "Dependants:" $PACKAGES
185161
for PACKAGE in $PACKAGES
186162
do
@@ -193,9 +169,62 @@ jobs:
193169
echo ::group::Build $PACKAGE) ||
194170
echo ::group::Build and test $PACKAGE
195171
DEPS_FAILED=false
196-
(opam depext $PACKAGE &&
197-
opam install --deps-only $PACKAGE) || DEPS_FAILED=true
172+
opam install -t --deps-only $PACKAGE || DEPS_FAILED=true
198173
[ $DEPS_FAILED == false ] && opam install $PACKAGE
199174
echo ::endgroup::
200175
[ $DEPS_FAILED == false ] || echo Dependencies broken
201176
done
177+
178+
- name: Test dependants on Windows
179+
if: ${{ matrix.os == 'windows-latest' }}
180+
run: |
181+
$rawPackages = & opam list -a -s -V --color=never --installable --depends-on cppo,cppo_ocamlbuild
182+
$packageMap = @{}
183+
184+
foreach ($line in $rawPackages) {
185+
if ($line -match '^(.*?)[.]') {
186+
$pkg = $matches[1]
187+
if ($pkg -ne "cppo_ocamlbuild") {
188+
$packageMap[$pkg] = $line
189+
}
190+
}
191+
}
192+
193+
$packages = $packageMap.Values
194+
Write-Host "Dependants: $($packages -join ' ')"
195+
196+
foreach ($package in $packages) {
197+
$skipBuildList = $env:SKIP_BUILD -split ' '
198+
if ($skipBuildList -contains $package) {
199+
Write-Host "Skip $package"
200+
continue
201+
}
202+
203+
$opamWithTest = $true
204+
$skipTestList = $env:SKIP_TEST -split ' '
205+
if ($skipTestList -contains $package) {
206+
$opamWithTest = $false
207+
}
208+
209+
if (-not $opamWithTest) {
210+
Write-Host "::group::Build $package"
211+
} else {
212+
Write-Host "::group::Build and test $package"
213+
}
214+
215+
$depsFailed = $false
216+
try {
217+
& opam install --deps-only $package
218+
} catch {
219+
$depsFailed = $true
220+
}
221+
222+
if (-not $depsFailed) {
223+
& opam install $package
224+
} else {
225+
Write-Host "Dependencies broken"
226+
}
227+
228+
Write-Host "::endgroup::"
229+
}
230+

0 commit comments

Comments
 (0)