Skip to content

Commit

Permalink
Extract CI checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ThetaSinner committed Mar 13, 2024
1 parent 5d41afe commit f37268b
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 8 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,25 @@ jobs:
extraPullNames: holochain-ci
authToken: ${{ secrets.CACHIX_HOLOCHAIN_WIND_TUNNEL }}

- name: Check scripts
run: |
nix develop --command bash -c "shellcheck scripts/*.sh"
- name: Check Nix formatting
run: |
nix fmt ./nix flake.nix -- --check
nix develop .#ci --command bash -c "source ./scripts/checks.sh && check_nix_fmt"
- name: Lint Nix
run: |
nix develop --command bash -c "statix check ./nix && statix check ./flake.nix"
nix develop .#ci --command bash -c "source ./scripts/checks.sh && check_nix_static"
- name: Check Rust formatting
run: |
nix develop --command bash -c "cargo fmt --all -- --check"
nix develop .#ci --command bash -c "source ./scripts/checks.sh && check_rust_fmt"
- name: Lint Rust
run: |
nix develop --command bash -c "cargo clippy --workspace --all-targets --all-features -- -D warnings"
nix develop --command bash -c "source ./scripts/checks.sh && check_rust_static"
- name: Unit tests
run: |
Expand Down Expand Up @@ -80,7 +84,3 @@ jobs:
# pkill hc
# pkill holochain
# pkill lair-keystore

- name: Check scripts
run: |
nix develop --command bash -c "shellcheck scripts/*.sh"
13 changes: 13 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
inputsFrom = [
inputs.holochain.devShells.${system}.holonix
];

packages = [
pkgs.influxdb2-cli
pkgs.influxdb2-server
Expand All @@ -58,9 +59,21 @@
shellHook = ''
source ./scripts/influx.sh
source ./scripts/telegraf.sh
source ./scripts/checks.sh
'';
};

devShells.ci = pkgs.mkShell {
inputsFrom = [
inputs.holochain.devShells.${system}.holochainBinaries
];

packages = [
pkgs.shellcheck
pkgs.statix
];
};

apps = builtins.listToAttrs (builtins.map (name: { inherit name; value = { program = self'.packages.${name}; }; }) scenario_package_names);
};
};
Expand Down
22 changes: 22 additions & 0 deletions scripts/checks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
check_nix_fmt() {
nix fmt ./nix flake.nix -- --check
}

check_nix_static() {
statix check ./nix && statix check ./flake.nix
}

check_rust_fmt() {
cargo fmt --all -- --check
}

check_rust_static() {
cargo clippy --workspace --all-targets --all-features -- -D warnings
}

check_all() {
check_nix_fmt
check_nix_static
check_rust_fmt
check_rust_static
}

0 comments on commit f37268b

Please sign in to comment.