diff --git a/.gitea/workflows/checks.yaml b/.gitea/workflows/checks.yaml deleted file mode 100644 index e0e576a40..000000000 --- a/.gitea/workflows/checks.yaml +++ /dev/null @@ -1,9 +0,0 @@ -name: checks -on: - pull_request: -jobs: - checks-impure: - runs-on: nix - steps: - - uses: actions/checkout@v4 - - run: nix run .#impure-checks diff --git a/checks/flake-module.nix b/checks/flake-module.nix index c8d703060..d14af606e 100644 --- a/checks/flake-module.nix +++ b/checks/flake-module.nix @@ -36,7 +36,6 @@ in ++ filter pathExists [ ./devshell/flake-module.nix ./flash/flake-module.nix - ./impure/flake-module.nix ./installation/flake-module.nix ./update/flake-module.nix ./morph/flake-module.nix diff --git a/checks/impure/flake-module.nix b/checks/impure/flake-module.nix deleted file mode 100644 index a20c02d82..000000000 --- a/checks/impure/flake-module.nix +++ /dev/null @@ -1,51 +0,0 @@ -{ - perSystem = - { - pkgs, - lib, - self', - ... - }: - { - # a script that executes all other checks - packages.impure-checks = pkgs.writeShellScriptBin "impure-checks" '' - #!${pkgs.bash}/bin/bash - set -euo pipefail - - unset CLAN_DIR - - export PATH="${ - lib.makeBinPath ( - [ - pkgs.gitMinimal - pkgs.nix - pkgs.coreutils - pkgs.rsync # needed to have rsync installed on the dummy ssh server - ] - ++ self'.packages.clan-cli-full.runtimeDependencies - ) - }" - ROOT=$(git rev-parse --show-toplevel) - cd "$ROOT/pkgs/clan-cli" - - # Set up custom git configuration for tests - export GIT_CONFIG_GLOBAL=$(mktemp) - git config --file "$GIT_CONFIG_GLOBAL" user.name "Test User" - git config --file "$GIT_CONFIG_GLOBAL" user.email "test@example.com" - export GIT_CONFIG_SYSTEM=/dev/null - - # this disables dynamic dependency loading in clan-cli - export CLAN_NO_DYNAMIC_DEPS=1 - - jobs=$(nproc) - # Spawning worker in pytest is relatively slow, so we limit the number of jobs to 13 - # (current number of impure tests) - jobs="$((jobs > 6 ? 6 : jobs))" - - nix develop "$ROOT#clan-cli" -c bash -c "TMPDIR=/tmp python -m pytest -n $jobs -m impure ./clan_cli $@" - - # Clean up temporary git config - rm -f "$GIT_CONFIG_GLOBAL" - ''; - }; -} diff --git a/docs/site/guides/contributing/debugging.md b/docs/site/guides/contributing/debugging.md index 32bc9bc8b..36fcd2dfe 100644 --- a/docs/site/guides/contributing/debugging.md +++ b/docs/site/guides/contributing/debugging.md @@ -90,13 +90,10 @@ export CLAN_DEBUG_COMMANDS=1 These options help you pinpoint the source and context of print messages and debug logs during development. - ## Analyzing Performance To understand what's causing slow performance, set the environment variable `export CLAN_CLI_PERF=1`. When you complete a clan command, you'll see a summary of various performance metrics, helping you identify what's taking up time. - - ## See all possible packages and tests To quickly show all possible packages and tests execute: @@ -155,28 +152,16 @@ To test the CLI locally in a development environment and set breakpoints for deb ## Test Locally in a Nix Sandbox -To run tests in a Nix sandbox, you have two options depending on whether your test functions have been marked as impure or not: - -### Running Tests Marked as Impure - -If your test functions need to execute `nix build` and have been marked as impure because you can't execute `nix build` inside a Nix sandbox, use the following command: +To run tests in a Nix sandbox: ```bash -nix run .#impure-checks -L +nix build .#checks.x86_64-linux.clan-pytest-with-core ``` -This command will run the impure test functions. - -### Running Pure Tests - -For test functions that have not been marked as impure and don't require executing `nix build`, you can use the following command: - ```bash -nix build .#checks.x86_64-linux.clan-pytest --rebuild +nix build .#checks.x86_64-linux.clan-pytest-without-core ``` -This command will run all pure test functions. - ### Inspecting the Nix Sandbox If you need to inspect the Nix sandbox while running tests, follow these steps: diff --git a/pkgs/clan-cli/README.md b/pkgs/clan-cli/README.md index 69f496ea5..9fec4d182 100644 --- a/pkgs/clan-cli/README.md +++ b/pkgs/clan-cli/README.md @@ -32,16 +32,12 @@ You can also run a single test like this: pytest -n0 -s tests/test_secrets_cli.py::test_users ``` -## Run tests in nix container - -Run all impure checks +Run all checks in a sandbox ```bash -nix run .#impure-checks +nix build .#checks.x86_64-linux.clan-pytest-with-core ``` -Run all checks - ```bash -nix flake check +nix build .#checks.x86_64-linux.clan-pytest-without-core ```