Skip to content

Commit

Permalink
Merge pull request #19 from datsfilipe/add-tests-workflow
Browse files Browse the repository at this point in the history
add tests workflow (test)
  • Loading branch information
datsfilipe authored Jan 9, 2025
2 parents 208367f + 7d78eb6 commit 392d51d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
- `desktop`: desktop configurations.
- `integrations`: module integrations.
- `conf`: config files needed for a function, derivation, etc.
- `spec`: test files.

### Usage

Expand Down
1 change: 1 addition & 0 deletions lib/spec.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ in {
expected = [
../modules/nupkgs/devtunnel-cli
../modules/nupkgs/home.nix
../modules/nupkgs/zellij-switch
];
};

Expand Down

0 comments on commit 392d51d

Please sign in to comment.