From 6430e2566ae4dd79094c3369e9a68f6580fd0f9f Mon Sep 17 00:00:00 2001 From: ibizaman Date: Tue, 12 Mar 2024 23:11:35 -0700 Subject: [PATCH 1/6] add reasonable timeout on CI step --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fb3a11c..73c645c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,6 +20,7 @@ jobs: name: selfhostblocks authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - name: Run tests + timeout-minutes: 30 run: | nix run github:Mic92/nix-fast-build -- \ --skip-cached --no-nom \ From 8ccfe44df9b63adfee5a751f04a44e6dc05da29b Mon Sep 17 00:00:00 2001 From: ibizaman Date: Sun, 17 Mar 2024 11:01:27 -0700 Subject: [PATCH 2/6] reduce test vm footprint --- modules/services/nextcloud-server.nix | 2 +- test/vm/arr.nix | 4 ++++ test/vm/audiobookshelf.nix | 11 +++++++++++ test/vm/authelia.nix | 5 +++++ test/vm/grocy.nix | 8 ++++++++ test/vm/jellyfin.nix | 14 ++++++++++++++ test/vm/ldap.nix | 6 ++++++ test/vm/lib.nix | 5 +++++ test/vm/monitoring.nix | 6 ++++++ test/vm/nextcloud.nix | 7 +++++++ test/vm/postgresql.nix | 15 +++++++++++++++ test/vm/ssl.nix | 6 ++++++ 12 files changed, 88 insertions(+), 1 deletion(-) diff --git a/modules/services/nextcloud-server.nix b/modules/services/nextcloud-server.nix index 197f251..eaba074 100644 --- a/modules/services/nextcloud-server.nix +++ b/modules/services/nextcloud-server.nix @@ -608,7 +608,7 @@ in environment.systemPackages = [ # Needed for a few apps. Would be nice to avoid having to put that in the environment and instead override https://github.com/NixOS/nixpkgs/blob/261abe8a44a7e8392598d038d2e01f7b33cf26d0/nixos/modules/services/web-apps/nextcloud.nix#L1035 - pkgs.ffmpeg + pkgs.ffmpeg-headless # Needed for the recognize app. pkgs.nodejs diff --git a/test/vm/arr.nix b/test/vm/arr.nix index d1c4678..c490d02 100644 --- a/test/vm/arr.nix +++ b/test/vm/arr.nix @@ -1,5 +1,6 @@ { pkgs, lib, ... }: let + pkgs' = pkgs; # TODO: Test login commonTestScript = appname: { nodes, ... }: let @@ -58,6 +59,9 @@ let ../../modules/blocks/postgresql.nix ../../modules/blocks/nginx.nix ../../modules/services/arr.nix + (pkgs'.path + "/nixos/modules/profiles/minimal.nix") + (pkgs'.path + "/nixos/modules/profiles/headless.nix") + (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") ]; shb.arr.${appname} = { diff --git a/test/vm/audiobookshelf.nix b/test/vm/audiobookshelf.nix index 7d035fc..6a8a4bc 100644 --- a/test/vm/audiobookshelf.nix +++ b/test/vm/audiobookshelf.nix @@ -1,5 +1,7 @@ { pkgs, lib, ... }: let + pkgs' = pkgs; + # TODO: Test login commonTestScript = { nodes, ... }: let @@ -43,6 +45,9 @@ in nodes.server = { config, pkgs, ... }: { imports = [ + (pkgs'.path + "/nixos/modules/profiles/minimal.nix") + (pkgs'.path + "/nixos/modules/profiles/headless.nix") + (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { options = { shb.backup = lib.mkOption { type = lib.types.anything; }; @@ -71,6 +76,9 @@ in nodes.server = { config, pkgs, ... }: { imports = [ + (pkgs'.path + "/nixos/modules/profiles/minimal.nix") + (pkgs'.path + "/nixos/modules/profiles/headless.nix") + (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { options = { shb.backup = lib.mkOption { type = lib.types.anything; }; @@ -120,6 +128,9 @@ in nodes.server = { config, pkgs, ... }: { imports = [ + (pkgs'.path + "/nixos/modules/profiles/minimal.nix") + (pkgs'.path + "/nixos/modules/profiles/headless.nix") + (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { options = { shb.backup = lib.mkOption { type = lib.types.anything; }; diff --git a/test/vm/authelia.nix b/test/vm/authelia.nix index 45d3cc6..6e06497 100644 --- a/test/vm/authelia.nix +++ b/test/vm/authelia.nix @@ -1,5 +1,7 @@ { pkgs, lib, ... }: let + pkgs' = pkgs; + ldapAdminPassword = "ldapAdminPassword"; in { @@ -8,6 +10,9 @@ in nodes.machine = { config, pkgs, ... }: { imports = [ + (pkgs'.path + "/nixos/modules/profiles/minimal.nix") + (pkgs'.path + "/nixos/modules/profiles/headless.nix") + (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { options = { shb.backup = lib.mkOption { type = lib.types.anything; }; diff --git a/test/vm/grocy.nix b/test/vm/grocy.nix index 5e33eb9..e0245db 100644 --- a/test/vm/grocy.nix +++ b/test/vm/grocy.nix @@ -1,5 +1,7 @@ { pkgs, lib, ... }: let + pkgs' = pkgs; + # TODO: Test login commonTestScript = { nodes, ... }: let @@ -43,6 +45,9 @@ in nodes.server = { config, pkgs, ... }: { imports = [ + (pkgs'.path + "/nixos/modules/profiles/minimal.nix") + (pkgs'.path + "/nixos/modules/profiles/headless.nix") + (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { options = { shb.backup = lib.mkOption { type = lib.types.anything; }; @@ -70,6 +75,9 @@ in nodes.server = { config, pkgs, ... }: { imports = [ + (pkgs'.path + "/nixos/modules/profiles/minimal.nix") + (pkgs'.path + "/nixos/modules/profiles/headless.nix") + (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { options = { shb.backup = lib.mkOption { type = lib.types.anything; }; diff --git a/test/vm/jellyfin.nix b/test/vm/jellyfin.nix index bfc6454..23696fd 100644 --- a/test/vm/jellyfin.nix +++ b/test/vm/jellyfin.nix @@ -1,5 +1,7 @@ { pkgs, lib, ... }: let + pkgs' = pkgs; + # TODO: Test login commonTestScript = { nodes, ... }: let @@ -43,6 +45,9 @@ in nodes.server = { config, pkgs, ... }: { imports = [ + (pkgs'.path + "/nixos/modules/profiles/minimal.nix") + (pkgs'.path + "/nixos/modules/profiles/headless.nix") + (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { options = { shb.backup = lib.mkOption { type = lib.types.anything; }; @@ -71,6 +76,9 @@ in nodes.server = { config, pkgs, ... }: { imports = [ + (pkgs'.path + "/nixos/modules/profiles/minimal.nix") + (pkgs'.path + "/nixos/modules/profiles/headless.nix") + (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { options = { shb.backup = lib.mkOption { type = lib.types.anything; }; @@ -119,6 +127,9 @@ in nodes.server = { config, pkgs, ... }: { imports = [ + (pkgs'.path + "/nixos/modules/profiles/minimal.nix") + (pkgs'.path + "/nixos/modules/profiles/headless.nix") + (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { options = { shb.backup = lib.mkOption { type = lib.types.anything; }; @@ -169,6 +180,9 @@ in nodes.server = { config, pkgs, ... }: { imports = [ + (pkgs'.path + "/nixos/modules/profiles/minimal.nix") + (pkgs'.path + "/nixos/modules/profiles/headless.nix") + (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { options = { shb.backup = lib.mkOption { type = lib.types.anything; }; diff --git a/test/vm/ldap.nix b/test/vm/ldap.nix index 967757a..6c8cf00 100644 --- a/test/vm/ldap.nix +++ b/test/vm/ldap.nix @@ -1,10 +1,16 @@ { pkgs, lib, ... }: +let + pkgs' = pkgs; +in { auth = pkgs.nixosTest { name = "ldap-auth"; nodes.server = { config, pkgs, ... }: { imports = [ + (pkgs'.path + "/nixos/modules/profiles/minimal.nix") + (pkgs'.path + "/nixos/modules/profiles/headless.nix") + (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { options = { shb.ssl.enable = lib.mkEnableOption "ssl"; diff --git a/test/vm/lib.nix b/test/vm/lib.nix index 5a79c0a..7c18f9a 100644 --- a/test/vm/lib.nix +++ b/test/vm/lib.nix @@ -1,5 +1,7 @@ { pkgs, lib, ... }: let + pkgs' = pkgs; + shblib = pkgs.callPackage ../../lib {}; in { @@ -45,6 +47,9 @@ in nodes.machine = { config, pkgs, ... }: { imports = [ + (pkgs'.path + "/nixos/modules/profiles/minimal.nix") + (pkgs'.path + "/nixos/modules/profiles/headless.nix") + (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { options = { libtest.config = lib.mkOption { diff --git a/test/vm/monitoring.nix b/test/vm/monitoring.nix index e9ee204..f2ebbb0 100644 --- a/test/vm/monitoring.nix +++ b/test/vm/monitoring.nix @@ -1,4 +1,7 @@ { pkgs, lib, ... }: +let + pkgs' = pkgs; +in { # This test, although simple, makes sure all provisioning went fine. auth = pkgs.nixosTest { @@ -6,6 +9,9 @@ nodes.machine = { config, pkgs, ... }: { imports = [ + (pkgs'.path + "/nixos/modules/profiles/minimal.nix") + (pkgs'.path + "/nixos/modules/profiles/headless.nix") + (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { options = { shb.ssl.enable = lib.mkEnableOption "ssl"; diff --git a/test/vm/nextcloud.nix b/test/vm/nextcloud.nix index 58ef84e..1c722fc 100644 --- a/test/vm/nextcloud.nix +++ b/test/vm/nextcloud.nix @@ -1,5 +1,6 @@ { pkgs, lib, ... }: let + pkgs' = pkgs; adminUser = "root"; adminPass = "rootpw"; @@ -129,6 +130,9 @@ in nodes.server = { config, pkgs, ... }: { imports = [ + (pkgs'.path + "/nixos/modules/profiles/minimal.nix") + (pkgs'.path + "/nixos/modules/profiles/headless.nix") + (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { options = { shb.backup = lib.mkOption { type = lib.types.anything; }; @@ -169,6 +173,9 @@ in nodes.server = { config, pkgs, ... }: { imports = [ + (pkgs'.path + "/nixos/modules/profiles/minimal.nix") + (pkgs'.path + "/nixos/modules/profiles/headless.nix") + (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { options = { shb.backup = lib.mkOption { type = lib.types.anything; }; diff --git a/test/vm/postgresql.nix b/test/vm/postgresql.nix index 28db06c..edf8fa0 100644 --- a/test/vm/postgresql.nix +++ b/test/vm/postgresql.nix @@ -1,10 +1,16 @@ { pkgs, lib, ... }: +let + pkgs' = pkgs; +in { peerWithoutUser = pkgs.nixosTest { name = "postgresql-peerWithoutUser"; nodes.machine = { config, pkgs, ... }: { imports = [ + (pkgs'.path + "/nixos/modules/profiles/minimal.nix") + (pkgs'.path + "/nixos/modules/profiles/headless.nix") + (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") ../../modules/blocks/postgresql.nix ]; @@ -40,6 +46,9 @@ nodes.machine = { config, pkgs, ... }: { imports = [ + (pkgs'.path + "/nixos/modules/profiles/minimal.nix") + (pkgs'.path + "/nixos/modules/profiles/headless.nix") + (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") ../../modules/blocks/postgresql.nix ]; @@ -88,6 +97,9 @@ nodes.machine = { config, pkgs, ... }: { imports = [ + (pkgs'.path + "/nixos/modules/profiles/minimal.nix") + (pkgs'.path + "/nixos/modules/profiles/headless.nix") + (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") ../../modules/blocks/postgresql.nix ]; @@ -124,6 +136,9 @@ nodes.machine = { config, pkgs, ... }: { imports = [ + (pkgs'.path + "/nixos/modules/profiles/minimal.nix") + (pkgs'.path + "/nixos/modules/profiles/headless.nix") + (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") ../../modules/blocks/postgresql.nix ]; diff --git a/test/vm/ssl.nix b/test/vm/ssl.nix index e66104a..d4f4dab 100644 --- a/test/vm/ssl.nix +++ b/test/vm/ssl.nix @@ -1,10 +1,16 @@ { pkgs, lib, ... }: +let + pkgs' = pkgs; +in { test = pkgs.nixosTest { name = "ssl-test"; nodes.server = { config, pkgs, ... }: { imports = [ + (pkgs'.path + "/nixos/modules/profiles/minimal.nix") + (pkgs'.path + "/nixos/modules/profiles/headless.nix") + (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") ../../modules/blocks/ssl.nix ]; From c4749ed1671f0c0f920ca047bb7df531a03db834 Mon Sep 17 00:00:00 2001 From: ibizaman Date: Tue, 19 Mar 2024 20:40:16 -0700 Subject: [PATCH 3/6] add garnix tests badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 281aa8a..8f136c9 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ [![Tests](https://github.com/ibizaman/selfhostblocks/actions/workflows/test.yml/badge.svg)](https://github.com/ibizaman/selfhostblocks/actions/workflows/test.yml) [![Demo](https://github.com/ibizaman/selfhostblocks/actions/workflows/demo.yml/badge.svg)](https://github.com/ibizaman/selfhostblocks/actions/workflows/demo.yml) [![Documentation](https://github.com/ibizaman/selfhostblocks/actions/workflows/docs.yml/badge.svg)](https://github.com/ibizaman/selfhostblocks/actions/workflows/docs.yml) +[![Tests](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgarnix.io%2Fapi%2Fbadges%2Fibizaman%2Fselfhostblocks)](https://garnix.io) (using Garnix) SHB's (Self Host Blocks) is yet another server management tool whose goal is to provide a lower entry-bar for self-hosting. SHB provides opinionated [building blocks](#available-blocks) fitting From fd642ac9471906cc5ac92b659661039625896d95 Mon Sep 17 00:00:00 2001 From: ibizaman Date: Tue, 19 Mar 2024 22:09:30 -0700 Subject: [PATCH 4/6] switch to runNixOSTest --- test/vm/arr.nix | 3 +-- test/vm/audiobookshelf.nix | 9 +++------ test/vm/authelia.nix | 3 +-- test/vm/grocy.nix | 6 ++---- test/vm/jellyfin.nix | 12 ++++-------- test/vm/ldap.nix | 3 +-- test/vm/lib.nix | 3 +-- test/vm/monitoring.nix | 3 +-- test/vm/nextcloud.nix | 6 ++---- test/vm/postgresql.nix | 12 ++++-------- test/vm/ssl.nix | 3 +-- 11 files changed, 21 insertions(+), 42 deletions(-) diff --git a/test/vm/arr.nix b/test/vm/arr.nix index c490d02..264e6fd 100644 --- a/test/vm/arr.nix +++ b/test/vm/arr.nix @@ -45,7 +45,7 @@ let raise Exception(f"Code is {response['code']}") ''; - basic = appname: pkgs.nixosTest { + basic = appname: pkgs.testers.runNixOSTest { name = "arr-${appname}-basic"; nodes.server = { config, pkgs, ... }: { @@ -59,7 +59,6 @@ let ../../modules/blocks/postgresql.nix ../../modules/blocks/nginx.nix ../../modules/services/arr.nix - (pkgs'.path + "/nixos/modules/profiles/minimal.nix") (pkgs'.path + "/nixos/modules/profiles/headless.nix") (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") ]; diff --git a/test/vm/audiobookshelf.nix b/test/vm/audiobookshelf.nix index 6a8a4bc..795be7c 100644 --- a/test/vm/audiobookshelf.nix +++ b/test/vm/audiobookshelf.nix @@ -40,12 +40,11 @@ let ''; in { - basic = pkgs.nixosTest { + basic = pkgs.testers.runNixOSTest { name = "audiobookshelf-basic"; nodes.server = { config, pkgs, ... }: { imports = [ - (pkgs'.path + "/nixos/modules/profiles/minimal.nix") (pkgs'.path + "/nixos/modules/profiles/headless.nix") (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { @@ -71,12 +70,11 @@ in testScript = commonTestScript; }; - cert = pkgs.nixosTest { + cert = pkgs.testers.runNixOSTest { name = "audiobookshelf-cert"; nodes.server = { config, pkgs, ... }: { imports = [ - (pkgs'.path + "/nixos/modules/profiles/minimal.nix") (pkgs'.path + "/nixos/modules/profiles/headless.nix") (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { @@ -123,12 +121,11 @@ in testScript = commonTestScript; }; - sso = pkgs.nixosTest { + sso = pkgs.testers.runNixOSTest { name = "audiobookshelf-sso"; nodes.server = { config, pkgs, ... }: { imports = [ - (pkgs'.path + "/nixos/modules/profiles/minimal.nix") (pkgs'.path + "/nixos/modules/profiles/headless.nix") (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { diff --git a/test/vm/authelia.nix b/test/vm/authelia.nix index 6e06497..d6fdda9 100644 --- a/test/vm/authelia.nix +++ b/test/vm/authelia.nix @@ -5,12 +5,11 @@ let ldapAdminPassword = "ldapAdminPassword"; in { - basic = pkgs.nixosTest { + basic = pkgs.testers.runNixOSTest { name = "authelia-basic"; nodes.machine = { config, pkgs, ... }: { imports = [ - (pkgs'.path + "/nixos/modules/profiles/minimal.nix") (pkgs'.path + "/nixos/modules/profiles/headless.nix") (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { diff --git a/test/vm/grocy.nix b/test/vm/grocy.nix index e0245db..869e6d0 100644 --- a/test/vm/grocy.nix +++ b/test/vm/grocy.nix @@ -40,12 +40,11 @@ let ''; in { - basic = pkgs.nixosTest { + basic = pkgs.testers.runNixOSTest { name = "grocy-basic"; nodes.server = { config, pkgs, ... }: { imports = [ - (pkgs'.path + "/nixos/modules/profiles/minimal.nix") (pkgs'.path + "/nixos/modules/profiles/headless.nix") (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { @@ -70,12 +69,11 @@ in testScript = commonTestScript; }; - cert = pkgs.nixosTest { + cert = pkgs.testers.runNixOSTest { name = "grocy-cert"; nodes.server = { config, pkgs, ... }: { imports = [ - (pkgs'.path + "/nixos/modules/profiles/minimal.nix") (pkgs'.path + "/nixos/modules/profiles/headless.nix") (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { diff --git a/test/vm/jellyfin.nix b/test/vm/jellyfin.nix index 23696fd..253424e 100644 --- a/test/vm/jellyfin.nix +++ b/test/vm/jellyfin.nix @@ -40,12 +40,11 @@ let ''; in { - basic = pkgs.nixosTest { + basic = pkgs.testers.runNixOSTest { name = "jellyfin-basic"; nodes.server = { config, pkgs, ... }: { imports = [ - (pkgs'.path + "/nixos/modules/profiles/minimal.nix") (pkgs'.path + "/nixos/modules/profiles/headless.nix") (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { @@ -71,12 +70,11 @@ in testScript = commonTestScript; }; - ldap = pkgs.nixosTest { + ldap = pkgs.testers.runNixOSTest { name = "jellyfin-ldap"; nodes.server = { config, pkgs, ... }: { imports = [ - (pkgs'.path + "/nixos/modules/profiles/minimal.nix") (pkgs'.path + "/nixos/modules/profiles/headless.nix") (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { @@ -122,12 +120,11 @@ in testScript = commonTestScript; }; - cert = pkgs.nixosTest { + cert = pkgs.testers.runNixOSTest { name = "jellyfin_cert"; nodes.server = { config, pkgs, ... }: { imports = [ - (pkgs'.path + "/nixos/modules/profiles/minimal.nix") (pkgs'.path + "/nixos/modules/profiles/headless.nix") (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { @@ -175,12 +172,11 @@ in testScript = commonTestScript; }; - sso = pkgs.nixosTest { + sso = pkgs.testers.runNixOSTest { name = "jellyfin_sso"; nodes.server = { config, pkgs, ... }: { imports = [ - (pkgs'.path + "/nixos/modules/profiles/minimal.nix") (pkgs'.path + "/nixos/modules/profiles/headless.nix") (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { diff --git a/test/vm/ldap.nix b/test/vm/ldap.nix index 6c8cf00..a6724ca 100644 --- a/test/vm/ldap.nix +++ b/test/vm/ldap.nix @@ -3,12 +3,11 @@ let pkgs' = pkgs; in { - auth = pkgs.nixosTest { + auth = pkgs.testers.runNixOSTest { name = "ldap-auth"; nodes.server = { config, pkgs, ... }: { imports = [ - (pkgs'.path + "/nixos/modules/profiles/minimal.nix") (pkgs'.path + "/nixos/modules/profiles/headless.nix") (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { diff --git a/test/vm/lib.nix b/test/vm/lib.nix index 7c18f9a..8ee7db1 100644 --- a/test/vm/lib.nix +++ b/test/vm/lib.nix @@ -42,12 +42,11 @@ in generator = lib.generators.toJSON {}; }; in - pkgs.nixosTest { + pkgs.testers.runNixOSTest { name = "lib-template"; nodes.machine = { config, pkgs, ... }: { imports = [ - (pkgs'.path + "/nixos/modules/profiles/minimal.nix") (pkgs'.path + "/nixos/modules/profiles/headless.nix") (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { diff --git a/test/vm/monitoring.nix b/test/vm/monitoring.nix index f2ebbb0..15122d8 100644 --- a/test/vm/monitoring.nix +++ b/test/vm/monitoring.nix @@ -4,12 +4,11 @@ let in { # This test, although simple, makes sure all provisioning went fine. - auth = pkgs.nixosTest { + auth = pkgs.testers.runNixOSTest { name = "monitoring-basic"; nodes.machine = { config, pkgs, ... }: { imports = [ - (pkgs'.path + "/nixos/modules/profiles/minimal.nix") (pkgs'.path + "/nixos/modules/profiles/headless.nix") (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { diff --git a/test/vm/nextcloud.nix b/test/vm/nextcloud.nix index 1c722fc..4d5056c 100644 --- a/test/vm/nextcloud.nix +++ b/test/vm/nextcloud.nix @@ -125,12 +125,11 @@ let ''; in { - basic = pkgs.nixosTest { + basic = pkgs.testers.runNixOSTest { name = "nextcloud-basic"; nodes.server = { config, pkgs, ... }: { imports = [ - (pkgs'.path + "/nixos/modules/profiles/minimal.nix") (pkgs'.path + "/nixos/modules/profiles/headless.nix") (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { @@ -168,12 +167,11 @@ in testScript = commonTestScript; }; - cert = pkgs.nixosTest { + cert = pkgs.testers.runNixOSTest { name = "nextcloud-cert"; nodes.server = { config, pkgs, ... }: { imports = [ - (pkgs'.path + "/nixos/modules/profiles/minimal.nix") (pkgs'.path + "/nixos/modules/profiles/headless.nix") (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { diff --git a/test/vm/postgresql.nix b/test/vm/postgresql.nix index edf8fa0..9bd0163 100644 --- a/test/vm/postgresql.nix +++ b/test/vm/postgresql.nix @@ -3,12 +3,11 @@ let pkgs' = pkgs; in { - peerWithoutUser = pkgs.nixosTest { + peerWithoutUser = pkgs.testers.runNixOSTest { name = "postgresql-peerWithoutUser"; nodes.machine = { config, pkgs, ... }: { imports = [ - (pkgs'.path + "/nixos/modules/profiles/minimal.nix") (pkgs'.path + "/nixos/modules/profiles/headless.nix") (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") ../../modules/blocks/postgresql.nix @@ -41,12 +40,11 @@ in ''; }; - peerAuth = pkgs.nixosTest { + peerAuth = pkgs.testers.runNixOSTest { name = "postgresql-peerAuth"; nodes.machine = { config, pkgs, ... }: { imports = [ - (pkgs'.path + "/nixos/modules/profiles/minimal.nix") (pkgs'.path + "/nixos/modules/profiles/headless.nix") (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") ../../modules/blocks/postgresql.nix @@ -92,12 +90,11 @@ in ''; }; - tcpIPWithoutPasswordAuth = pkgs.nixosTest { + tcpIPWithoutPasswordAuth = pkgs.testers.runNixOSTest { name = "postgresql-tcpIpWithoutPasswordAuth"; nodes.machine = { config, pkgs, ... }: { imports = [ - (pkgs'.path + "/nixos/modules/profiles/minimal.nix") (pkgs'.path + "/nixos/modules/profiles/headless.nix") (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") ../../modules/blocks/postgresql.nix @@ -131,12 +128,11 @@ in ''; }; - tcpIPPasswordAuth = pkgs.nixosTest { + tcpIPPasswordAuth = pkgs.testers.runNixOSTest { name = "postgresql-tcpIPPasswordAuth"; nodes.machine = { config, pkgs, ... }: { imports = [ - (pkgs'.path + "/nixos/modules/profiles/minimal.nix") (pkgs'.path + "/nixos/modules/profiles/headless.nix") (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") ../../modules/blocks/postgresql.nix diff --git a/test/vm/ssl.nix b/test/vm/ssl.nix index d4f4dab..63d2303 100644 --- a/test/vm/ssl.nix +++ b/test/vm/ssl.nix @@ -3,12 +3,11 @@ let pkgs' = pkgs; in { - test = pkgs.nixosTest { + test = pkgs.testers.runNixOSTest { name = "ssl-test"; nodes.server = { config, pkgs, ... }: { imports = [ - (pkgs'.path + "/nixos/modules/profiles/minimal.nix") (pkgs'.path + "/nixos/modules/profiles/headless.nix") (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") ../../modules/blocks/ssl.nix From 98bc6ada4f539eaa26fd24ef3367382621e33df9 Mon Sep 17 00:00:00 2001 From: ibizaman Date: Tue, 19 Mar 2024 22:19:22 -0700 Subject: [PATCH 5/6] delete workflows to use garnix instead --- .github/workflows/demo.yml | 61 -------------------------------------- .github/workflows/docs.yml | 26 ---------------- .github/workflows/test.yml | 28 ----------------- 3 files changed, 115 deletions(-) delete mode 100644 .github/workflows/demo.yml delete mode 100644 .github/workflows/docs.yml delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml deleted file mode 100644 index a8b0913..0000000 --- a/.github/workflows/demo.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: "Demo" -on: - pull_request: - push: - branches: [ "main" ] -jobs: - # We're just checking if the demo start without hiccup. - test: - runs-on: ubuntu-latest - strategy: - matrix: - demo: - - homeassistant#basic - - homeassistant#ldap - - nextcloud#basic - - nextcloud#ldap - - nextcloud#sso - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@main - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - extra-conf: "system-features = nixos-test benchmark big-parallel kvm" - - name: Setup Caching - uses: cachix/cachix-action@v14 - with: - name: selfhostblocks - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - - name: Test demos - # See https://blog.stefan-koch.name/2020/12/10/qemu-guest-graceful-shutdown-from-python for - # inspiration. - run: | - set -x - - rm -f nixos.qcow2 - nix run nixpkgs#nixos-rebuild -- build-vm --flake ./demo/${{ matrix.demo }} - QEMU_NET_OPTS="hostfwd=tcp::8080-:80" ./result/bin/run-nixos-vm -nographic -qmp unix:/tmp/qmp-sock,server,nowait & - - nix run nixpkgs#socat -- - unix-connect:/tmp/qmp-sock <- - ${{ - contains(needs.*.result, 'failure') - || contains(needs.*.result, 'cancelled') - || contains(needs.*.result, 'skipped') - }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index 3542141..0000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: "Documentation" -on: - pull_request: -jobs: - gen: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@main - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - extra-conf: "system-features = nixos-test benchmark big-parallel kvm" - - name: Setup Caching - uses: cachix/cachix-action@v14 - with: - name: selfhostblocks - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - - name: Test building docs - run: | - nix \ - --print-build-logs \ - --option keep-going true \ - --show-trace \ - build .#manualHtml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 73c645c..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: "Test" -on: - pull_request: - push: - branches: [ "main" ] -jobs: - tests: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@main - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - extra-conf: "system-features = nixos-test benchmark big-parallel kvm" - - name: Setup Caching - uses: cachix/cachix-action@v14 - with: - name: selfhostblocks - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - - name: Run tests - timeout-minutes: 30 - run: | - nix run github:Mic92/nix-fast-build -- \ - --skip-cached --no-nom \ - --max-jobs 1 \ - --flake ".#checks.$(nix eval --raw --impure --expr builtins.currentSystem)" From b8da37f2ede0207d78204d4c281c4355a714986f Mon Sep 17 00:00:00 2001 From: ibizaman Date: Tue, 19 Mar 2024 22:26:15 -0700 Subject: [PATCH 6/6] add final ci step --- .github/workflows/garnix.yaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/garnix.yaml diff --git a/.github/workflows/garnix.yaml b/.github/workflows/garnix.yaml new file mode 100644 index 0000000..7052000 --- /dev/null +++ b/.github/workflows/garnix.yaml @@ -0,0 +1,20 @@ +name: "Final Results" + +on: + check_suite: + types: [completed] + +jobs: + results: + name: Final Results + runs-on: ubuntu-latest + steps: + - run: echo + - run: exit 1 + # see https://stackoverflow.com/a/67532120/4907315 + if: >- + ${{ + contains(needs.*.result, 'failure') + || contains(needs.*.result, 'cancelled') + || contains(needs.*.result, 'skipped') + }}