Skip to content

Commit b6930e9

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

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

.github/workflows/workflow.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,19 @@ 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") echo "ppx=false" >> "$GITHUB_OUTPUT" ;;
52+
"5.1"|"5.2"|"5.3") echo "ppx=true" >> "$GITHUB_OUTPUT" ;;
53+
*)
54+
printf "unrecognised version %s\n" "${{ matrix.ocaml-compiler }}";
55+
exit 1
56+
;;
57+
esac
58+
4659
- name: Checkout tree
4760
uses: actions/checkout@v5
4861

@@ -57,17 +70,17 @@ jobs:
5770
- run: opam install ./lwt.opam ./lwt_react.opam ./lwt_retry.opam --deps-only --with-test
5871

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

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

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

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

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

7285
lint-opam:
7386
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)