Skip to content

Commit

Permalink
chore: update CI scripts (#1039)
Browse files Browse the repository at this point in the history
* chore: update CI scripts

Signed-off-by: Antonin Décimo <[email protected]>

* Add a lower bound on Alcotest 1.7.0

Signed-off-by: Antonin Décimo <[email protected]>

* Replace ounit with ounit2

Signed-off-by: Antonin Décimo <[email protected]>

* gha: cohttp-bench depends on cohttp-eio

Add its own build job.

Signed-off-by: Antonin Décimo <[email protected]>

* gha: Don't pull lwt packages when building async packages

Signed-off-by: Antonin Décimo <[email protected]>

* gha: test only 4.14 and 5.02

Signed-off-by: Antonin Décimo <[email protected]>

---------

Signed-off-by: Antonin Décimo <[email protected]>
  • Loading branch information
MisterDA committed Jun 27, 2024
1 parent 439a61d commit dfd3327
Show file tree
Hide file tree
Showing 17 changed files with 90 additions and 53 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
73 changes: 54 additions & 19 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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' }}
Expand All @@ -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
Expand All @@ -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
Expand All @@ -116,7 +118,7 @@ jobs:
- ubuntu-latest
- macos-latest
ocaml-compiler:
- 5.0.x
- 5.x
local-packages:
- |
http.opam
Expand All @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion cohttp-async.opam
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion cohttp-async/test/dune
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
base
core
async_kernel
oUnit
ounit2
cohttp-async))

(rule
Expand Down
9 changes: 5 additions & 4 deletions cohttp-curl-async.opam
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions cohttp-curl-lwt.opam
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion cohttp-eio.opam
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
2 changes: 1 addition & 1 deletion cohttp-lwt-unix.opam
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion cohttp-lwt-unix/test/cohttp_lwt_unix_test/src/dune
Original file line number Diff line number Diff line change
@@ -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))
2 changes: 1 addition & 1 deletion cohttp-lwt-unix/test/dune
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cohttp-lwt-unix/test/test_parser.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cohttp.opam
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
23 changes: 12 additions & 11 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -113,7 +113,7 @@
(>= v0.13.0))
magic-mime
logs
(ounit :with-test)))
(ounit2 :with-test)))

(package
(name cohttp-server-lwt-unix)
Expand Down Expand Up @@ -197,7 +197,7 @@
sexplib0
(ppx_sexp_conv
(>= v0.13.0))
(ounit :with-test)
(ounit2 :with-test)
(uri
(>= 2.0.0))
uri-sexp
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -303,7 +303,7 @@
:with-test
(= :version)))
(conduit-lwt :with-test)
(ounit :with-test)))
(ounit2 :with-test)))

(package
(name cohttp-curl-async)
Expand All @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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))
Expand Down
8 changes: 4 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -80,15 +80,15 @@
};
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
];
};
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
Expand Down
2 changes: 1 addition & 1 deletion http.opam
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
Loading

0 comments on commit dfd3327

Please sign in to comment.