Skip to content

Commit

Permalink
Add CI to prevent unformatted code from getting in
Browse files Browse the repository at this point in the history
Also added is a `.git-blame-ignore-revs` file (also in nixpkgs) that can
be used in a gitconfig to prevent `git blame` from showing specific
commit revs. See https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revs-fileltfilegt
for more info.
  • Loading branch information
jmbaur authored and danielfullmer committed Dec 15, 2023
1 parent b3810d2 commit 8104d25
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
da818e1101a49b1e86dc31f917502ac440630bab
15 changes: 15 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: ci
on:
workflow_dispatch: # allows manual triggering
pull_request:
branches:
- master
jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- run: nix flake check
6 changes: 6 additions & 0 deletions ci/formatting.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{ lib, runCommand, fd, nixpkgs-fmt }:

runCommand "repo-formatting" { } ''
${lib.getExe fd} . -e nix ${../.} | xargs ${lib.getExe nixpkgs-fmt} --check
touch $out
''
6 changes: 6 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@
};
};

checks = nixpkgs.lib.mapAttrs
(system: _: {
formatting = nixpkgs.legacyPackages.${system}.callPackage ./ci/formatting.nix { };
})
self.legacyPackages;

# Not everything here should be cross-compiled to aarch64-linux
legacyPackages.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.callPackage ./default.nix { };
legacyPackages.aarch64-linux = nixpkgs.legacyPackages.aarch64-linux.callPackage ./default.nix { };
Expand Down

0 comments on commit 8104d25

Please sign in to comment.