From 9066e6096bde876365016152daba47db183a6889 Mon Sep 17 00:00:00 2001 From: Hugo Renard Date: Wed, 4 Dec 2024 12:02:00 +0100 Subject: [PATCH] ci: add compliance check --- flake.lock | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++-- flake.nix | 36 ++++++++++++++++++ 2 files changed, 138 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index f59a84a..fda1977 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1732521221, - "narHash": "sha256-2ThgXBUXAE1oFsVATK1ZX9IjPcS4nKFOAjhPNKuiMn0=", + "lastModified": 1733212471, + "narHash": "sha256-M1+uCoV5igihRfcUKrr1riygbe73/dzNnzPsmaLCmpo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4633a7c72337ea8fd23a4f2ba3972865e3ec685d", + "rev": "55d15ad12a74eb7d4646254e13638ad0c4128776", "type": "github" }, "original": { @@ -34,10 +34,69 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1728492678, + "narHash": "sha256-9UTxR8eukdg+XZeHgxW5hQA9fIKHsKCdOIUycTryeVw=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "5633bcff0c6162b9e4b5f1264264611e950c8ec7", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "pyproject-nix": { + "inputs": { + "nixpkgs": [ + "scim2-cli", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1731223003, + "narHash": "sha256-hFf8/IeZKPUubMC452Mm+JiAEnvcw/a4Cvn2bcpeJqs=", + "owner": "nix-community", + "repo": "pyproject.nix", + "rev": "359dd9cd562730bbd31ab164832aae4dacd9c302", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "pyproject.nix", + "type": "github" + } + }, "root": { "inputs": { "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "scim2-cli": "scim2-cli" + } + }, + "scim2-cli": { + "inputs": { + "nixpkgs": "nixpkgs_2", + "pyproject-nix": "pyproject-nix", + "systems": "systems_2", + "uv2nix": "uv2nix" + }, + "locked": { + "lastModified": 1733309709, + "narHash": "sha256-Qp5kgHsyWehyBhsrVzfhlCxqDFV155XVK3xZPtnQD/g=", + "owner": "hrenard", + "repo": "scim2-cli", + "rev": "c67b7bca854b7c8659d111fb4064e9f455931f68", + "type": "github" + }, + "original": { + "owner": "hrenard", + "repo": "scim2-cli", + "type": "github" } }, "systems": { @@ -54,6 +113,45 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "id": "systems", + "type": "indirect" + } + }, + "uv2nix": { + "inputs": { + "nixpkgs": [ + "scim2-cli", + "nixpkgs" + ], + "pyproject-nix": [ + "scim2-cli", + "pyproject-nix" + ] + }, + "locked": { + "lastModified": 1731223088, + "narHash": "sha256-qkij76/APgVXsgagQ0z0lTy3qeorfTuY5S91tzROSe0=", + "owner": "adisbladis", + "repo": "uv2nix", + "rev": "638bb9e42147ebd6344053b20f05516b7b4674d7", + "type": "github" + }, + "original": { + "owner": "adisbladis", + "repo": "uv2nix", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 2f13a8e..aa573e9 100644 --- a/flake.nix +++ b/flake.nix @@ -4,12 +4,14 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; + scim2-cli.url = "github:hrenard/scim2-cli"; }; outputs = { nixpkgs, flake-utils, + scim2-cli, ... }: flake-utils.lib.eachDefaultSystem ( @@ -167,6 +169,40 @@ packages.make = make; packages.publish = publish; packages.release = release; + checks.compliance = pkgs.testers.runNixOSTest { + name = "compliance"; + nodes.machine = + { config, pkgs, ... }: + { + environment.systemPackages = [ + scim2-cli.packages.${system}.default + config.services.nextcloud.occ + ]; + services.nextcloud = { + enable = true; + hostName = "localhost"; + extraApps = { + inherit scimserviceprovider; + }; + config = { + adminpassFile = "${(pkgs.writeText "ncpass" ''P@ssw0rd'')}"; + }; + }; + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; + system.stateVersion = "24.11"; + }; + + testScript = '' + machine.wait_for_unit("nginx.service") + machine.wait_for_unit("phpfpm-nextcloud.service") + result = machine.execute("scim2 --url http://localhost/index.php/apps/scimserviceprovider --header 'Authorization: Basic cm9vdDpQQHNzdzByZA==' test -v")[1] + if "ERROR" in result: + raise Exception(result) + ''; + }; devShells.default = pkgs.mkShell { buildInputs = [ occ