Skip to content

Commit

Permalink
feat(ci): script and ci check F* versions
Browse files Browse the repository at this point in the history
  • Loading branch information
W95Psp committed Jan 18, 2024
1 parent c8198a0 commit a65106d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/install_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ jobs:
nix profile install .#rustc
nix profile install .
- name: Ensure readme coherency
run: |
nix build .#check-readme-coherency -L
- name: Test the toolchain
run: |
nix build .#check-toolchain -L
Expand Down
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* With Nix, `nix develop .#fstar` setups a shell automatically for you.

* Without Nix:
1. install F* `v2023.09.03` manually (see https://github.com/FStarLang/FStar/blob/master/INSTALL.md);
1. install F* `v2023.09.03`<!---FSTAR_VERSION--> manually (see https://github.com/FStarLang/FStar/blob/master/INSTALL.md);
1. make sure to have `fstar.exe` in PATH;
2. or set the `FSTAR_HOME` environment variable.
2. clone [Hacl*](https://github.com/hacl-star/hacl-star) somewhere;
Expand Down
4 changes: 2 additions & 2 deletions flake.lock

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

29 changes: 25 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
};
};
rust-overlay.follows = "crane/rust-overlay";
fstar-flake = {
fstar = {
url = "github:FStarLang/FStar/v2024.01.13";
inputs = {
nixpkgs.follows = "nixpkgs";
Expand All @@ -27,10 +27,9 @@
nixpkgs,
rust-overlay,
crane,
fstar-flake,
hacl-star,
...
}:
} @ inputs:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = import nixpkgs {
Expand All @@ -41,7 +40,7 @@
craneLib = (crane.mkLib pkgs).overrideToolchain rustc;
ocamlformat = pkgs.ocamlformat_0_24_1;
rustfmt = pkgs.rustfmt;
fstar = fstar-flake.packages.${system}.default;
fstar = inputs.fstar.packages.${system}.default;
in rec {
packages = {
inherit rustc ocamlformat rustfmt fstar;
Expand All @@ -59,15 +58,37 @@

check-toolchain = checks.toolchain;
check-examples = checks.examples;
check-readme-coherency = checks.readme-coherency;
};
checks = {
toolchain = packages.hax.tests;
examples = pkgs.callPackage ./examples {
inherit (packages) hax;
inherit craneLib fstar hacl-star;
};
readme-coherency = let
src = pkgs.lib.sourceFilesBySuffices ./. [".md"];
in
pkgs.stdenv.mkDerivation {
name = "readme-coherency";
inherit src;
buildPhase = ''
${apps.replace-fstar-versions-md.program}
diff -r . ${src}
'';
installPhase = "touch $out";
};
};
apps = {
replace-fstar-versions-md = {
type = "app";
program = "${pkgs.writeScript "replace-fstar-versions-md" ''
FSTAR_VERSION=$(cat ${./flake.lock} | ${pkgs.jq}/bin/jq '.nodes.fstar.original.ref' -r)
${pkgs.fd}/bin/fd \
-X ${pkgs.sd}/bin/sd '`.*?`(<!---FSTAR_VERSION-->)' '`'"$FSTAR_VERSION"'`$1' **/*.md \
";" --glob '*.md'
''}";
};
serve-rustc-docs = {
type = "app";
program = "${pkgs.writeScript "serve-rustc-docs" ''
Expand Down

0 comments on commit a65106d

Please sign in to comment.