From dfd3327a08b7c5d451219bda00b57183ada39365 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Thu, 27 Jun 2024 18:37:54 -0300 Subject: [PATCH] chore: update CI scripts (#1039) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: update CI scripts Signed-off-by: Antonin Décimo * Add a lower bound on Alcotest 1.7.0 Signed-off-by: Antonin Décimo * Replace ounit with ounit2 Signed-off-by: Antonin Décimo * gha: cohttp-bench depends on cohttp-eio Add its own build job. Signed-off-by: Antonin Décimo * gha: Don't pull lwt packages when building async packages Signed-off-by: Antonin Décimo * gha: test only 4.14 and 5.02 Signed-off-by: Antonin Décimo --------- Signed-off-by: Antonin Décimo --- .github/workflows/changelog.yml | 4 +- .github/workflows/nix.yml | 2 +- .github/workflows/workflow.yml | 73 ++++++++++++++----- cohttp-async.opam | 2 +- cohttp-async/test/dune | 2 +- cohttp-curl-async.opam | 9 ++- cohttp-curl-lwt.opam | 4 +- cohttp-eio.opam | 2 +- cohttp-lwt-unix.opam | 2 +- .../test/cohttp_lwt_unix_test/src/dune | 2 +- cohttp-lwt-unix/test/dune | 2 +- cohttp-lwt-unix/test/test_parser.ml | 2 +- cohttp.opam | 2 +- dune-project | 23 +++--- flake.nix | 8 +- http.opam | 2 +- test_helpers/cohttp_test/src/dune | 2 +- 17 files changed, 90 insertions(+), 53 deletions(-) diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index fadd3b94a9..efc7c0c4b9 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -8,6 +8,6 @@ on: jobs: Changelog-Entry-Check: name: Check Changelog Action - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - - uses: tarides/changelog-check-action@v1 + - uses: tarides/changelog-check-action@v2 diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 81845253c8..82bb77a7e0 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -12,7 +12,7 @@ jobs: uses: actions/checkout@v4 with: submodules: true - - uses: cachix/install-nix-action@V27 + - uses: cachix/install-nix-action@v27 with: nix_path: nixpkgs=channel:nixos-unstable - run: | diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 4237944fd1..4daf89f776 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -10,7 +10,7 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name == 'pull_request' || github.sha }} - cancel-in-progress: true + cancel-in-progress: true jobs: build-test-default: @@ -22,12 +22,8 @@ jobs: - ubuntu-latest - macos-latest ocaml-compiler: - - ocaml-variants.4.08.1+afl - - ocaml-variants.4.09.1+afl - - ocaml-variants.4.10.1+afl - - ocaml-variants.4.11.2+afl - - ocaml-variants.4.12.1+options,ocaml-option-afl - - ocaml-variants.4.13.1+options,ocaml-option-afl + - ocaml-variants.4.14.2+options,ocaml-option-afl + - ocaml-variants.5.02.0+options,ocaml-option-afl local-packages: - | *.opam @@ -40,7 +36,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Use OCaml ${{ matrix.ocaml-compiler }} uses: ocaml/setup-ocaml@v2 @@ -52,8 +48,7 @@ jobs: opam-local-packages: ${{ matrix.local-packages }} - run: | - sudo apt update - sudo apt upgrade + sudo apt-get update && sudo apt-get upgrade opam depext conf-libcurl if: ${{ matrix.os == 'ubuntu-latest' }} @@ -73,17 +68,25 @@ jobs: - ubuntu-latest - macos-latest ocaml-compiler: - - ocaml-variants.4.14.1+options,ocaml-option-afl + - ocaml-variants.4.14.2+options,ocaml-option-afl + - ocaml-variants.5.02.0+options,ocaml-option-afl local-packages: - | *.opam + !cohttp-mirage.opam + !cohttp-curl-lwt.opam + !cohttp-lwt-jsoo.opam + !cohttp-lwt-unix.opam + !cohttp-lwt.opam + !cohttp-server-lwt-unix.opam !cohttp-eio.opam + !cohttp-bench.opam runs-on: ${{ matrix.os }} steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Use OCaml ${{ matrix.ocaml-compiler }} uses: ocaml/setup-ocaml@v2 @@ -95,17 +98,16 @@ jobs: opam-local-packages: ${{ matrix.local-packages }} - run: | - sudo apt update - sudo apt upgrade + sudo apt-get update && sudo apt-get upgrade opam depext conf-libcurl if: ${{ matrix.os == 'ubuntu-latest' }} - run: echo "PKG_CONFIG_PATH=$(brew --prefix openssl)/lib/pkgconfig" >>"$GITHUB_ENV" if: ${{ matrix.os == 'macos-latest' }} - - run: opam install --with-test --deps-only http cohttp cohttp-lwt cohttp-lwt-unix cohttp-server-lwt-unix cohttp-async cohttp-curl-async cohttp-mirage cohttp-curl-lwt cohttp-curl cohttp-top cohttp-bench - - run: opam exec -- dune build http cohttp cohttp-lwt cohttp-lwt-unix cohttp-server-lwt-unix cohttp-async cohttp-curl-async cohttp-mirage cohttp-curl-lwt cohttp-curl cohttp-top cohttp-bench - - run: opam exec -- dune runtest http cohttp cohttp-lwt cohttp-lwt-unix cohttp-server-lwt-unix cohttp-async cohttp-curl-async cohttp-mirage cohttp-curl-lwt cohttp-curl cohttp-top cohttp-bench + - run: opam install --with-test --deps-only http cohttp cohttp-async cohttp-curl-async cohttp-curl cohttp-top + - run: opam exec -- dune build http cohttp cohttp-async cohttp-curl-async cohttp-curl cohttp-top + - run: opam exec -- dune runtest http cohttp cohttp-async cohttp-curl-async cohttp-curl cohttp-top build-test-cohttp-eio: if: github.event.pull_request.draft == false @@ -116,7 +118,7 @@ jobs: - ubuntu-latest - macos-latest ocaml-compiler: - - 5.0.x + - 5.x local-packages: - | http.opam @@ -127,7 +129,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Use OCaml ${{ matrix.ocaml-compiler }} uses: ocaml/setup-ocaml@v2 @@ -142,3 +144,36 @@ jobs: - run: opam install --with-test --deps-only cohttp-eio - run: opam exec -- dune build cohttp-eio - run: opam exec -- dune runtest cohttp-eio + + build-test-cohttp-bench: + if: github.event.pull_request.draft == false + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + ocaml-compiler: + - 5.x + local-packages: + - | + *.opam + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Use OCaml ${{ matrix.ocaml-compiler }} + uses: ocaml/setup-ocaml@v2 + with: + ocaml-compiler: ${{ matrix.ocaml-compiler }} + dune-cache: ${{ matrix.os == 'ubuntu-latest' }} + opam-local-packages: ${{ matrix.local-packages }} + opam-repositories: | + default: https://github.com/ocaml/opam-repository.git + alpha: https://github.com/kit-ty-kate/opam-alpha-repository.git + + - run: opam install --with-test --deps-only cohttp-bench + - run: opam exec -- dune build cohttp-bench + - run: opam exec -- dune runtest cohttp-bench diff --git a/cohttp-async.opam b/cohttp-async.opam index 3590c07c6e..483bd0e31e 100644 --- a/cohttp-async.opam +++ b/cohttp-async.opam @@ -41,7 +41,7 @@ depends: [ "fmt" {>= "0.8.2"} "sexplib0" "ppx_sexp_conv" {>= "v0.13.0"} - "ounit" {with-test} + "ounit2" {with-test} "uri" {>= "2.0.0"} "uri-sexp" "ipaddr" diff --git a/cohttp-async/test/dune b/cohttp-async/test/dune index 229cf07740..25cf8c4ad0 100644 --- a/cohttp-async/test/dune +++ b/cohttp-async/test/dune @@ -6,7 +6,7 @@ base core async_kernel - oUnit + ounit2 cohttp-async)) (rule diff --git a/cohttp-curl-async.opam b/cohttp-curl-async.opam index 93b977010b..a3c8fc4665 100644 --- a/cohttp-curl-async.opam +++ b/cohttp-curl-async.opam @@ -27,13 +27,14 @@ depends: [ "cohttp-curl" {= version} "core" {>= "v0.16.0"} "core_unix" {>= "v0.14.0"} - "async_kernel" - "async_unix" + "core_kernel" {with-test} + "async_kernel" {with-test & >= "v0.17.0"} + "async_unix" {with-test} "cohttp-async" {with-test & = version} "uri" {with-test & >= "4.2.0"} "fmt" {with-test} - "ounit" {with-test} - "alcotest" {with-test} + "ounit2" {with-test} + "alcotest" {with-test & >= "1.7.0"} "odoc" {with-doc} ] dev-repo: "git+https://github.com/mirage/ocaml-cohttp.git" diff --git a/cohttp-curl-lwt.opam b/cohttp-curl-lwt.opam index 55052c7017..e16e1efa0c 100644 --- a/cohttp-curl-lwt.opam +++ b/cohttp-curl-lwt.opam @@ -28,12 +28,12 @@ depends: [ "stringext" "lwt" {>= "5.3.0"} "uri" {with-test & >= "4.2.0"} - "alcotest" {with-test} + "alcotest" {with-test & >= "1.7.0"} "cohttp-lwt-unix" {with-test & = version} "cohttp" {with-test & = version} "cohttp-lwt" {with-test & = version} "conduit-lwt" {with-test} - "ounit" {with-test} + "ounit2" {with-test} "odoc" {with-doc} ] dev-repo: "git+https://github.com/mirage/ocaml-cohttp.git" diff --git a/cohttp-eio.opam b/cohttp-eio.opam index 02a44870c2..954e8c875a 100644 --- a/cohttp-eio.opam +++ b/cohttp-eio.opam @@ -20,7 +20,7 @@ doc: "https://mirage.github.io/ocaml-cohttp/" bug-reports: "https://github.com/mirage/ocaml-cohttp/issues" depends: [ "dune" {>= "3.0"} - "alcotest" {with-test} + "alcotest" {with-test & >= "1.7.0"} "base-domains" "cohttp" {= version} "eio" {>= "0.12"} diff --git a/cohttp-lwt-unix.opam b/cohttp-lwt-unix.opam index 49d15a227b..26b3a42dc7 100644 --- a/cohttp-lwt-unix.opam +++ b/cohttp-lwt-unix.opam @@ -41,7 +41,7 @@ depends: [ "ppx_sexp_conv" {>= "v0.13.0"} "magic-mime" "logs" - "ounit" {with-test} + "ounit2" {with-test} "odoc" {with-doc} ] dev-repo: "git+https://github.com/mirage/ocaml-cohttp.git" diff --git a/cohttp-lwt-unix/test/cohttp_lwt_unix_test/src/dune b/cohttp-lwt-unix/test/cohttp_lwt_unix_test/src/dune index a0e42106ac..1314886b90 100644 --- a/cohttp-lwt-unix/test/cohttp_lwt_unix_test/src/dune +++ b/cohttp-lwt-unix/test/cohttp_lwt_unix_test/src/dune @@ -1,3 +1,3 @@ (library (name cohttp_lwt_unix_test) - (libraries conduit-lwt cohttp-lwt-unix cohttp_test oUnit)) + (libraries conduit-lwt cohttp-lwt-unix cohttp_test ounit2)) diff --git a/cohttp-lwt-unix/test/dune b/cohttp-lwt-unix/test/dune index 12025d6189..529a6528a6 100644 --- a/cohttp-lwt-unix/test/dune +++ b/cohttp-lwt-unix/test/dune @@ -1,7 +1,7 @@ (executable (name test_parser) (modules test_parser) - (libraries cohttp-lwt-unix oUnit lwt.unix)) + (libraries cohttp-lwt-unix ounit2 lwt.unix)) (rule (alias runtest) diff --git a/cohttp-lwt-unix/test/test_parser.ml b/cohttp-lwt-unix/test/test_parser.ml index 05af2d559b..67729df9f1 100644 --- a/cohttp-lwt-unix/test/test_parser.ml +++ b/cohttp-lwt-unix/test/test_parser.ml @@ -349,7 +349,7 @@ let test_cases = List.map (fun (n, x) -> n >:: fun () -> Lwt_main.run (x ())) tests (* Returns true if the result list contains successes only. - Copied from oUnit source as it isnt exposed by the mli *) + Copied from ounit2 source as it isnt exposed by the mli *) let rec was_successful = function | [] -> true | RSuccess _ :: t | RSkip _ :: t -> was_successful t diff --git a/cohttp.opam b/cohttp.opam index ca7cbc8962..d183ed6086 100644 --- a/cohttp.opam +++ b/cohttp.opam @@ -46,7 +46,7 @@ depends: [ "stringext" "base64" {>= "3.1.0"} "fmt" {with-test} - "alcotest" {with-test} + "alcotest" {with-test & >= "1.7.0"} "odoc" {with-doc} ] dev-repo: "git+https://github.com/mirage/ocaml-cohttp.git" diff --git a/dune-project b/dune-project index 9f572aaa65..cccc68178f 100644 --- a/dune-project +++ b/dune-project @@ -50,7 +50,7 @@ (base64 (>= 3.1.0)) (fmt :with-test) - (alcotest :with-test))) + (alcotest (and :with-test (>= 1.7.0))))) (package (name cohttp-top) @@ -113,7 +113,7 @@ (>= v0.13.0)) magic-mime logs - (ounit :with-test))) + (ounit2 :with-test))) (package (name cohttp-server-lwt-unix) @@ -197,7 +197,7 @@ sexplib0 (ppx_sexp_conv (>= v0.13.0)) - (ounit :with-test) + (ounit2 :with-test) (uri (>= 2.0.0)) uri-sexp @@ -245,7 +245,7 @@ (ocaml (>= 4.08)) (ppx_expect (and :with-test (>= v0.17.0))) - (alcotest :with-test) + (alcotest (and :with-test (>= 1.7.0))) (base_quickcheck :with-test) (ppx_assert :with-test) (ppx_sexp_conv :with-test) @@ -289,7 +289,7 @@ (and :with-test (>= 4.2.0))) - (alcotest :with-test) + (alcotest (and :with-test (>= 1.7.0))) (cohttp-lwt-unix (and :with-test @@ -303,7 +303,7 @@ :with-test (= :version))) (conduit-lwt :with-test) - (ounit :with-test))) + (ounit2 :with-test))) (package (name cohttp-curl-async) @@ -322,8 +322,9 @@ (>= v0.16.0)) (core_unix (>= v0.14.0)) - async_kernel - async_unix + (core_kernel :with-test) + (async_kernel (and :with-test (>= v0.17.0))) + (async_unix :with-test) (cohttp-async (and :with-test @@ -333,8 +334,8 @@ :with-test (>= 4.2.0))) (fmt :with-test) - (ounit :with-test) - (alcotest :with-test))) + (ounit2 :with-test) + (alcotest (and :with-test (>= 1.7.0))))) (package (name cohttp-bench) @@ -367,7 +368,7 @@ (description "A CoHTTP server and client implementation based on `eio` library. `cohttp-eio`features a multicore capable HTTP 1.1 server. The library promotes and is built with direct style of coding as opposed to a monadic.") (depends - (alcotest :with-test) + (alcotest (and :with-test (>= 1.7.0))) base-domains (cohttp (= :version)) diff --git a/flake.nix b/flake.nix index def8724793..25f813bd34 100644 --- a/flake.nix +++ b/flake.nix @@ -56,12 +56,12 @@ }; cohttp-curl-lwt = pkg { pname = "cohttp-curl-lwt"; - checkInputs = [ cohttp-lwt-unix cohttp cohttp-lwt conduit-lwt ounit uri ]; + checkInputs = [ cohttp-lwt-unix cohttp cohttp-lwt conduit-lwt ounit2 uri ]; propagatedBuildInputs = [ ocurl http stringext lwt ]; }; cohttp-curl-async = pkg { pname = "cohttp-curl-async"; - checkInputs = [ uri fmt ounit alcotest cohttp-async ]; + checkInputs = [ uri fmt ounit2 alcotest cohttp-async ]; propagatedBuildInputs = [ ocurl http stringext cohttp-curl core core_unix async_kernel async_unix @@ -80,7 +80,7 @@ }; cohttp-async = pkg { pname = "cohttp-async"; - checkInputs = [ mirage-crypto ounit ]; + checkInputs = [ mirage-crypto ounit2 ]; propagatedBuildInputs = [ http cohttp async_kernel async_unix async base core core_unix conduit-async magic-mime logs fmt sexplib0 ppx_sexp_conv uri uri-sexp ipaddr @@ -88,7 +88,7 @@ }; cohttp-lwt-unix = pkg { pname = "cohttp-lwt-unix"; - checkInputs = [ ounit ]; + checkInputs = [ ounit2 ]; propagatedBuildInputs = [ http cohttp cohttp-lwt cmdliner lwt conduit-lwt conduit-lwt-unix fmt ppx_sexp_conv magic-mime logs diff --git a/http.opam b/http.opam index 1b72755c33..21f8de8843 100644 --- a/http.opam +++ b/http.opam @@ -24,7 +24,7 @@ depends: [ "dune" {>= "3.0"} "ocaml" {>= "4.08"} "ppx_expect" {with-test & >= "v0.17.0"} - "alcotest" {with-test} + "alcotest" {with-test & >= "1.7.0"} "base_quickcheck" {with-test} "ppx_assert" {with-test} "ppx_sexp_conv" {with-test} diff --git a/test_helpers/cohttp_test/src/dune b/test_helpers/cohttp_test/src/dune index 44686094b4..bcc36bce88 100644 --- a/test_helpers/cohttp_test/src/dune +++ b/test_helpers/cohttp_test/src/dune @@ -1,3 +1,3 @@ (library (name cohttp_test) - (libraries cohttp oUnit)) + (libraries cohttp ounit2))