Skip to content

Commit

Permalink
ci: add javascript tests to nix flake check
Browse files Browse the repository at this point in the history
  • Loading branch information
TWal committed Feb 1, 2024
1 parent 58c621d commit 95db503
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 14 deletions.
33 changes: 22 additions & 11 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{lib, stdenv, which, fstar, fstar-dune, z3, ocamlPackages, comparse, dolev-yao-star, fetchFromGitHub}:
{lib, stdenv, which, fstar, fstar-dune, z3, nodejs_20, ocamlPackages, comparse, dolev-yao-star, hacl-star-src, hacl-packages-src, fetchFromGitHub}:

let
mls-star = stdenv.mkDerivation {
Expand Down Expand Up @@ -92,25 +92,36 @@ let
]
;
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 = ''
patchShebangs js/import.sh
cp -pr --no-preserve=mode ${mls-star-tests}/cache ${mls-star-tests}/ml .
mkdir obj
cp -p ml/lib/src/* obj/
'';
buildPhase = ''
make build
(cd js; ./import.sh)
'';
doCheck = true;
checkPhase = ''
cd js
node index.js
'';
installPhase = ''
touch $out
'';
buildInputs =
[ which fstar z3 nodejs_20 ]
++ (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;
HACL_HOME = hacl-star-src;
HACL_PACKAGES_HOME = hacl-packages-src;
};

in
Expand Down
34 changes: 34 additions & 0 deletions flake.lock

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

14 changes: 12 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,19 @@
url = "github:prosecco/dolev-yao-star";
flake = false;
};

hacl-star-src = {
url = "github:hacl-star/hacl-star";
flake = false;
};

hacl-packages-src = {
url = "github:cryspen/hacl-packages";
flake = false;
};
};

outputs = {self, nixpkgs, fstar-flake, comparse-flake, dolev-yao-star-src}:
outputs = {self, nixpkgs, fstar-flake, comparse-flake, dolev-yao-star-src, hacl-star-src, hacl-packages-src}:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
Expand All @@ -24,7 +34,7 @@
fstar-dune = fstar-flake.packages.${system}.fstar-dune;
comparse = comparse-flake.packages.${system}.comparse;
dolev-yao-star = dolev-yao-star-src;
mls-star = pkgs.callPackage ./default.nix {inherit fstar fstar-dune z3 comparse dolev-yao-star; ocamlPackages = pkgs.ocaml-ng.ocamlPackages_4_14;};
mls-star = pkgs.callPackage ./default.nix {inherit fstar fstar-dune z3 comparse dolev-yao-star hacl-star-src hacl-packages-src; ocamlPackages = pkgs.ocaml-ng.ocamlPackages_4_14;};
in {
packages.${system} = {
default = mls-star;
Expand Down
2 changes: 1 addition & 1 deletion js/import.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -e
set -o pipefail
set -x
Expand Down

0 comments on commit 95db503

Please sign in to comment.