Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ jobs:
system: [ x86_64-linux, aarch64-darwin ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: om ci
run: om ci --extra-access-tokens "github.com=${{ secrets.GITHUB_TOKEN }}" run --systems "${{ matrix.system }}"
28 changes: 6 additions & 22 deletions dev/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions dev/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
flake-root.url = "github:srid/flake-root";
treefmt-nix.url = "github:numtide/treefmt-nix";
pre-commit-hooks-nix = {
Expand Down Expand Up @@ -32,6 +33,32 @@
nixpkgs-fmt.enable = true;
};
};

# TODO: Move this under `CIApps` once `omnix` supports running them automatically
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is CIApps?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Custom flake-schema that can be detected by omnix to run everything under it as custom app steps.

# CONSIDER: Generalise the script, see: https://github.com/juspay/services-flake/pull/338/files#r1773042527
apps.cz-check = rec {
meta.description = program.meta.description;
program = pkgs.writeShellApplication {
name = "cz-check";
runtimeInputs = with pkgs; [ config.pre-commit.settings.tools.commitizen git gnugrep coreutils ];
meta.description = "Verify commit messages from the default branch to HEAD follow conventional commit format";
text = ''
default_branch=$(git remote show origin | grep 'HEAD branch' | cut -d' ' -f5)

# Get the latest commit on the default branch
# rev range using the `default_branch` branch name (e.g. main..HEAD), doesn't work in Github Actions
latest_default_commit=$(git rev-parse origin/"$default_branch")

current_commit=$(git rev-parse HEAD)

if [ "$latest_default_commit" = "$current_commit" ]; then
echo "No commits to check between $default_branch and HEAD."
else
cz check --rev-range "$latest_default_commit"..HEAD
fi
Comment on lines +46 to +58
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implementation isn’t generic enough, i.e, it always assumes that the current branch is going to be merged to main, which is okay for now. We can re-think this later if we have a complicated branch tree.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'';
};
};
devShells.default = pkgs.mkShell {
packages = with pkgs; [
just
Expand Down
8 changes: 8 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@
dev = {
inherit overrideInputs;
dir = "./dev";
steps = {
custom = {
cz-check = {
type = "app";
name = "cz-check";
};
};
};
};
doc = {
dir = "./doc";
Expand Down