Skip to content

Commit

Permalink
feat: add Nix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
blackheaven committed Oct 29, 2024
1 parent 0fabf22 commit 497890e
Show file tree
Hide file tree
Showing 2 changed files with 57 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
37 changes: 36 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,40 @@
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=run_os_command"
"--skip=git_tags"
"--skip=git_upstream_remote"
"--skip=includes_root_commit"
"--skip=resolves_existing_tag_with_name_and_message"
"--skip=resolves_tag_when_no_tags_exist"
"--skip=test_should_retain_commit"
"--skip=commit_search"
"--skip=get_latest_commit"
"--skip=get_latest_tag"

];
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 +65,7 @@
})
];
};

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

0 comments on commit 497890e

Please sign in to comment.