Skip to content

Commit

Permalink
ci: add javascript build to nix flake check
Browse files Browse the repository at this point in the history
  • Loading branch information
TWal committed Jan 31, 2024
1 parent 67812f2 commit 028a46a
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 11 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ test_vectors/data/%.json: test_vectors/git_commit | test_vectors/data

.PHONY: build check release

build: copy_lib
$(MAKE) -C fstar extract
build: copy_lib copy_tests
OCAMLPATH=$(FSTAR_HOME)/lib:$(OCAMLPATH) dune build --profile=release

check: copy_lib copy_tests $(ALL_TEST_VECTORS_JSON)
Expand Down
41 changes: 40 additions & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ let
cp -r ml fstar cache hints $out
'';
passthru.tests = mls-star-tests;
passthru.js = mls-star-js;
};

mls-star-tests = stdenv.mkDerivation {
Expand Down Expand Up @@ -60,7 +61,8 @@ let
'';
doCheck = true;
installPhase = ''
touch $out
mkdir -p $out
cp -r ml fstar cache hints $out
'';
passthru.test-vectors = test-files;
};
Expand All @@ -74,5 +76,42 @@ let
sha256 = "sha256-qYtSzY9epzvgahbJ3/omzGRwH5PVDLQmFfHzmQLDRc8=";
}
;

mls-star-js = stdenv.mkDerivation {
name = "mls-star-js";
src =
lib.sources.sourceByRegex ./. [
"hacl-star-snapshot(/.*)?"
"fstar(/.*)?"
"Makefile"
"dune-project"
"ml(/lib(/dune)?)?"
"ml(/tests(/dune)?)?"
"js(/.*)?"
"mls.opam"
]
;
enableParallelBuilding = true;
buildFlags = "build";
buildInputs =
[ which fstar z3 ]
++ (with ocamlPackages; [
ocaml dune_3 findlib yojson hacl-star
js_of_ocaml js_of_ocaml-ppx integers_stubs_js
])
++ (fstar-dune.buildInputs);
COMPARSE_HOME = comparse;
DY_HOME = dolev-yao-star;
# pre-patch uses build output from mls-star, to avoid building things twice
prePatch = ''
cp -pr --no-preserve=mode ${mls-star-tests}/cache ${mls-star-tests}/ml .
mkdir obj
cp -p ml/lib/src/* obj/
'';
installPhase = ''
touch $out
'';
};

in
mls-star
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@
++ (fstar.buildInputs);
};
checks.${system} = {
mls-build = mls-star;
mls-tests = mls-star.tests;
mls-star-build = mls-star;
mls-star-tests = mls-star.tests;
mls-star-js = mls-star.js;
};
};
}

0 comments on commit 028a46a

Please sign in to comment.