Skip to content

Commit bd187f4

Browse files
committed
Ensure Nix expressions are up to date in CI
- Adds a step to the Buildkite CI to check that the Nix expressions of the project are up-to-date. If they are not, it provides a patch as an artifact that the user can download and apply with `patch -p1 < nix-expr.patch`. This was done to make it easier for non-Nix users to update the dependencies of the project.
1 parent 3726c6f commit bd187f4

File tree

4 files changed

+310
-311
lines changed

4 files changed

+310
-311
lines changed

.buildkite/pipeline.nix

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,34 @@ in
1111

1212
{
1313
steps.commands = {
14+
nixExpr = commonAttrs // {
15+
label = "ensure Nix expressions are up-to-date";
16+
command = ''
17+
echo "Checking if Nix expressions are up-to-date..."
18+
19+
nix-shell --run 'sbtix-gen-all2'
20+
21+
set +e
22+
git diff --exit-code > nix-expr.patch
23+
if [ "$?" -eq "1" ]; then
24+
set -e
25+
echo "Nix expressions not up-to-date."
26+
echo "Download and apply the patch available in the artifact paths of this step:"
27+
echo " patch -p1 < nix-expr.patch"
28+
echo "Aborting."
29+
exit 1
30+
else
31+
set -e
32+
echo "Nix expressions up-to-date!"
33+
exit 0
34+
fi
35+
'';
36+
retry.automatic = false;
37+
artifactPaths = [
38+
"nix-expr.patch"
39+
];
40+
};
41+
1442
compile = commonAttrs // {
1543
label = "compile everything";
1644
command = ''

.buildkite/shell.nix

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ pkgs }:
1+
{ sources, pkgs }:
22

33
let
44

@@ -18,13 +18,16 @@ let
1818
exec ${pkgs.protobuf}/bin/protoc "$@"
1919
'';
2020

21+
sbtix = pkgs.callPackage sources.Sbtix { };
22+
2123
in
2224

2325
with pkgs;
2426

2527
mkShell {
2628

27-
buildInputs = [ sbt solc jdk8 protoc-wrapper ];
29+
buildInputs = [ sbt solc jdk8 protoc-wrapper sbtix ];
2830
# SBT = "sbt -v -mem 2048 -J-Xmx4g -Dsbt.ivy.home=/cache/ivy2 -Dsbt.boot.directory=/cache/sbt -Dmaven.repo.local=/cache/maven -Dnix=true";
2931
SBT = "sbt -v -mem 2048 -J-Xmx4g -Dnix=true";
32+
SBTIX_GEN = "true";
3033
}

0 commit comments

Comments
 (0)