Skip to content

Commit

Permalink
Pick the right setup for version matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
liyishuai committed Jul 23, 2024
1 parent a184d4b commit 6c069f3
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 9 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
109 changes: 100 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ jobs:
strategy:
fail-fast: false
matrix:
setup-version:
- v2
- v3
os:
- macos-13
- macos-latest
- ubuntu-latest
- windows-latest
Expand All @@ -30,6 +34,75 @@ jobs:
- 4.11.x
- 4.12.x
- 4.13.x
- 4.14.x
- 5.0.x
- 5.1.x
- 5.2.x
exclude:
- os: macos-13
setup-version: v3 # opam uninstall fails
- os: macos-latest
setup-version: v2
- os: macos-latest
ocaml-version: 4.02.x
- os: macos-latest
ocaml-version: 4.03.x
- os: macos-latest
ocaml-version: 4.04.x
- os: macos-latest
ocaml-version: 4.05.x
- os: macos-latest
ocaml-version: 4.06.x
- os: macos-latest
ocaml-version: 4.07.x
- os: macos-latest
ocaml-version: 4.08.x
- os: macos-latest
ocaml-version: 4.09.x
- os: macos-latest
ocaml-version: 4.11.x
- os: windows-latest
setup-version: v3
ocaml-version: 4.02.x
- os: windows-latest
setup-version: v3
ocaml-version: 4.03.x
- os: windows-latest
setup-version: v3
ocaml-version: 4.04.x
- os: windows-latest
setup-version: v3
ocaml-version: 4.05.x
- os: windows-latest
setup-version: v3
ocaml-version: 4.06.x
- os: windows-latest
setup-version: v3
ocaml-version: 4.07.x
- os: windows-latest
setup-version: v3
ocaml-version: 4.08.x
- os: windows-latest
setup-version: v3
ocaml-version: 4.09.x
- os: windows-latest
setup-version: v3
ocaml-version: 4.10.x
- os: windows-latest
setup-version: v3
ocaml-version: 4.11.x
- os: windows-latest
setup-version: v3
ocaml-version: 4.12.x
- os: windows-latest
setup-version: v2
ocaml-version: 5.0.x
- os: windows-latest
setup-version: v2
ocaml-version: 5.1.x
- os: windows-latest
setup-version: v2
ocaml-version: 5.2.x

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

Expand All @@ -38,6 +111,20 @@ jobs:
dose
lilis
rotor
camlimages
freetds
frenetic
genprint
hdf5
ocp-index-top
pa_ppx
pla
ppx_deriving_rpc
reed-solomon-erasure
setr
stdcompat
uwt
OPAMAUTOREMOVE: true
SKIP_TEST: |
0install
bisect_ppx
Expand All @@ -53,13 +140,20 @@ jobs:
git config --global init.defaultBranch master
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Use OCaml ${{ matrix.ocaml-version }}
- name: Setup OCaml ${{ matrix.ocaml-version }} with v2
if: matrix.setup-version == 'v2'
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ${{ matrix.ocaml-version }}

- name: Setup OCaml ${{ matrix.ocaml-version }} with v3
if: matrix.setup-version == 'v3'
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-version }}

- name: Install dependencies
run: opam install --deps-only .

Expand All @@ -70,18 +164,18 @@ jobs:
run: opam exec -- make

- name: Upload the build artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.ocaml-version }}-cppo.exe
path: _build/default/src/cppo_main.exe
overwrite: true

- name: Build, test, and install package
run: opam install -t .

- name: Test dependants
if: >
(runner.os == 'Linux' && matrix.ocaml-version >= '4.04') ||
(runner.os == 'macOS' && matrix.ocaml-version >= '4.13')
(matrix.ocaml-version >= '4.05') && (matrix.os != 'windows-latest')
run: |
PACKAGES=`opam list -s --color=never --installable --depends-on cppo,cppo_ocamlbuild`
echo "Dependants:" $PACKAGES
Expand All @@ -97,11 +191,8 @@ jobs:
echo ::group::Build and test $PACKAGE
DEPS_FAILED=false
(opam depext $PACKAGE &&
opam install --deps-only -t $PACKAGE) || DEPS_FAILED=true
opam install --deps-only $PACKAGE) || DEPS_FAILED=true
[ $DEPS_FAILED == false ] && opam install $PACKAGE
echo ::endgroup::
[ $DEPS_FAILED == false ] || echo Dependencies broken
done
- name: Uninstall package
run: opam uninstall .

0 comments on commit 6c069f3

Please sign in to comment.