Skip to content

Commit

Permalink
feat(ci): add Nix CI (#939)
Browse files Browse the repository at this point in the history
  • Loading branch information
blackheaven authored Nov 6, 2024
1 parent c1f1215 commit d0848ff
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
28 changes: 27 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -32,5 +56,7 @@
})
];
};

checks.check = packages.git-cliff-debug;
});
}

0 comments on commit d0848ff

Please sign in to comment.