Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ocamlVersion: [4_14, 5_1, 5_2]
ocamlVersion: [4_14, 5_1, 5_2, 5_3, 5_4, 5_5]
steps:
- uses: actions/checkout@v4
with:
Expand Down
36 changes: 25 additions & 11 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,38 @@
inputs.nixpkgs.url = "github:anmonteiro/nix-overlays";
inputs.nixpkgs.inputs.flake-utils.follows = "flake-utils";

outputs = { self, nixpkgs, flake-utils, nix-filter }:
flake-utils.lib.eachDefaultSystem (system:
outputs =
{
self,
nixpkgs,
flake-utils,
nix-filter,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages."${system}".extend (self: super: {
ocamlPackages = super.ocaml-ng.ocamlPackages_5_2.overrideScope (oself: osuper: {
gluten-lwt-unix = osuper.gluten-lwt-unix.overrideAttrs (o: {
propagatedBuildInputs = o.propagatedBuildInputs ++ [ oself.tls-lwt ];
});
});
});
pkgs = nixpkgs.legacyPackages."${system}".extend (
self: super: {
ocamlPackages = super.ocaml-ng.ocamlPackages_5_5.overrideScope (
oself: osuper: {
gluten-lwt-unix = osuper.gluten-lwt-unix.overrideAttrs (o: {
propagatedBuildInputs = o.propagatedBuildInputs ++ [ oself.tls-lwt ];
});
}
);
}
);
packages = pkgs.callPackage ./nix { nix-filter = nix-filter.lib; };
in
{
packages = packages // { default = packages.h2; };
packages = packages // {
default = packages.h2;
};
defaultPackage = packages.h2;
devShells = {
default = pkgs.callPackage ./nix/shell.nix { inherit packages; };
release = self.devShells.${system}.default.override { release-mode = true; };
};
});
}
);
}
95 changes: 63 additions & 32 deletions nix/ci/test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,42 @@ let
};
nix-filter = import "${nix-filter-src}";


pkgs = import "${src}" {
extraOverlays = [
(self: super: {
ocamlPackages = super.ocaml-ng."ocamlPackages_${ocamlVersion}".overrideScope (oself: osuper: {
gluten-lwt-unix = osuper.gluten-lwt-unix.overrideAttrs (o: {
propagatedBuildInputs = o.propagatedBuildInputs ++ [ oself.tls-lwt ];
});
});
ocamlPackages = super.ocaml-ng."ocamlPackages_${ocamlVersion}".overrideScope (
oself: osuper: {
gluten-lwt-unix = osuper.gluten-lwt-unix.overrideAttrs (o: {
propagatedBuildInputs = o.propagatedBuildInputs ++ [ oself.tls-lwt ];
});
}
);
})
];
};


inherit (pkgs) lib stdenv fetchTarball ocamlPackages h2spec;
inherit (pkgs)
lib
stdenv
fetchTarball
ocamlPackages
h2spec
;

h2Pkgs = pkgs.callPackage ./.. { inherit nix-filter; };
h2Drvs = lib.filterAttrs (_: value: lib.isDerivation value) h2Pkgs;
srcs = lib.mapAttrsToList (_: v: v.src) h2Drvs ++ [
(with nix-filter; filter {
root = ../..;
include = [ "spec" ".ocamlformat" ".ocamlformat-ignore" ];
})
(
with nix-filter;
filter {
root = ../..;
include = [
"spec"
".ocamlformat"
".ocamlformat-ignore"
];
}
)
];
in

Expand All @@ -63,17 +76,30 @@ stdenv.mkDerivation {
touch $out
'';
buildInputs =
(lib.attrValues h2Drvs) ++
(with ocamlPackages; [ ocaml dune findlib ocamlformat httpun-lwt-unix ]) ++
(with pkgs; [ lsof h2spec ]);
checkInputs = with ocamlPackages; [ alcotest hex yojson ];
(lib.attrValues h2Drvs)
++ (with ocamlPackages; [
ocaml
dune
findlib
ocamlformat
httpun-lwt-unix
])
++ (with pkgs; [
lsof
h2spec
]);
checkInputs = with ocamlPackages; [
alcotest
hex
yojson
];
doCheck = true;
checkPhase = ''
# Check code is formatted with OCamlformat
dune build --root=. @fmt

# Build the examples
dune build @all --display=short
dune build --display=short @install @spec/all

dune build --root=. --display=short spec/lwt_h2spec.exe
dune exec --display=short spec/lwt_h2spec.exe &
Expand All @@ -90,20 +116,25 @@ stdenv.mkDerivation {
kill $(lsof -i tcp:8080 -t)

# Run Eio h2spec now
${if lib.versionOlder "5.0" ocamlPackages.ocaml.version then ''
dune build --display=short spec/eio_h2spec.exe
dune exec --display=short spec/eio_h2spec.exe &
while [ -z "$(lsof -t -i tcp:8080)" ]; do
sleep 1;
done;

h2spec --strict -p 8080 -P /string

h2spec --strict -p 8080 -P /bigstring

h2spec --strict -p 8080 --timeout 3 -P /streaming

kill $(lsof -i tcp:8080 -t)
'' else ""}
${
if lib.versionOlder "5.0" ocamlPackages.ocaml.version then
''
dune build --display=short spec/eio_h2spec.exe
dune exec --display=short spec/eio_h2spec.exe &
while [ -z "$(lsof -t -i tcp:8080)" ]; do
sleep 1;
done;

h2spec --strict -p 8080 -P /string

h2spec --strict -p 8080 -P /bigstring

h2spec --strict -p 8080 --timeout 3 -P /streaming

kill $(lsof -i tcp:8080 -t)
''
else
""
}
'';
}