From 33514663a3e404b44e5767b8e398834f93c239bf Mon Sep 17 00:00:00 2001 From: kiskaadee Date: Sun, 13 Sep 2026 03:22:27 -0500 Subject: [PATCH] ci: run architecture and security validation in flake check and gitea actions --- .gitea/workflows/ci.yaml | 21 +++++++++++++++++++++ flake.nix | 36 ++++++++++++++++++++++++++++++++++-- 2 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 .gitea/workflows/ci.yaml diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml new file mode 100644 index 0000000..ff6b4a0 --- /dev/null +++ b/.gitea/workflows/ci.yaml @@ -0,0 +1,21 @@ +name: Core Architecture & Invariant CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@main + + - name: Run Architecture & Security Invariant Checks + run: | + nix flake check diff --git a/flake.nix b/flake.nix index 1aee834..482c92a 100644 --- a/flake.nix +++ b/flake.nix @@ -10,14 +10,46 @@ }; }; - outputs = { self, nixpkgs, sops-nix, ... }@inputs: { + outputs = { self, nixpkgs, sops-nix, ... }@inputs: + let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + in + { nixosConfigurations.server = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; + inherit system; specialArgs = { inherit inputs; }; modules = [ ./nixos/configuration.nix sops-nix.nixosModules.sops ]; }; + + devShells.${system}.default = pkgs.mkShell { + buildInputs = with pkgs; [ + python3 + python3Packages.pytest + python3Packages.pyyaml + ruff + ]; + }; + + checks.${system} = { + test-suite = pkgs.runCommand "core-tests" { + nativeBuildInputs = with pkgs; [ + python3 + python3Packages.pytest + python3Packages.pyyaml + ruff + ]; + } '' + mkdir -p $out + cp -r ${self} source + chmod -R u+w source + cd source + HOME=/tmp ruff check --no-cache . + HOME=/tmp pytest -o cache_dir=/tmp/.pytest_cache tests/ + ''; + }; }; }