Skip to content

Commit

Permalink
so setup-ocaml@v3 breaks building on older ocaml versions
Browse files Browse the repository at this point in the history
  • Loading branch information
anmonteiro committed Oct 20, 2024
1 parent d9c8bea commit ae63048
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions .github/workflows/opam-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,30 @@ jobs:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-13
- windows-latest
setup:
- {ocaml-version: '4.06.x', os: ubuntu-latest}
- {ocaml-version: '4.10.x', os: ubuntu-latest}
- {ocaml-version: '4.12.x', os: ubuntu-latest}
- {ocaml-version: '4.14.x', os: ubuntu-latest}
- {ocaml-version: '4.06.x', os: macos-13}
- {ocaml-version: '4.10.x', os: macos-13}
- {ocaml-version: '4.12.x', os: macos-13}
- {ocaml-version: '4.14.x', os: macos-13}
# looks like setup-ocaml@v3 can only run actions on windows for
# OCaml >= 4.13
# https://github.com/ocaml/setup-ocaml/issues/822#issuecomment-2215525942
- {ocaml-version: '4.14.x', os: windows-latest}

ocaml-compiler:
# Please keep the list in sync with the minimal version of OCaml in
# esy.json, reason.esy/reason.opam and rtop.esy/rtop.opam.
- 4.06.x # We support 4.06 because is the one that is used in BuckleScript / ReScript v9
- 4.10.x
- 4.12.x
- 4.14.x

runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.setup.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Use OCaml ${{ matrix.ocaml-compiler }}
- name: Use OCaml ${{ matrix.setup.ocaml-compiler }}
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
ocaml-compiler: ${{ matrix.setup.ocaml-compiler }}
opam-pin: false

- name: Load opam cache when not Windows
Expand All @@ -47,15 +48,15 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ~/.opam
key: opam-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('**.opam') }}
key: opam-${{ matrix.setup.os }}-${{ matrix.setup.ocaml-compiler }}-${{ hashFiles('**.opam') }}

- name: Load opam cache when Windows
if: runner.os == 'Windows'
id: opam-cache-windows
uses: actions/cache/restore@v4
with:
path: _opam
key: opam-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('**.opam') }}
key: opam-${{ matrix.setup.os }}-${{ matrix.setup.ocaml-compiler }}-${{ hashFiles('**.opam') }}

- name: Install dependencies
run: opam install . --deps-only
Expand All @@ -71,12 +72,12 @@ jobs:
if: steps.opam-cache.outputs.cache-hit != 'true' && runner.os != 'Windows'
with:
path: ~/.opam
key: opam-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('**.opam') }}
key: opam-${{ matrix.setup.os }}-${{ matrix.setup.ocaml-compiler }}-${{ hashFiles('**.opam') }}

- name: Save cache when Windows
uses: actions/cache/save@v4
if: steps.opam-cache-windows.outputs.cache-hit != 'true' && runner.os == 'Windows'
with:
path: _opam
key: opam-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('**.opam') }}
key: opam-${{ matrix.setup.os }}-${{ matrix.setup.ocaml-compiler }}-${{ hashFiles('**.opam') }}

0 comments on commit ae63048

Please sign in to comment.