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 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479
|
name: CI
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
merge_group:
concurrency:
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
permissions:
contents: read
env:
EXTRA_NIX_CONFIG: |
extra-substituters = https://anmonteiro.nix-cache.workers.dev
extra-trusted-public-keys = ocaml.nix-cache.com-1:/xI2h2+56rwFfKyyFVbkJSeGqSIYMC/Je+7XXqGKDIY=
jobs:
#
# Stage 1
#
nix-build:
name: Nix Build
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- uses: nixbuild/nix-quick-install-action@v34
with:
nix_conf: ${{ env.EXTRA_NIX_CONFIG }}
- uses: nix-community/cache-nix-action@v6
with:
primary-key: |
nix-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-${{ github.job }}-
gc-max-store-size-linux: 2G
gc-max-store-size-macos: 2G
- run: nix build
nix-test:
name: Nix Tests
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- uses: nixbuild/nix-quick-install-action@v34
with:
nix_conf: ${{ env.EXTRA_NIX_CONFIG }}
- uses: nix-community/cache-nix-action@v6
with:
primary-key: |
nix-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-${{ github.job }}-
gc-max-store-size-linux: 10G
- run: nix develop -i -c make test
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: nixbuild/nix-quick-install-action@v34
with:
nix_conf: ${{ env.EXTRA_NIX_CONFIG }}
- uses: nix-community/cache-nix-action@v6
with:
primary-key: |
nix-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-${{ github.job }}-
gc-max-store-size-linux: 2G
- run: nix develop .#fmt -c make fmt
doc:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: nixbuild/nix-quick-install-action@v34
with:
nix_conf: ${{ env.EXTRA_NIX_CONFIG }}
- uses: nix-community/cache-nix-action@v6
with:
primary-key: |
nix-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-${{ github.job }}-
gc-max-store-size-linux: 2G
- run: nix develop .#doc -c make doc
env:
LC_ALL: C
bootstrap:
name: Bootstrap
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- uses: nixbuild/nix-quick-install-action@v34
with:
nix_conf: ${{ env.EXTRA_NIX_CONFIG }}
- uses: nix-community/cache-nix-action@v6
with:
primary-key: |
nix-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-${{ github.job }}-
gc-max-store-size-linux: 2G
- run: nix develop -i .#bootstrap-check -c make test-bootstrap-script
nix-build-4-08:
name: Nix Build 4.08
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- uses: nixbuild/nix-quick-install-action@v34
with:
nix_conf: ${{ env.EXTRA_NIX_CONFIG }}
- uses: nix-community/cache-nix-action@v6
with:
primary-key: |
nix-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-${{ github.job }}-
gc-max-store-size-linux: 2G
- run: nix develop -i .#bootstrap-check_4_08 -c make release
nix-build-ox:
# This builds OxCaml with the flake version which is typically ahead of the
# OxCaml opam repository
name: Build with OxCaml
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- uses: nixbuild/nix-quick-install-action@v34
with:
nix_conf: ${{ env.EXTRA_NIX_CONFIG }}
- uses: nix-community/cache-nix-action@v6
with:
primary-key: |
nix-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-${{ github.job }}-
gc-max-store-size-linux: 2G
- run: nix develop -i .#bootstrap-ox -c make release
#
# Stage 2
#
build:
name: Build
# we only start building our other jobs, once our main tests have passed
needs: nix-test
strategy:
fail-fast: false
matrix:
# Please keep the list in sync with the minimal version of OCaml in
# dune-project, dune.opam.template and bootstrap.ml
#
# We don't run tests on all versions of the Windows environment and on
# 4.02.x and 4.07.x in other environments
include:
# OCaml trunk:
- ocaml-compiler: ocaml-variants.5.5.0+trunk
os: ubuntu-latest
# OCaml 5:
## ubuntu (x86)
- ocaml-compiler: 5.4.x
os: ubuntu-latest
run_tests: true
## macos (Apple Silicon)
- ocaml-compiler: 5.4.x
os: macos-latest
run_tests: true
## macos (x86)
- ocaml-compiler: 5.4.x
os: macos-15-intel
## MSVC
- ocaml-compiler: ocaml-compiler.5.4.0,system-msvc
os: windows-latest
run_tests: true
## mingw
- ocaml-compiler: ocaml-base-compiler.5.4.0,system-mingw
os: windows-latest
run_tests: true
# OCaml 4:
## ubuntu (x86)
- ocaml-compiler: 4.14.x
os: ubuntu-latest
## ubuntu (x86-32)
- ocaml-compiler: "ocaml-variants.4.14.2+options,ocaml-option-32bit"
os: ubuntu-latest
apt_update: true
## macos (Apple Silicon)
- ocaml-compiler: 4.14.x
os: macos-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v6
# The 32 bit gcc/g++ packages are by default out-of-date so we need to
# manually update our package listing.
- name: Update apt package listing
if: ${{ matrix.apt_update == true }}
run: sudo apt update
- name: Use OCaml ${{ matrix.ocaml-compiler }}
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
# Install ocamlfind-secondary and ocaml-secondary-compiler, if needed
- run: |
opam pin -n .
opam install ./dune.opam --deps-only
- name: Install system deps on macOS
run: brew install coreutils pkg-config file
if: ${{ matrix.os == 'macos-latest' }}
# dune doesn't have any additional dependencies so we can build it right
# away this makes it possible to see build errors as soon as possible
- run: opam exec -- make release
- name: Install deps
# CR-soon Alizter: Lwt 5.9.2 breaks on msvc so we pin it here. Remove
# this when https://github.com/ocsigen/lwt/issues/1071 is fixed.
run: |
opam pin add lwt 5.9.1 --no-action
opam install . --deps-only --with-test
opam exec -- make dev-deps
if: ${{ matrix.run_tests }}
- name: Run test suite on Unix
run: opam exec -- make test
if: ${{ matrix.os != 'windows-latest' && matrix.run_tests }}
- name: Run test suite on Win32
run: opam exec -- make test-windows
if: ${{ matrix.os == 'windows-latest' && matrix.run_tests }}
# We never build configurator
- name: Build configurator
run: opam install ./dune-configurator.opam
if: ${{ matrix.configurator == true }}
coq:
name: Coq 8.16.1
needs: nix-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: nixbuild/nix-quick-install-action@v34
with:
nix_conf: ${{ env.EXTRA_NIX_CONFIG }}
- uses: nix-community/cache-nix-action@v6
with:
primary-key: |
nix-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-${{ github.job }}-
gc-max-store-size-linux: 5G
- run: nix develop .#coq -c make test-coq
env:
# We disable the Dune cache when running the tests
DUNE_CACHE: disabled
rocq:
name: Rocq Language (Rocq 9.1.0)
runs-on: ubuntu-latest
strategy:
matrix:
include:
# Keep packages and OCaml version in sync with the version
# in the makefile; rocq-stdlib should be easy to remove
- ocaml-compiler: 5.3
opam-packages: rocq-core.9.1.0 rocq-stdlib.9.0.0 csexp re spawn pp uutf
test-target: test-rocq
- ocaml-compiler: 4.14
opam-packages: rocq-core.9.1.0 rocq-stdlib.9.0.0 csexp re spawn pp uutf rocq-native
test-target: test-rocq-native
steps:
- name: Checkout Code
uses: actions/checkout@v6
- name: Setup OCaml
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
dune-cache: true
- name: install Rocq Prover
run: opam install -y ${{ matrix.opam-packages }}
- name: test Rocq Prover Build Language
run: opam exec -- make ${{ matrix.test-target }}
env:
# We disable the Dune cache when running the tests
DUNE_CACHE: disabled
wasm:
name: Wasm_of_ocaml
needs: nix-build
runs-on: ubuntu-latest
steps:
- name: Install Node
uses: actions/setup-node@v6
with:
node-version: latest
- name: Set-up Binaryen
uses: Aandreba/setup-binaryen@v1.0.0
with:
token: ${{ github.token }}
- name: Checkout Code
uses: actions/checkout@v6
- name: Use OCaml 5.2.x
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: 5.2.x
- name: Install faked binaryen-bin package
# The binaries have already been downloaded
run: opam install --fake binaryen-bin
- name: Install Wasm_of_ocaml
run: opam install "wasm_of_ocaml-compiler>=6.1" csexp pp re spawn uutf
- name: Set Git User
run: |
git config --global user.name github-actions[bot]
git config --global user.email github-actions[bot]@users.noreply.github.com
- name: Run Tests
run: opam exec -- make test-wasm
cygwin:
name: Cygwin Build
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- name: Setup Cygwin
uses: cygwin/cygwin-install-action@v6
with:
packages: ocaml gcc-core make
- name: Bootstrap Dune
run: make bootstrap
## In order to build dune locally we need to have the re library
## available. Even if we do, it is likely that our vendored blake3 rules
## will miss cygwin support. So for now, we don't enable the rest.
# - name: Build Dune
# run: _boot/dune build dune.install
oxcaml:
name: Building Dune with OxCaml
needs: nix-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install OCaml
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ocaml-variants.5.2.0+ox
opam-repositories: |
oxcaml: "git+https://github.com/oxcaml/opam-repository.git"
default: "git+https://github.com/ocaml/opam-repository.git"
opam-pin: false
- name: Pin deps
run: opam pin add -n . --with-version=3.21.0
- name: Install deps
run: opam install csexp pp re spawn uutf ppx_inline_test ./dune.opam
- name: Build dune
run: opam exec -- make bootstrap
- name: Run OxCaml tests
run: opam exec -- ./dune.exe test ./test/blackbox-tests/test-cases/oxcaml
create-local-opam-switch:
name: Create local opam switch
needs: nix-build
strategy:
fail-fast: true
matrix:
os:
- macos-latest
- ubuntu-latest
ocaml-compiler:
- 5
runs-on: ${{ matrix.os }}
steps:
- name: Use OCaml ${{ matrix.ocaml-compiler }}
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
- uses: actions/checkout@v6
- name: Create an empty switch
run: opam switch create . --empty
- name: Pin local packages to local dependencies
run: opam pin add . -n --with-version=3.21.0
# ^^^^^^
# When updating dune lang, update this too
- name: Install external dependencies
run: opam install .
build-microbench:
name: Build microbenchmarks
needs: nix-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: nixbuild/nix-quick-install-action@v34
with:
nix_conf: ${{ env.EXTRA_NIX_CONFIG }}
- uses: nix-community/cache-nix-action@v6
with:
primary-key: |
nix-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-${{ github.job }}-
gc-max-store-size-linux: 5G
- run: nix develop .#microbench -c make dune build bench/micro
utop-dev-tool-test:
name: Test that the utop dev tool can be built and run
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: nixbuild/nix-quick-install-action@v34
with:
nix_conf: ${{ env.EXTRA_NIX_CONFIG }}
- uses: nix-community/cache-nix-action@v6
with:
primary-key: |
nix-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-${{ github.job }}-
gc-max-store-size-linux: 2G
- name: Set up a project, install utop as a dev tool, and run it
shell: nix shell -c bash -e {0}
run: |
cd $(mktemp -d)
dune init project foo
cd foo
echo 'let message = "Hello, World!"' > lib/foo.ml
echo 'print_endline Foo.message' > script.ml
dune pkg lock
dune tools install utop
dune utop . script.ml
|