eza icon indicating copy to clipboard operation
eza copied to clipboard

ci(nix): Migrate to crane (and speed up Nix CI)

Open 9glenda opened this issue 2 years ago • 22 comments

Closes #411 Closes #464

TODO

  • [ ] Fix failing tests
  • [x] clippy
  • [x] trycmd
  • ~~Cross compilation. https://crane.dev/examples/cross-rust-overlay.html~~ should be done in a extra PR
  • ~~Maybe optional musl cross compilation~~
  • [x] add clippy to packages
  • [x] add zip
  • [x] use flake parts
  • [x] Check for name changes in outputs breaking the Justfile
  • [x] apply patch from cafkafk for the Justfile.
  • [x] bring back Pre-commit-hooks checks
  • [x] rime (error 520?)
  • [x] treefmt packages refactor
  • [x] dev shell

Changes interesting for review

  • eza.meta is generated from cargo toml in favor of hard coding it
  • version changed from latest to "${version}-git"
  • cargo plugins used in Justfile added to dev shell

Notes (links for me to keep in mind)

NOTE

due to nix fmt only running statix fix statix lint's which don't have quickfixes will not be fixed by nix fmt and will throw an error at the pre-commit-hooks

9glenda avatar Oct 02 '23 14:10 9glenda

I want to do cross compilation in a separate PR.

9glenda avatar Oct 03 '23 09:10 9glenda

This is cool, thanks for doing this ❤️

I wonder what's causing this:

2023-10-03_11-50

The new test runner mostly looks good, but wonder if we can fix this output being slightly broken. Honestly I'm fine with it being a little broken over not having colors thou. 2023-10-03_11-51

Also, why are those tests skipped?

No idea why the tests are skipped but I'm looking into it now.

9glenda avatar Oct 03 '23 10:10 9glenda

image Really Weird

Also it says that 0 tests were skipped. But a few lines before it says skipped.

9glenda avatar Oct 03 '23 10:10 9glenda

@cafkafk I modified some of the apparently skipped tests to fail. This also mad the CI fail. I assume the skipped is just a visual bug. when installing the cargo-nextest plugin and running the command manually not through nix there's no skipped text. image

9glenda avatar Oct 03 '23 11:10 9glenda

@cafkafk I modified some of the apparently skipped tests to fail. This also mad the CI fail. I assume the skipped is just a visual bug. when installing the cargo-nextest plugin and running the command manually not through nix there's no skipped text. image

Hmm, if it's just a visual bug we can live with it for now. Where should we mention this bug so upstream can fix it?

cafkafk avatar Oct 03 '23 12:10 cafkafk

@cafkafk I modified some of the apparently skipped tests to fail. This also mad the CI fail. I assume the skipped is just a visual bug. when installing the cargo-nextest plugin and running the command manually not through nix there's no skipped text. image

Hmm, if it's just a visual bug we can live with it for now. Where should we mention this bug so upstream can fix it?

We should do that but saying it only happens in crane seems like not enough information. I want to investigate it further first.

9glenda avatar Oct 03 '23 12:10 9glenda

I also think we should change this in the Justfile, seems like the current glob catches unix

diff --git a/Justfile b/Justfile
index e048b95a..d50984f6 100644
--- a/Justfile
+++ b/Justfile
@@ -265,8 +265,8 @@ gen_test_dir:
 #
 # WARNING: this can cause loss of work
 @idump:
-    rm ./tests/cmd/*nix.stderr -f || echo  
-    rm ./tests/cmd/*nix.stdout -f || echo
+    rm ./tests/cmd/*_nix.stderr -f || echo  
+    rm ./tests/cmd/*_nix.stdout -f || echo
     nix build -L ./#trydump
-    cp ./result/dump/*nix.* ./tests/cmd/
+    cp ./result/dump/*_nix.* ./tests/cmd/

(I can't push to this PR for some reason so here's a patch)

cafkafk avatar Oct 04 '23 05:10 cafkafk

Sorry for making your life harder, but I changed the flake a bit in #476 >_<

cafkafk avatar Oct 05 '23 13:10 cafkafk

I realized today that we should probably add zip to the devshell, the justfile uses it for the gh-release recipe

cafkafk avatar Oct 08 '23 10:10 cafkafk

@cafkafk I added flake-compat last commit. I think there's nothing wrong with it since it allows non flake users to also use the flake through legacy nix. If you have any issues with flake-compat we can also remove it.

9glenda avatar Oct 09 '23 17:10 9glenda

@cafkafk I added flake-compat last commit. I think there's nothing wrong with it since it allows non flake users to also use the flake through legacy nix. If you have any issues with flake-compat we can also remove it.

No I have no problem with adding it, the more can use the flake the better IMO!

cafkafk avatar Oct 09 '23 17:10 cafkafk

Sorry for the colosing and reopening. I was trying to rename this branch due to it causing confusion to me being named main. GitHub doesn't like this tho.

9glenda avatar Nov 04 '23 13:11 9glenda

@cafkafk I added eza-trycmd eza-trydump and eza-trycmd-local. Could you please take a look at it and check rather they work properly?

9glenda avatar Nov 04 '23 17:11 9glenda

@MartinFillon the code I edited was all formatting/suggestions from clippy. Clippy was (prior to this PR) set up t not check the tests.

9glenda avatar Nov 04 '23 18:11 9glenda

Just FYI #592 is coming

MartinFillon avatar Nov 04 '23 23:11 MartinFillon

Just FYI #592 is coming

Would you prefer to merge #592 first? I'd be fine with that.

9glenda avatar Nov 05 '23 00:11 9glenda

well it is you think it is better as I aim to delete regular nix itest and move them to generated dir with time. But now that I think about it my pr just separating both doesnt makes sense, I shall just migrate everything in one batch.

MartinFillon avatar Nov 05 '23 00:11 MartinFillon

@cafkafk this should be ready to merge now.

9glenda avatar Dec 07 '23 20:12 9glenda

I'm not sure why (except for one version test), but the integration tests fail. I'll try to regenerate them and see if it works.

There are still at least two failures, I'm not sure why they fail thou >_<

cafkafk avatar Dec 09 '23 13:12 cafkafk

I'm not sure why (except for one version test), but the integration tests fail. I'll try to regenerate them and see if it works.

@cafkafk Are the integration tests just trycmd or also trycmd-local? The trycmd-local tests complain about sudo not being found but that's also the case on the main branch iirc.

9glenda avatar Dec 14 '23 16:12 9glenda

the tests run in ci are trycmd and trycmd-local also calls ptests so that ci is not too long @9glenda

MartinFillon avatar Dec 14 '23 16:12 MartinFillon

I'm not sure why (except for one version test), but the integration tests fail. I'll try to regenerate them and see if it works.

@cafkafk Are the integration tests just trycmd or also trycmd-local?

IIRC it should be just trycmd, and trycmd-local should be reserved for being run locally, but my memory may fail me.

The trycmd-local tests complain about sudo not being found but that's also the case on the main branch iirc.

Yes, it shouldn't be a blocking problem I think?

cafkafk avatar Jan 06 '24 10:01 cafkafk