Skip to content

Commit

Permalink
Use CI devShell (ensure right version of jq) (#1601)
Browse files Browse the repository at this point in the history
This is fix for a subtle bug brought up in #1338 ; namely, that version
1.6 of `jq` has a bug around integer handling:

```
> nix-shell -p jq -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/976fa3369d722e76f37c77493d99829540d43845.tar.gz
> jq -n '9223372036854775807'
9223372036854776000
```

jq 1.7+ doesn't have this issue. Unfortunately, `ubuntu-latest` ships
with jq 1.6. So we need to use a special devShell.

Happily, [there is this nice GitHub
action](https://github.com/marketplace/actions/nix-develop-action),
which makes it easy!

So, we introduce a devShell with the right version of jq, and run our CI
steps there.
  • Loading branch information
noonio authored Sep 5, 2024
1 parent 3ce0af9 commit d110064
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/network-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ jobs:
name: cardano-scaling
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'

- name: Set up and use the "ci" devShell
uses: nicknovitski/nix-develop@v1
with:
arguments: ".#ci"

- name: Build docker images for netem specifically
run: |
nix build .#docker-hydra-node-for-netem
Expand Down Expand Up @@ -119,14 +124,9 @@ jobs:
if: always()
uses: actions/upload-artifact@v4
with:
name: "docker-logs-netem-loss=${{ matrix.netem_loss }},scaling_factor=${{ matrix.scaling_factor }},peers=${{ matrix.peers }}"
path: demo/docker-logs
if-no-files-found: ignore

- name: 💾 Upload build & test artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: "benchmarks-netem-loss=${{ matrix.netem_loss }},scaling_factor=${{ matrix.scaling_factor }},peers=${{ matrix.peers }}"
path: benchmarks
name: "artifacts-netem-loss=${{ matrix.netem_loss }},scaling_factor=${{ matrix.scaling_factor }},peers=${{ matrix.peers }}"
path: |
demo/docker-logs
benchmarks
demo/devnet/protocol-parameters.json
if-no-files-found: ignore
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
]);

devShells = import ./nix/hydra/shell.nix {
inherit inputs pkgs hsPkgs system compiler;
inherit inputs pkgs hsPkgs system compiler pkgsLatest;
};
};
};
Expand Down
14 changes: 14 additions & 0 deletions nix/hydra/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
, system
, pkgs
, compiler
, pkgsLatest
}:
let

Expand Down Expand Up @@ -46,6 +47,8 @@ let
pkgs.websocat
pkgs.yarn
pkgs.yq
# Use latest jq in all shells, to avoid 1.6 bug with large integers.
pkgsLatest.jq
];

libs = [
Expand Down Expand Up @@ -131,6 +134,16 @@ let
];
};

# Shell for CI activities
ciShell = pkgs.mkShell {
name = "hydra-ci-shell";
buildInputs = [
# Note: jq 1.6 has a bug that means it fails to read large integers
# correctly, so we require 1.7+ at least.
pkgsLatest.jq
];
};

# If you want to modify `Python` code add `libtmux` and pyyaml to the
# `buildInputs` then enter it and then run `Python` module directly so you
# have fast devel cycle.
Expand All @@ -145,4 +158,5 @@ in
cabalOnly = cabalShell;
exes = exeShell;
demo = demoShell;
ci = ciShell;
}

0 comments on commit d110064

Please sign in to comment.