Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a flake check for testing the stdlib #2061

Merged
merged 4 commits into from
Oct 8, 2024
Merged
Changes from 1 commit
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
8 changes: 7 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,12 @@
pkgs.mkShell {
buildInputs = [ terraform run-terraform update-infra ];
};

stdlibTests = pkgs.runCommandLocal "stdlib-test" { }
''
${pkgs.lib.getExe self.packages."${system}".default} test ${./core/stdlib/std.ncl};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the ; at the end going to make the command pass whatever is the actual result? Maybe a sanity check would be to push a commit with a deliberate error in the stdlib somewhere, just to be sure.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know exactly why (maybe runCommandLocal does a set -xeu or something?) but it seems to fail if I make it fail.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But why do you need the ; ? Can't we use a &&? Do we also have to necessarily create $out ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I can use && instead; the behavior seems to be the same.

Yes, without making $out then nix flake check fails with

error: builder for '/nix/store/kyr0xs7ncr05i3frnphvvvr1q8p8ja1c-stdlib-test.drv' failed to produce output path for output 'out' at '/nix/store/kyr0xs7ncr05i3frnphvvvr1q8p8ja1c-stdlib-test.drv.chroot/root/nix/store/yil1zc0j0vy5p3sjsp0c1kqi8r0h6krj-stdlib-test'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good! I think && is indeed better as it doesn't rely on assumptions about how runCommandLocal works internally 👍

mkdir $out
'';
in
rec {
packages = {
Expand Down Expand Up @@ -725,7 +731,7 @@
# shorter. Another option would be to compile a dev dependencies version
# of cargoArtifacts. But that almost doubles the cache space.
nickelWasm = buildNickelWasm { profile = "release"; };
inherit vscodeExtension;
inherit vscodeExtension stdlibTests;
pre-commit = pre-commit-builder { };
};
}
Expand Down