From 7449e8905b0560e816fd9eb0bfc53b6d0d73bc73 Mon Sep 17 00:00:00 2001 From: Sander Date: Sun, 21 Sep 2025 17:20:39 +0200 Subject: [PATCH] tests: improve env tests and move to tests dir --- .github/workflows/test.yml | 12 ++++++------ test.nix => tests/test-build.nix | 0 test-env.sh => tests/test-env.sh | 8 ++++++-- 3 files changed, 12 insertions(+), 8 deletions(-) rename test.nix => tests/test-build.nix (100%) rename test-env.sh => tests/test-env.sh (90%) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f73594c..3585df0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,12 +27,12 @@ jobs: with: nix_path: ${{ env.nixpkgs_channel }} - name: Test environment variables - run: ./test-env.sh + run: ./tests/test-env.sh - run: nix-env -iA cachix -f https://cachix.org/api/v1/install - run: cat /etc/nix/nix.conf # cachix should be available and be able to configure a cache - run: cachix use cachix - - run: nix-build test.nix + - run: nix-build tests/test-build.nix custom-nix-path: strategy: @@ -51,7 +51,7 @@ jobs: with: nix_path: ${{ env.nixpkgs_channel }} - run: test $NIX_PATH == '${{ env.nixpkgs_channel }}' - - run: nix-build test.nix + - run: nix-build tests/test-build.nix extra-nix-config: strategy: @@ -72,7 +72,7 @@ jobs: extra_nix_config: | sandbox = relaxed - run: cat /etc/nix/nix.conf - - run: nix-build test.nix --arg noChroot true + - run: nix-build tests/test-build.nix --arg noChroot true flakes: strategy: @@ -117,7 +117,7 @@ jobs: nix_path: ${{ env.nixpkgs_channel }} install_url: https://hydra.nixos.org/job/nix/master/installerScript/latest-finished/download/1/install install_options: "--tarball-url-prefix http://localhost:8080" - - run: nix-build test.nix + - run: nix-build tests/test-build.nix oldest-supported-installer: strategy: @@ -142,7 +142,7 @@ jobs: with: nix_path: ${{ env.nixpkgs_channel }} install_url: https://releases.nixos.org/nix/${{ matrix.installer_version }}/install - - run: nix-build test.nix + - run: nix-build tests/test-build.nix act-support: strategy: diff --git a/test.nix b/tests/test-build.nix similarity index 100% rename from test.nix rename to tests/test-build.nix diff --git a/test-env.sh b/tests/test-env.sh similarity index 90% rename from test-env.sh rename to tests/test-env.sh index bdcccf7..3d2e947 100755 --- a/test-env.sh +++ b/tests/test-env.sh @@ -20,10 +20,12 @@ if [[ -n "${NIX_SSL_CERT_FILE:-}" ]]; then if [[ -f "$NIX_SSL_CERT_FILE" ]]; then echo "✓ NIX_SSL_CERT_FILE is set and file exists" else - echo "⚠ NIX_SSL_CERT_FILE is set but file does not exist: $NIX_SSL_CERT_FILE" + echo "✗ NIX_SSL_CERT_FILE is set but file does not exist: $NIX_SSL_CERT_FILE" + exit 1 fi else - echo "⚠ NIX_SSL_CERT_FILE is not set (may be OK depending on system)" + echo "✗ NIX_SSL_CERT_FILE is not set" + exit 1 fi # Test PATH contains Nix paths @@ -41,6 +43,7 @@ if [[ -n "${NIX_PATH:-}" ]]; then echo "✓ NIX_PATH is set" else echo "NIX_PATH: " + exit 1 fi # Test TMPDIR @@ -49,6 +52,7 @@ if [[ -n "${TMPDIR:-}" ]]; then echo "✓ TMPDIR is set" else echo "⚠ TMPDIR is not set" + exit 1 fi echo