Skip to content

Commit

Permalink
Update to OCaml 5.1
Browse files Browse the repository at this point in the history
Fixes Windows CI, and does some nasty hacks to get static compilation
working on OCaml 5.1
  • Loading branch information
SquidDev committed Feb 7, 2024
1 parent 354b7bd commit 0c662d8
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 14 deletions.
39 changes: 27 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ jobs:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Use OCaml
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: 4.14.x
ocaml-compiler: "5.1.1"

- name: Install dependencies
run: opam install . --deps-only --with-test
Expand All @@ -29,37 +29,52 @@ jobs:
include:
- name: Windows
uses: windows-latest
ocaml: 4.14.x
ocaml:
ocaml-compiler: ocaml-variants.5.1.1+options,ocaml-option-mingw
# Copied from https://github.com/ocaml-multicore/eio/blob/main/.github/workflows/main.yml
opam-depext: false
opam-repositories: |
dra27: https://github.com/dra27/opam-repository.git#windows-5.0
normal: https://github.com/ocaml/opam-repository.git
input-file: illuaminate.exe
output-file: illuaminate-windows-x86_64.exe
dune-flags:

- name: Linux
uses: ubuntu-22.04
uses: ubuntu-latest
# We don't use flambda as that ends up much buliker than without.
ocaml: ocaml-variants.4.14.0+options,ocaml-option-musl
ocaml:
ocaml-compiler: ocaml-variants.5.1.1+options,ocaml-option-static
input-file: illuaminate
output-file: illuaminate-linux-x86_64
dune-flags: --workspace dune-workspace.release

- name: macOS
uses: macos-latest
ocaml: 4.14.x
ocaml:
ocaml-compiler: "5.1.1"
input-file: illuaminate
output-file: illuaminate-macos-x86_64
dune-flags:

name: Build ${{ matrix.name }}
runs-on: ${{ matrix.uses }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

# This is required to make the static/musl build work. I *believe*, OCaml
# finds the glibc libzstd during ./configure, and then looks for a musl
# version when compiling. Not 100% sure, as I've not been able to reproduce
# this failure locally.
- name: Remove libzstd
run: sudo apt remove libzstd-dev --yes
if: "matrix.name == 'Linux'"

- name: Use OCaml
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ${{ matrix.ocaml }}
with: ${{ matrix.ocaml }}

- name: Install dependencies
run: opam install . --deps-only
Expand All @@ -72,7 +87,7 @@ jobs:
cp _install/bin/${{ matrix.input-file }} ${{ matrix.output-file }}
- name: Publish executable
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.output-file }}
path: ${{ matrix.output-file }}
Expand All @@ -86,12 +101,12 @@ jobs:
if: github.ref == 'refs/heads/master'

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Download executable
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: artifacts

Expand Down
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(lang dune 3.8)
(lang dune 3.7)
(using menhir 2.1)
(implicit_transitive_deps false)
(generate_opam_files true)
Expand Down
3 changes: 2 additions & 1 deletion illuaminate.opam
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ homepage: "https://github.com/squiddev/illuaminate"
bug-reports: "https://github.com/squiddev/illuaminate/issues"
depends: [
"ocaml" {>= "4.14"}
"dune" {>= "3.8" & >= "3.1"}
"dune" {>= "3.7" & >= "3.1"}
"js_of_ocaml-compiler" {build & >= "4.0.0"}
"js_of_ocaml-ppx" {build}
"ppx_deriving" {build}
Expand Down Expand Up @@ -54,4 +54,5 @@ dev-repo: "git+https://github.com/squiddev/illuaminate.git"
pin-depends: [
["omnomnom.dev" "git+https://github.com/SquidDev/omnomnom.git#b14c939500de840f866665918cb3c66f08075962"]
["lrgrep.dev" "git+https://github.com/let-def/lrgrep.git#23e4ad3d411e89f1ee0810016bb23ba2b37e49f3"]
["grenier.dev" "git+https://github.com/let-def/grenier.git#8cb374afc42c4f6f505d194c8455b08455906933"]
]
1 change: 1 addition & 0 deletions illuaminate.opam.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pin-depends: [
["omnomnom.dev" "git+https://github.com/SquidDev/omnomnom.git#b14c939500de840f866665918cb3c66f08075962"]
["lrgrep.dev" "git+https://github.com/let-def/lrgrep.git#23e4ad3d411e89f1ee0810016bb23ba2b37e49f3"]
["grenier.dev" "git+https://github.com/let-def/grenier.git#8cb374afc42c4f6f505d194c8455b08455906933"]
]

0 comments on commit 0c662d8

Please sign in to comment.