Skip to content

Commit 8dfa030

Browse files
improve maintainability of github action
central place to set ppx-related values
1 parent 68b41c2 commit 8dfa030

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

.github/workflows/workflow.yml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,31 +43,50 @@ jobs:
4343
runs-on: ${{ matrix.os }}
4444

4545
steps:
46+
- name: set ppx-related variables
47+
id: config-ppx
48+
run: |
49+
case ${{ matrix.ocaml-compiler }} in
50+
"4.08"|"4.09"|"4.10"|"4.11"|"4.12"|"4.13"|"4.14"|"5.0")
51+
echo "ppx=false" >> "$GITHUB_OUTPUT"
52+
echo "local-packages=lwt.opam,lwt_react.opam,lwt_retry.opam" >> "$GITHUB_OUTPUT"
53+
;;
54+
"5.1"|"5.2"|"5.3")
55+
echo "ppx=true" >> "$GITHUB_OUTPUT"
56+
echo "local-packages=lwt.opam,lwt_ppx.opam,lwt_react.opam,lwt_retry.opam" >> "$GITHUB_OUTPUT"
57+
;;
58+
*)
59+
printf "unrecognised version %s\n" "${{ matrix.ocaml-compiler }}";
60+
exit 1
61+
;;
62+
esac
63+
4664
- name: Checkout tree
4765
uses: actions/checkout@v5
4866

4967
- name: Set-up OCaml
5068
uses: ocaml/setup-ocaml@v3
5169
with:
5270
ocaml-compiler: ${{ matrix.ocaml-compiler }}
71+
opam-local-packages: ${{ steps.config-ppx.outputs.local-packages }}
5372

5473
- run: opam install conf-libev
5574
if: ${{ matrix.libev == true }}
5675

5776
- run: opam install ./lwt.opam ./lwt_react.opam ./lwt_retry.opam --deps-only --with-test
5877

5978
- run: opam install ./lwt_ppx.opam --deps-only --with-test
60-
if: ${{ contains(fromJSON('["5.1","5.2","5.3"]'), matrix.ocaml-compiler) }}
79+
if: ${{ steps.config-ppx.outputs.ppx }}
6180

62-
- run: opam exec -- dune build -p lwt,lwt_react,lwt_retry
81+
- run: opam exec -- dune build --only-packages lwt,lwt_react,lwt_retry
6382

64-
- run: opam exec -- dune build -p lwt_ppx
65-
if: ${{ contains(fromJSON('["5.1","5.2","5.3"]'), matrix.ocaml-compiler) }}
83+
- run: opam exec -- dune build --only-packages lwt_ppx
84+
if: ${{ steps.config-ppx.outputs.ppx }}
6685

67-
- run: opam exec -- dune runtest -p lwt,lwt_react,lwt_retry
86+
- run: opam exec -- dune runtest --only-packages lwt,lwt_react,lwt_retry
6887

69-
- run: opam exec -- dune runtest -p lwt_ppx
70-
if: ${{ contains(fromJSON('["5.1","5.2","5.3"]'), matrix.ocaml-compiler) }}
88+
- run: opam exec -- dune runtest --only-packages lwt_ppx
89+
if: ${{ steps.config-ppx.outputs.ppx }}
7190

7291
lint-opam:
7392
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)