Skip to content

Commit

Permalink
add github hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
kai-tub committed Jun 11, 2024
1 parent 54d41de commit e2c9eb2
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
__pycache__/
artifacts/
benchmark/
.pre-commit-config.yaml
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
91 changes: 91 additions & 0 deletions flake.lock

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

12 changes: 10 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
systems.url = "github:nix-systems/x86_64-linux";
nix-filter.url = "github:numtide/nix-filter";
devshell.url = "github:numtide/devshell";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
nix-appimage = {
url = "github:ralismark/nix-appimage";
};
Expand All @@ -12,9 +13,8 @@
self,
nixpkgs,
systems,
nix-filter,
nix-appimage,
devshell,
...
} @ inputs: let
eachSystem = nixpkgs.lib.genAttrs (import systems);
pkgsFor = eachSystem (system: ((nixpkgs.legacyPackages.${system}.extend devshell.overlays.default).extend self.overlays.default));
Expand All @@ -31,6 +31,12 @@
lib = pkgs.lib;
in
{
pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
alejandra.enable = true;
};
};
rs-tensor-encoder-test-runner-check =
pkgs.runCommandNoCC "rs-encoder-test-runner-check" {
nativeBuildInputs = [self.packages.${system}.rs-tensor-encoder-test-runner];
Expand Down Expand Up @@ -99,9 +105,11 @@
buildPackage = inputs.self.packages.${system}.default;
in {
default = pkgs.mkShell {
inherit (self.checks.${system}.pre-commit-check) shellHook;
nativeBuildInputs = buildPackage.nativeBuildInputs;
buildInputs =
buildPackage.buildInputs
++ self.checks.${system}.pre-commit-check.enabledPackages
++ (with pkgs; [
# glibc
rustc
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/test_python_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def read_all_raster_bands(path):
as a string and the value the array data
"""
with rasterio.open(path) as r:
return {str(i): r.read(i) for i in range(1, r.count + 1)}
return {f"B{i}": r.read(i) for i in range(1, r.count + 1)}

def test_python_hyspecnet_integration(hyspecnet_root, encoded_hyspecnet_path):
source_file_data = {file: read_all_raster_bands(file) for file in hyspecnet_root.glob("**/*SPECTRAL_IMAGE.TIF")}
Expand Down

0 comments on commit e2c9eb2

Please sign in to comment.