diff --git a/.envrc b/.envrc index 565a52a..f990172 100644 --- a/.envrc +++ b/.envrc @@ -1,2 +1 @@ -source $(fetchurl https://gitlab.com/rensa-nix/direnv/-/raw/v0.3.0/direnvrc "sha256-u7+KEz684NnIZ+Vh5x5qLrt8rKdnUNexewBoeTcEVHQ=") -use ren //repo/devShells/default +use flake . --impure --accept-flake-config diff --git a/.gitignore b/.gitignore index f5db43c..e1f66c8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +.direnv/ +.devenv/ result +.pre-commit-config.yaml *.xml cover.* diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7d70f67..6253297 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,4 @@ -# Generated by soonix, DO NOT EDIT include: -- component: gitlab.com/TECHNOFAB/nix-gitlab-ci/nix-gitlab-ci@3.1.2 - inputs: - version: 3.1.2 + - component: gitlab.com/TECHNOFAB/nix-gitlab-ci/nix-gitlab-ci@2.0.0 + inputs: + version: 2.0.0 diff --git a/.gitlab/renovate.json5 b/.gitlab/renovate.json5 deleted file mode 100644 index 67d4092..0000000 --- a/.gitlab/renovate.json5 +++ /dev/null @@ -1,23 +0,0 @@ -{ - "extends": [ - "config:recommended" - ], - "gitlabci": { - "enabled": false - }, - "lockFileMaintenance": { - "enabled": true, - "extends": [ - "schedule:monthly" - ] - }, - "nix": { - "enabled": true - }, - "postUpgradeTasks": { - "commands": [ - "nix-portable nix run .#update-package", - "nix-portable nix run .#soonix:update" - ] - } -} diff --git a/cmd/nixtest/main.go b/cmd/nixtest/main.go index 5e71553..fef12b1 100644 --- a/cmd/nixtest/main.go +++ b/cmd/nixtest/main.go @@ -3,14 +3,14 @@ package main import ( "os" - "gitlab.com/TECHNOFAB/nixtest/internal/config" - appnix "gitlab.com/TECHNOFAB/nixtest/internal/nix" - "gitlab.com/TECHNOFAB/nixtest/internal/report/console" - "gitlab.com/TECHNOFAB/nixtest/internal/report/junit" - "gitlab.com/TECHNOFAB/nixtest/internal/runner" - appsnap "gitlab.com/TECHNOFAB/nixtest/internal/snapshot" - "gitlab.com/TECHNOFAB/nixtest/internal/types" - "gitlab.com/TECHNOFAB/nixtest/internal/util" + "gitlab.com/technofab/nixtest/internal/config" + appnix "gitlab.com/technofab/nixtest/internal/nix" + "gitlab.com/technofab/nixtest/internal/report/console" + "gitlab.com/technofab/nixtest/internal/report/junit" + "gitlab.com/technofab/nixtest/internal/runner" + appsnap "gitlab.com/technofab/nixtest/internal/snapshot" + "gitlab.com/technofab/nixtest/internal/types" + "gitlab.com/technofab/nixtest/internal/util" "github.com/rs/zerolog" "github.com/rs/zerolog/log" diff --git a/flake.lock b/flake.lock index 6d5a6ab..110c517 100644 --- a/flake.lock +++ b/flake.lock @@ -1,12 +1,266 @@ { "nodes": { + "cachix": { + "inputs": { + "devenv": [ + "devenv" + ], + "flake-compat": [ + "devenv" + ], + "git-hooks": [ + "devenv" + ], + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1742042642, + "narHash": "sha256-D0gP8srrX0qj+wNYNPdtVJsQuFzIng3q43thnHXQ/es=", + "owner": "cachix", + "repo": "cachix", + "rev": "a624d3eaf4b1d225f918de8543ed739f2f574203", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "latest", + "repo": "cachix", + "type": "github" + } + }, + "devenv": { + "inputs": { + "cachix": "cachix", + "flake-compat": "flake-compat", + "git-hooks": "git-hooks", + "nix": "nix", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1746189866, + "narHash": "sha256-3sTvuSVBFcXbqg26Qcw/ENJ1s36jtzEcZ0mHqLqvWRA=", + "owner": "cachix", + "repo": "devenv", + "rev": "5fc592d45dd056035e0fd5000893a21609c35526", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1733328505, + "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "devenv", + "nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1712014858, + "narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9126214d0a59633752a136528f5f3b9aa8565b7d", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1743550720, + "narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "c621e8422220273271f52058f618c94e405bb0f5", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "git-hooks": { + "inputs": { + "flake-compat": [ + "devenv" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "devenv", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1742649964, + "narHash": "sha256-DwOTp7nvfi8mRfuL1escHDXabVXFGT1VlPD1JHrtrco=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "devenv", + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "libgit2": { + "flake": false, + "locked": { + "lastModified": 1697646580, + "narHash": "sha256-oX4Z3S9WtJlwvj0uH9HlYcWv+x1hqp8mhXl7HsLu2f0=", + "owner": "libgit2", + "repo": "libgit2", + "rev": "45fd9ed7ae1a9b74b957ef4f337bc3c8b3df01b5", + "type": "github" + }, + "original": { + "owner": "libgit2", + "repo": "libgit2", + "type": "github" + } + }, + "nix": { + "inputs": { + "flake-compat": [ + "devenv" + ], + "flake-parts": "flake-parts", + "libgit2": "libgit2", + "nixpkgs": "nixpkgs_2", + "nixpkgs-23-11": [ + "devenv" + ], + "nixpkgs-regression": [ + "devenv" + ], + "pre-commit-hooks": [ + "devenv" + ] + }, + "locked": { + "lastModified": 1745930071, + "narHash": "sha256-bYyjarS3qSNqxfgc89IoVz8cAFDkF9yPE63EJr+h50s=", + "owner": "domenkozar", + "repo": "nix", + "rev": "b455edf3505f1bf0172b39a735caef94687d0d9c", + "type": "github" + }, + "original": { + "owner": "domenkozar", + "ref": "devenv-2.24", + "repo": "nix", + "type": "github" + } + }, + "nix-devtools": { + "locked": { + "dir": "lib", + "lastModified": 1739971859, + "narHash": "sha256-DaY11jX7Lraw7mRUIsgPsO+aSkkewQe2D+WMZORTNPE=", + "owner": "technofab", + "repo": "nix-devtools", + "rev": "b4f059657de5ac2569afd69a8f042614d309e6bb", + "type": "gitlab" + }, + "original": { + "dir": "lib", + "owner": "technofab", + "repo": "nix-devtools", + "type": "gitlab" + } + }, + "nix-gitlab-ci": { + "locked": { + "dir": "lib", + "lastModified": 1746973171, + "narHash": "sha256-q/LhPZlhJB2gXZ5BfgU1Wep/1x1y9Sct3/JU8A2fzjg=", + "owner": "technofab", + "repo": "nix-gitlab-ci", + "rev": "dca2d724c155799e537a898cb9f948f8afae4921", + "type": "gitlab" + }, + "original": { + "dir": "lib", + "owner": "technofab", + "ref": "2.0.1", + "repo": "nix-gitlab-ci", + "type": "gitlab" + } + }, + "nix-mkdocs": { + "locked": { + "dir": "lib", + "lastModified": 1757055638, + "narHash": "sha256-KHYSkEreFe4meXzSdEbknC/HwaQSNClQkc8vzHlAsMM=", + "owner": "technofab", + "repo": "nixmkdocs", + "rev": "7840a5febdbeaf2da90babf6c94b3d0929d2bf74", + "type": "gitlab" + }, + "original": { + "dir": "lib", + "owner": "technofab", + "repo": "nixmkdocs", + "type": "gitlab" + } + }, "nixpkgs": { "locked": { - "lastModified": 1765472234, - "narHash": "sha256-9VvC20PJPsleGMewwcWYKGzDIyjckEz8uWmT0vCDYK0=", + "lastModified": 1733212471, + "narHash": "sha256-M1+uCoV5igihRfcUKrr1riygbe73/dzNnzPsmaLCmpo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2fbfb1d73d239d2402a8fe03963e37aab15abe8b", + "rev": "55d15ad12a74eb7d4646254e13638ad0c4128776", "type": "github" }, "original": { @@ -18,11 +272,11 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1754184128, - "narHash": "sha256-AjhoyBL4eSyXf01Bmc6DiuaMrJRNdWopmdnMY0Pa/M0=", + "lastModified": 1743296961, + "narHash": "sha256-b1EdN3cULCqtorQ4QeWgLMrd5ZGOjLSLemfa00heasc=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "02e72200e6d56494f4a7c0da8118760736e41b60", + "rev": "e4822aea2a6d1cdd36653c134cacfd64c97ff4fa", "type": "github" }, "original": { @@ -31,30 +285,113 @@ "type": "github" } }, - "ren": { - "inputs": { - "nixpkgs-lib": "nixpkgs-lib" - }, + "nixpkgs_2": { "locked": { - "dir": "lib", - "lastModified": 1758738378, - "narHash": "sha256-NjzqdvQCDDdObEBH8x/vdhbdhrIB+N9E570uCdksGHY=", - "owner": "rensa-nix", - "repo": "core", - "rev": "abe19f9f13aff41de2b63304545c87d193d19ef4", - "type": "gitlab" + "lastModified": 1717432640, + "narHash": "sha256-+f9c4/ZX5MWDOuB1rKoWj+lBNm0z0rs4CK47HBLxy1o=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "88269ab3044128b7c2f4c7d68448b2fb50456870", + "type": "github" }, "original": { - "dir": "lib", - "owner": "rensa-nix", - "repo": "core", - "type": "gitlab" + "owner": "NixOS", + "ref": "release-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1733477122, + "narHash": "sha256-qamMCz5mNpQmgBwc8SB5tVMlD5sbwVIToVZtSxMph9s=", + "owner": "cachix", + "repo": "devenv-nixpkgs", + "rev": "7bd9e84d0452f6d2e63b6e6da29fe73fac951857", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "rolling", + "repo": "devenv-nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1746152631, + "narHash": "sha256-zBuvmL6+CUsk2J8GINpyy8Hs1Zp4PP6iBWSmZ4SCQ/s=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "032bc6539bd5f14e9d0c51bd79cfe9a055b094c3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_5": { + "locked": { + "lastModified": 1745377448, + "narHash": "sha256-jhZDfXVKdD7TSEGgzFJQvEEZ2K65UMiqW5YJ2aIqxMA=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "507b63021ada5fee621b6ca371c4fca9ca46f52c", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" } }, "root": { "inputs": { - "nixpkgs": "nixpkgs", - "ren": "ren" + "devenv": "devenv", + "flake-parts": "flake-parts_2", + "nix-devtools": "nix-devtools", + "nix-gitlab-ci": "nix-gitlab-ci", + "nix-mkdocs": "nix-mkdocs", + "nixpkgs": "nixpkgs_4", + "systems": "systems", + "treefmt-nix": "treefmt-nix" + } + }, + "systems": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": "nixpkgs_5" + }, + "locked": { + "lastModified": 1746216483, + "narHash": "sha256-4h3s1L/kKqt3gMDcVfN8/4v2jqHrgLIe4qok4ApH5x4=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "29ec5026372e0dec56f890e50dbe4f45930320fd", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index fec8334..72e77cc 100644 --- a/flake.nix +++ b/flake.nix @@ -1,39 +1,240 @@ { - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - ren.url = "gitlab:rensa-nix/core?dir=lib"; - }; - outputs = { - ren, - self, + flake-parts, + systems, ... } @ inputs: - ren.buildWith - { - inherit inputs; - cellsFrom = ./nix; - transformInputs = system: i: - i - // { - pkgs = import i.nixpkgs {inherit system;}; + flake-parts.lib.mkFlake {inherit inputs;} { + imports = [ + inputs.devenv.flakeModule + inputs.treefmt-nix.flakeModule + inputs.nix-gitlab-ci.flakeModule + inputs.nix-devtools.flakeModule + inputs.nix-mkdocs.flakeModule + ]; + systems = import systems; + flake = {}; + perSystem = { + lib, + pkgs, + self', + config, + ... + }: { + treefmt = { + projectRootFile = "flake.nix"; + programs = { + alejandra.enable = true; + mdformat.enable = true; + gofmt.enable = true; + }; + settings.formatter.mdformat.command = let + pkg = pkgs.python3.withPackages (p: [ + p.mdformat + p.mdformat-mkdocs + ]); + in "${pkg}/bin/mdformat"; }; - cellBlocks = with ren.blocks; [ - (simple "devShells") - (simple "ci") - (simple "tests") - (simple "packages") - (simple "docs") - (simple "soonix") - ]; - } - { - packages = ren.select self [ - ["repo" "ci" "packages"] - ["repo" "tests"] - ["packages" "packages"] - ["repo" "docs"] - ["repo" "soonix" "packages"] - ]; + devenv.shells.default = { + containers = pkgs.lib.mkForce {}; + packages = with pkgs; [gore go-junit-report]; + + languages.go = { + enable = true; + enableHardeningWorkaround = true; + }; + + pre-commit.hooks = { + treefmt = { + enable = true; + packageOverrides.treefmt = config.treefmt.build.wrapper; + }; + convco.enable = true; + }; + + task = { + enable = true; + alias = ","; + tasks = { + "test" = { + cmds = [ + "go test -v -coverprofile cover.out ./..." + "go tool cover -html cover.out -o cover.html" + ]; + }; + }; + }; + }; + + docs."default".config = { + path = ./docs; + material = { + enable = true; + colors = { + primary = "green"; + accent = "light green"; + }; + umami = { + enable = true; + src = "https://analytics.tf/umami"; + siteId = "716d1869-9342-4b62-a770-e15d2d5c807d"; + domains = ["nixtest.projects.tf"]; + }; + }; + macros = { + enable = true; + includeDir = toString self'.packages.optionsDocs; + }; + config = { + site_name = "Nixtest"; + site_url = "https://nixtest.projects.tf"; + repo_name = "TECHNOFAB/nixtest"; + repo_url = "https://gitlab.com/TECHNOFAB/nixtest"; + extra_css = ["style.css"]; + theme = { + icon.repo = "simple/gitlab"; + logo = "images/logo.svg"; + favicon = "images/logo.svg"; + }; + nav = [ + {"Introduction" = "index.md";} + {"Usage" = "usage.md";} + {"Reference" = "reference.md";} + {"CLI" = "cli.md";} + {"Example Configs" = "examples.md";} + {"Options" = "options.md";} + ]; + markdown_extensions = [ + "pymdownx.superfences" + "admonition" + ]; + }; + }; + + ci = { + stages = ["test" "build" "deploy"]; + jobs = { + "test:lib" = { + stage = "test"; + script = [ + "nix run .#tests -- --junit=junit.xml" + ]; + allow_failure = true; + artifacts = { + when = "always"; + reports.junit = "junit.xml"; + }; + }; + "test:go" = { + stage = "test"; + nix.deps = with pkgs; [go go-junit-report gocover-cobertura]; + variables = { + GOPATH = "$CI_PROJECT_DIR/.go"; + GOCACHE = "$CI_PROJECT_DIR/.go/pkg/mod"; + }; + script = [ + "go test -coverprofile=coverage.out -v 2>&1 ./... | go-junit-report -set-exit-code > report.xml" + "go tool cover -func coverage.out" + "gocover-cobertura < coverage.out > coverage.xml" + ]; + allow_failure = true; + coverage = "/\(statements\)(?:\s+)?(\d+(?:\.\d+)?%)/"; + cache.paths = [".go/pkg/mod/"]; + artifacts = { + when = "always"; + reports = { + junit = "report.xml"; + coverage_report = { + coverage_format = "cobertura"; + path = "coverage.xml"; + }; + }; + }; + }; + "docs" = { + stage = "build"; + script = [ + # sh + '' + nix build .#docs:default + mkdir -p public + cp -r result/. public/ + '' + ]; + artifacts.paths = ["public"]; + }; + "pages" = { + nix.enable = false; + image = "alpine:latest"; + stage = "deploy"; + script = ["true"]; + artifacts.paths = ["public"]; + rules = [ + { + "if" = "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"; + } + ]; + }; + }; + }; + + packages = let + ntlib = import ./lib {inherit pkgs lib;}; + doclib = inputs.nix-mkdocs.lib {inherit lib pkgs;}; + in rec { + default = pkgs.callPackage ./package.nix {}; + tests = ntlib.mkNixtest { + modules = ntlib.autodiscover {dir = ./tests;}; + args = { + inherit pkgs ntlib; + }; + }; + optionsDoc = doclib.mkOptionDocs { + module = { + _module.args.pkgs = pkgs; + imports = [ + ntlib.module + ]; + }; + roots = [ + { + url = "https://gitlab.com/TECHNOFAB/nixtest/-/blob/main/lib"; + path = toString ./lib; + } + ]; + }; + optionsDocs = pkgs.runCommand "options-docs" {} '' + mkdir -p $out + ln -s ${optionsDoc} $out/options.md + ''; + }; + }; }; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + + # flake & devenv related + flake-parts.url = "github:hercules-ci/flake-parts"; + systems.url = "github:nix-systems/default-linux"; + devenv.url = "github:cachix/devenv"; + treefmt-nix.url = "github:numtide/treefmt-nix"; + nix-gitlab-ci.url = "gitlab:technofab/nix-gitlab-ci/2.0.1?dir=lib"; + nix-devtools.url = "gitlab:technofab/nix-devtools?dir=lib"; + nix-mkdocs.url = "gitlab:technofab/nixmkdocs?dir=lib"; + }; + + nixConfig = { + extra-substituters = [ + "https://cache.nixos.org/" + "https://nix-community.cachix.org" + "https://devenv.cachix.org" + ]; + + extra-trusted-public-keys = [ + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=" + ]; + }; } diff --git a/go.mod b/go.mod index b35c7f4..bb9e578 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module gitlab.com/TECHNOFAB/nixtest +module gitlab.com/technofab/nixtest go 1.23.0 diff --git a/internal/nix/service.go b/internal/nix/service.go index a3551d3..40461f9 100644 --- a/internal/nix/service.go +++ b/internal/nix/service.go @@ -8,7 +8,7 @@ import ( "os/exec" "strings" - apperrors "gitlab.com/TECHNOFAB/nixtest/internal/errors" + apperrors "gitlab.com/technofab/nixtest/internal/errors" ) // Service defines operations related to Nix diff --git a/internal/nix/service_test.go b/internal/nix/service_test.go index 781a8cd..0df0658 100644 --- a/internal/nix/service_test.go +++ b/internal/nix/service_test.go @@ -10,7 +10,7 @@ import ( "strings" "testing" - apperrors "gitlab.com/TECHNOFAB/nixtest/internal/errors" + apperrors "gitlab.com/technofab/nixtest/internal/errors" ) func TestHelperProcess(t *testing.T) { diff --git a/internal/report/console/console.go b/internal/report/console/console.go index efca37f..959741c 100644 --- a/internal/report/console/console.go +++ b/internal/report/console/console.go @@ -11,8 +11,8 @@ import ( "github.com/jedib0t/go-pretty/v6/text" "github.com/rs/zerolog/log" "github.com/sergi/go-diff/diffmatchpatch" - "gitlab.com/TECHNOFAB/nixtest/internal/types" - "gitlab.com/TECHNOFAB/nixtest/internal/util" + "gitlab.com/technofab/nixtest/internal/types" + "gitlab.com/technofab/nixtest/internal/util" ) // PrintErrors prints error messages for failed tests diff --git a/internal/report/console/console_test.go b/internal/report/console/console_test.go index d562de4..bbe9a6a 100644 --- a/internal/report/console/console_test.go +++ b/internal/report/console/console_test.go @@ -12,7 +12,7 @@ import ( "time" "github.com/jedib0t/go-pretty/v6/text" - "gitlab.com/TECHNOFAB/nixtest/internal/types" + "gitlab.com/technofab/nixtest/internal/types" ) // captureOutput captures stdout and stderr during the execution of a function diff --git a/internal/report/junit/junit.go b/internal/report/junit/junit.go index be2fcb3..a376600 100644 --- a/internal/report/junit/junit.go +++ b/internal/report/junit/junit.go @@ -7,8 +7,8 @@ import ( "strings" "time" - "gitlab.com/TECHNOFAB/nixtest/internal/types" - "gitlab.com/TECHNOFAB/nixtest/internal/util" + "gitlab.com/technofab/nixtest/internal/types" + "gitlab.com/technofab/nixtest/internal/util" ) type JUnitReport struct { diff --git a/internal/report/junit/junit_test.go b/internal/report/junit/junit_test.go index afccbb5..fbca0aa 100644 --- a/internal/report/junit/junit_test.go +++ b/internal/report/junit/junit_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "gitlab.com/TECHNOFAB/nixtest/internal/types" + "gitlab.com/technofab/nixtest/internal/types" ) func formatDurationSeconds(d time.Duration) string { diff --git a/internal/runner/runner.go b/internal/runner/runner.go index 8ccb8df..99783e9 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -9,10 +9,10 @@ import ( "time" "github.com/rs/zerolog/log" - "gitlab.com/TECHNOFAB/nixtest/internal/nix" - "gitlab.com/TECHNOFAB/nixtest/internal/snapshot" - "gitlab.com/TECHNOFAB/nixtest/internal/types" - "gitlab.com/TECHNOFAB/nixtest/internal/util" + "gitlab.com/technofab/nixtest/internal/nix" + "gitlab.com/technofab/nixtest/internal/snapshot" + "gitlab.com/technofab/nixtest/internal/types" + "gitlab.com/technofab/nixtest/internal/util" ) // Runner executes tests based on provided specifications and configuration diff --git a/internal/runner/runner_test.go b/internal/runner/runner_test.go index 582c2c1..2bbffa6 100644 --- a/internal/runner/runner_test.go +++ b/internal/runner/runner_test.go @@ -9,8 +9,8 @@ import ( "testing" "time" - apperrors "gitlab.com/TECHNOFAB/nixtest/internal/errors" - "gitlab.com/TECHNOFAB/nixtest/internal/types" + apperrors "gitlab.com/technofab/nixtest/internal/errors" + "gitlab.com/technofab/nixtest/internal/types" ) // --- Mock Service Implementations --- diff --git a/internal/snapshot/service.go b/internal/snapshot/service.go index 72f8802..932ece8 100644 --- a/internal/snapshot/service.go +++ b/internal/snapshot/service.go @@ -7,8 +7,8 @@ import ( "path/filepath" "strings" - apperrors "gitlab.com/TECHNOFAB/nixtest/internal/errors" - "gitlab.com/TECHNOFAB/nixtest/internal/util" + apperrors "gitlab.com/technofab/nixtest/internal/errors" + "gitlab.com/technofab/nixtest/internal/util" ) // Service defines operations related to test snapshots diff --git a/internal/snapshot/service_test.go b/internal/snapshot/service_test.go index b82b070..9a1f4bb 100644 --- a/internal/snapshot/service_test.go +++ b/internal/snapshot/service_test.go @@ -9,7 +9,7 @@ import ( "strings" "testing" - apperrors "gitlab.com/TECHNOFAB/nixtest/internal/errors" + apperrors "gitlab.com/technofab/nixtest/internal/errors" ) func TestDefaultService_GetPath(t *testing.T) { diff --git a/internal/util/util.go b/internal/util/util.go index 9916a75..63e7252 100644 --- a/internal/util/util.go +++ b/internal/util/util.go @@ -8,7 +8,7 @@ import ( "github.com/akedrou/textdiff" "github.com/akedrou/textdiff/myers" - apperrors "gitlab.com/TECHNOFAB/nixtest/internal/errors" + apperrors "gitlab.com/technofab/nixtest/internal/errors" ) func ComputeDiff(expected, actual string) (string, error) { diff --git a/internal/util/util_test.go b/internal/util/util_test.go index fa76a20..0928c06 100644 --- a/internal/util/util_test.go +++ b/internal/util/util_test.go @@ -8,7 +8,7 @@ import ( "strings" "testing" - apperrors "gitlab.com/TECHNOFAB/nixtest/internal/errors" + apperrors "gitlab.com/technofab/nixtest/internal/errors" ) func TestComputeDiff(t *testing.T) { diff --git a/nix/packages/packages.nix b/nix/packages/packages.nix deleted file mode 100644 index 9174657..0000000 --- a/nix/packages/packages.nix +++ /dev/null @@ -1,8 +0,0 @@ -{inputs, ...}: let - inherit (inputs) self pkgs; -in { - nixtest = pkgs.callPackage "${self}/package.nix" {}; - update-package = pkgs.writeShellScriptBin "update-package" '' - ${pkgs.nix-update}/bin/nix-update nixtest --flake --version skip - ''; -} diff --git a/nix/repo/ci.nix b/nix/repo/ci.nix deleted file mode 100644 index 010c4ad..0000000 --- a/nix/repo/ci.nix +++ /dev/null @@ -1,85 +0,0 @@ -{inputs, ...}: let - inherit (inputs) pkgs cilib; -in - cilib.mkCI { - pipelines."default" = { - stages = ["test" "build" "deploy"]; - jobs = { - "test:lib" = { - stage = "test"; - script = [ - "nix run .#tests -- --junit=junit.xml" - ]; - allow_failure = true; - artifacts = { - when = "always"; - reports.junit = "junit.xml"; - }; - }; - "test:go" = { - stage = "test"; - nix.deps = with pkgs; [gcc go go-junit-report gocover-cobertura]; - variables = { - GOPATH = "$CI_PROJECT_DIR/.go"; - GOCACHE = "$CI_PROJECT_DIR/.go/pkg/mod"; - }; - script = [ - # sh - '' - set +e - go test -coverprofile=coverage.out -v 2>&1 ./... | go-junit-report -set-exit-code > report.xml - TEST_EXIT_CODE=$? - go tool cover -func coverage.out - gocover-cobertura < coverage.out > coverage.xml - - exit $TEST_EXIT_CODE - '' - ]; - allow_failure = true; - coverage = "/\(statements\)(?:\s+)?(\d+(?:\.\d+)?%)/"; - cache.paths = [".go/pkg/mod/"]; - artifacts = { - when = "always"; - reports = { - junit = "report.xml"; - coverage_report = { - coverage_format = "cobertura"; - path = "coverage.xml"; - }; - }; - }; - }; - "build" = { - stage = "build"; - script = [ - # sh - "nix build .#nixtest" - ]; - }; - "docs" = { - stage = "build"; - script = [ - # sh - '' - nix build .#docs:default - mkdir -p public - cp -r result/. public/ - '' - ]; - artifacts.paths = ["public"]; - }; - "pages" = { - nix.enable = false; - image = "alpine:latest"; - stage = "deploy"; - script = ["true"]; - artifacts.paths = ["public"]; - rules = [ - { - "if" = "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"; - } - ]; - }; - }; - }; - } diff --git a/nix/repo/devShells.nix b/nix/repo/devShells.nix deleted file mode 100644 index 1f425c9..0000000 --- a/nix/repo/devShells.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - inputs, - cell, - ... -}: let - inherit (inputs) pkgs devshell treefmt; - inherit (cell) soonix; -in { - default = devshell.mkShell { - imports = [soonix.devshellModule]; - packages = with pkgs; [ - (treefmt.mkWrapper pkgs { - programs = { - alejandra.enable = true; - mdformat.enable = true; - gofmt.enable = true; - }; - settings.formatter.mdformat.command = let - pkg = pkgs.python3.withPackages (p: [ - p.mdformat - p.mdformat-mkdocs - ]); - in "${pkg}/bin/mdformat"; - }) - gcc - go - gopls - delve - go-junit-report - gocover-cobertura - ]; - }; -} diff --git a/nix/repo/docs.nix b/nix/repo/docs.nix deleted file mode 100644 index f8aea5c..0000000 --- a/nix/repo/docs.nix +++ /dev/null @@ -1,64 +0,0 @@ -{inputs, ...}: let - inherit (inputs) pkgs doclib ntlib; - - optionsDoc = doclib.mkOptionDocs { - module = ntlib.module; - roots = [ - { - url = "https://gitlab.com/TECHNOFAB/nixtest/-/blob/main/lib"; - path = "${inputs.self}/lib"; - } - ]; - }; - optionsDocs = pkgs.runCommand "options-docs" {} '' - mkdir -p $out - ln -s ${optionsDoc} $out/options.md - ''; -in - (doclib.mkDocs { - docs."default" = { - base = "${inputs.self}"; - path = "${inputs.self}/docs"; - material = { - enable = true; - colors = { - primary = "green"; - accent = "light green"; - }; - umami = { - enable = true; - src = "https://analytics.tf/umami"; - siteId = "716d1869-9342-4b62-a770-e15d2d5c807d"; - domains = ["nixtest.projects.tf"]; - }; - }; - macros = { - enable = true; - includeDir = toString optionsDocs; - }; - config = { - site_name = "Nixtest"; - site_url = "https://nixtest.projects.tf"; - repo_name = "TECHNOFAB/nixtest"; - repo_url = "https://gitlab.com/TECHNOFAB/nixtest"; - extra_css = ["style.css"]; - theme = { - logo = "images/logo.svg"; - icon.repo = "simple/gitlab"; - favicon = "images/logo.svg"; - }; - nav = [ - {"Introduction" = "index.md";} - {"Usage" = "usage.md";} - {"Reference" = "reference.md";} - {"CLI" = "cli.md";} - {"Example Configs" = "examples.md";} - {"Options" = "options.md";} - ]; - markdown_extensions = [ - "pymdownx.superfences" - "admonition" - ]; - }; - }; - }).packages diff --git a/nix/repo/flake.lock b/nix/repo/flake.lock deleted file mode 100644 index 930798e..0000000 --- a/nix/repo/flake.lock +++ /dev/null @@ -1,100 +0,0 @@ -{ - "nodes": { - "devshell-lib": { - "locked": { - "dir": "lib", - "lastModified": 1758204313, - "narHash": "sha256-ainbY0Oajb1HMdvy+A8QxF/P5qwcbEzJGEY5pzKdDdc=", - "owner": "rensa-nix", - "repo": "devshell", - "rev": "7d0c4bc78d9f017a739b0c7eb2f4e563118353e6", - "type": "gitlab" - }, - "original": { - "dir": "lib", - "owner": "rensa-nix", - "repo": "devshell", - "type": "gitlab" - } - }, - "nix-gitlab-ci-lib": { - "locked": { - "dir": "lib", - "lastModified": 1765444672, - "narHash": "sha256-B0cMjRs9P50ym9Le0VUcRN69Yy6tbV13MXq81tTTEus=", - "owner": "TECHNOFAB", - "repo": "nix-gitlab-ci", - "rev": "8f88a53b5479773cd626420362631bc1da99e677", - "type": "gitlab" - }, - "original": { - "dir": "lib", - "owner": "TECHNOFAB", - "ref": "3.1.2", - "repo": "nix-gitlab-ci", - "type": "gitlab" - } - }, - "nixmkdocs-lib": { - "locked": { - "dir": "lib", - "lastModified": 1763481845, - "narHash": "sha256-Bp0+9rDmlPWMcnKqGx+BG4+o5KO8FuDAOvXRnXrm3Fo=", - "owner": "TECHNOFAB", - "repo": "nixmkdocs", - "rev": "73d59093df94a894d25bc4bf71880b6f00faa62f", - "type": "gitlab" - }, - "original": { - "dir": "lib", - "owner": "TECHNOFAB", - "repo": "nixmkdocs", - "type": "gitlab" - } - }, - "root": { - "inputs": { - "devshell-lib": "devshell-lib", - "nix-gitlab-ci-lib": "nix-gitlab-ci-lib", - "nixmkdocs-lib": "nixmkdocs-lib", - "soonix-lib": "soonix-lib", - "treefmt-nix": "treefmt-nix" - } - }, - "soonix-lib": { - "locked": { - "dir": "lib", - "lastModified": 1763323017, - "narHash": "sha256-MJyg37d+VMfRoFiVUj16FW+zkEwQXbgK9LoFF/SHoxA=", - "owner": "TECHNOFAB", - "repo": "soonix", - "rev": "078034b01e4eaf1f9436d46721f7cbe0d96eb8b4", - "type": "gitlab" - }, - "original": { - "dir": "lib", - "owner": "TECHNOFAB", - "repo": "soonix", - "type": "gitlab" - } - }, - "treefmt-nix": { - "flake": false, - "locked": { - "lastModified": 1762938485, - "narHash": "sha256-AlEObg0syDl+Spi4LsZIBrjw+snSVU4T8MOeuZJUJjM=", - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "5b4ee75aeefd1e2d5a1cc43cf6ba65eba75e83e4", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "treefmt-nix", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/nix/repo/flake.nix b/nix/repo/flake.nix deleted file mode 100644 index 7452c07..0000000 --- a/nix/repo/flake.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ - inputs = { - devshell-lib.url = "gitlab:rensa-nix/devshell?dir=lib"; - soonix-lib.url = "gitlab:TECHNOFAB/soonix?dir=lib"; - nix-gitlab-ci-lib.url = "gitlab:TECHNOFAB/nix-gitlab-ci/3.1.2?dir=lib"; - nixmkdocs-lib.url = "gitlab:TECHNOFAB/nixmkdocs?dir=lib"; - treefmt-nix = { - url = "github:numtide/treefmt-nix"; - flake = false; - }; - }; - outputs = i: - i - // { - devshell = i.devshell-lib.lib {inherit (i.parent) pkgs;}; - soonix = i.soonix-lib.lib {inherit (i.parent) pkgs;}; - cilib = i.nix-gitlab-ci-lib.lib {inherit (i.parent) pkgs;}; - doclib = i.nixmkdocs-lib.lib {inherit (i.parent) pkgs;}; - ntlib = import "${i.parent.self}/lib" {inherit (i.parent) pkgs;}; - treefmt = import i.treefmt-nix; - }; -} diff --git a/nix/repo/soonix.nix b/nix/repo/soonix.nix deleted file mode 100644 index 9eaab59..0000000 --- a/nix/repo/soonix.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ - inputs, - cell, - ... -}: let - inherit (inputs) soonix; - inherit (cell) ci; -in - (soonix.make { - hooks = { - ci = ci.soonix; - renovate = { - output = ".gitlab/renovate.json5"; - data = { - extends = ["config:recommended"]; - postUpgradeTasks.commands = [ - "nix-portable nix run .#update-package" - "nix-portable nix run .#soonix:update" - ]; - lockFileMaintenance = { - enabled = true; - extends = ["schedule:monthly"]; - }; - nix.enabled = true; - gitlabci.enabled = false; - }; - hook = { - mode = "copy"; - gitignore = false; - }; - opts.format = "json"; - }; - }; - }).config diff --git a/nix/repo/tests.nix b/nix/repo/tests.nix deleted file mode 100644 index 9e2e8fb..0000000 --- a/nix/repo/tests.nix +++ /dev/null @@ -1,10 +0,0 @@ -{inputs, ...}: let - inherit (inputs) pkgs ntlib; -in { - tests = ntlib.mkNixtest { - modules = ntlib.autodiscover {dir = "${inputs.self}/tests";}; - args = { - inherit pkgs ntlib; - }; - }; -} diff --git a/package.nix b/package.nix index 82976d2..cce5967 100644 --- a/package.nix +++ b/package.nix @@ -4,8 +4,7 @@ ... }: buildGoModule { - pname = "nixtest"; - version = "latest"; + name = "nixtest"; src = # filter everything except for cmd/ and go.mod, go.sum with lib.fileset; diff --git a/snapshots/pretty-snapshot.snap.json b/snapshots/pretty-snapshot.snap.json index 6349f86..d7ee4ed 100644 --- a/snapshots/pretty-snapshot.snap.json +++ b/snapshots/pretty-snapshot.snap.json @@ -1 +1 @@ -"{\n example = \u003cfunction\u003e;\n example2 = {\n drv = \u003cderivation hello-2.12.2\u003e;\n };\n}" +"{\n example = \u003cfunction\u003e;\n example2 = {\n drv = \u003cderivation hello-2.12.1\u003e;\n };\n}" \ No newline at end of file