diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd55987c1b..a3be4d3653 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -224,3 +224,24 @@ jobs: with: name: git-cliff.${{ github.run_id }}-profiler-report path: git-cliff.**.flamegraph.svg + + nix-flake: + name: Build Nix flake + runs-on: ubuntu-latest + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + + - name: Install Nix + uses: nixbuild/nix-quick-install-action@v27 + + - name: Restore and cache Nix store + uses: nix-community/cache-nix-action@v5 + with: + primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix') }} + restore-prefixes-first-match: nix-${{ runner.os }}- + gc-max-store-size-linux: 1073741824 + purge: false + + - name: Check Nix flake + run: nix flake check --all-systems -Lv --show-trace diff --git a/flake.nix b/flake.nix index dee23cd2b8..f30afd7ade 100644 --- a/flake.nix +++ b/flake.nix @@ -15,7 +15,31 @@ inherit system; overlays = [ inputs.rust-overlay.overlays.rust-overlay ]; }; - in { + base-git-cliff = { buildType }: pkgs.rustPlatform.buildRustPackage { + name = "git-cliff"; + src = ./.; + cargoLock = { + lockFile = ./Cargo.lock; + }; + checkType = "debug"; + inherit buildType; + checkFlags = [ + "--skip=command" + "--skip=repo" + ]; + meta = with pkgs.lib; { + description = "A highly customizable Changelog Generator that follows Conventional Commit specifications"; + homepage = "https://git-cliff.org/"; + license = [ licenses.mit licenses.asl20 ]; + }; + }; + in rec { + packages = rec { + git-cliff = base-git-cliff { buildType = "release"; }; + git-cliff-debug = base-git-cliff { buildType = "debug"; }; + default = git-cliff; + }; + devShell = pkgs.mkShell { CARGO_INSTALL_ROOT = "${toString ./.}/.cargo"; @@ -32,5 +56,7 @@ }) ]; }; + + checks.check = packages.git-cliff-debug; }); }