diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index 26097f39..5faf7cf4 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -26,3 +26,9 @@ jobs: steps: - uses: actions/checkout@v4 - run: cd panel && nix-build -A tests + + check-launch: + runs-on: native + steps: + - uses: actions/checkout@v4 + - run: cd launch && nix-build -A tests diff --git a/launch/default.nix b/launch/default.nix index b1700481..6ea02031 100644 --- a/launch/default.nix +++ b/launch/default.nix @@ -28,6 +28,8 @@ in ]; }; + tests = pkgs.callPackage ./tests.nix { }; + # re-export inputs so they can be overridden granularly # (they can't be accessed from the outside any other way) inherit diff --git a/launch/tests.nix b/launch/tests.nix new file mode 100644 index 00000000..b86c7747 --- /dev/null +++ b/launch/tests.nix @@ -0,0 +1,26 @@ +{ lib, pkgs }: +let + defaults = { + virtualisation = { + memorySize = 2048; + cores = 2; + }; + }; + tf = pkgs.callPackage ./tf.nix { }; + tfEnv = pkgs.callPackage ./tf-env.nix { }; +in +lib.mapAttrs (name: test: pkgs.testers.runNixOSTest (test // { inherit name; })) { + tf-validate = { + inherit defaults; + nodes.server = { + environment.systemPackages = [ + tf + tfEnv + ]; + }; + testScript = '' + server.wait_for_unit("multi-user.target") + server.succeed("${lib.getExe tf} -chdir='${tfEnv}/launch' validate") + ''; + }; +}