diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 00000000..82c6ab88 --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,34 @@ +name: Run NixOS Tests + +on: + push: + branches: + - main + pull_request: + +jobs: + run-tests: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set Up Nix + uses: cachix/install-nix-action@v22 + with: + nix_version: latest + extra_nix_config: | + experimental-features = nix-command flakes + + - name: Run Tests + env: + root_dir: ${{ github.workspace }} + NIX_PATH: nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixpkgs-unstable.tar.gz + run: | + run_lib_tests() { + pushd "$root_dir" + nix-shell -p nix-unit --run "nix-unit ./lib/spec.nix --gc-roots-dir ./.result-test" + popd || exit 1 + } + run_lib_tests diff --git a/README.md b/README.md index d40a308f..2ab1de64 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,7 @@ - `desktop`: desktop configurations. - `integrations`: module integrations. - `conf`: config files needed for a function, derivation, etc. +- `spec`: test files. ### Usage diff --git a/lib/spec.nix b/lib/spec.nix index 129f2274..ed26e6f7 100644 --- a/lib/spec.nix +++ b/lib/spec.nix @@ -13,6 +13,7 @@ in { expected = [ ../modules/nupkgs/devtunnel-cli ../modules/nupkgs/home.nix + ../modules/nupkgs/zellij-switch ]; };