Skip to content

Commit f13f05f

Browse files
Merge pull request #1068 from ocsigen/better-ci-test-ppx
improve maintainability of github action
2 parents 68b41c2 + 06449cc commit f13f05f

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,6 +43,25 @@ jobs:
4343
runs-on: ${{ matrix.os }}
4444

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

@@ -57,17 +76,17 @@ jobs:
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: ${{ fromJSON(steps.configppx.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: ${{ fromJSON(steps.configppx.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: ${{ fromJSON(steps.configppx.outputs.ppx) }}
7190

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

0 commit comments

Comments
 (0)