Skip to content

Commit 6bb715f

Browse files
committed
ci: binary artifact test, wip
1 parent cf906d2 commit 6bb715f

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Check binary artifact startup
2+
3+
on:
4+
pull_request:
5+
6+
defaults:
7+
run:
8+
shell: bash
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Install Nix
15+
uses: cachix/install-nix-action@v31
16+
with:
17+
# Use last stable nixos channel and the same nix as in channel:
18+
nix_path: nixpkgs=channel:nixos-24.11
19+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
20+
extra_nix_config: |
21+
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
22+
experimental-features = nix-command flakes
23+
allow-import-from-derivation = true
24+
substituters = https://cache.nixos.org https://cache.iog.io
25+
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
26+
27+
- uses: actions/checkout@v4
28+
29+
- name: Obtain the linux binary artifact
30+
run: |
31+
nix --version
32+
time nix build --accept-flake-config .#hydraJobs.x86_64-linux.musl.cardano-node-linux
33+
34+
- name: Test the linux binary artifact startup
35+
run: |
36+
TIMEOUT="20"
37+
ENVS=(
38+
"mainnet"
39+
"preprod"
40+
"preview"
41+
)
42+
43+
echo "::group::Expand the artifact..."
44+
tar -zxvf result/cardano-node-*-linux.tar.gz
45+
echo "::group::"
46+
47+
for ENV in "${ENVS[@]}"; do
48+
echo "::group::Test artifact startup with $ENV for $TIMEOUT seconds"
49+
set +e
50+
timeout "$TIMEOUT" ./bin/cardano-node run \
51+
--config "./share/$ENV/config.json" \
52+
--topology "./share/$ENV/topology.json" \
53+
--database-path "db-$ENV" \
54+
--socket-path "node-$ENV.socket" \
55+
| grep 'Chain extended'
56+
RC="$?"
57+
set -e
58+
echo "::group::"
59+
60+
if [ "$RC" -eq 124 ]; then
61+
echo "Artifact startup for $ENV succeeded."
62+
elif [ "$RC" -eq 0 ]; then
63+
echo "Artifact startup for $ENV exited early; this is unexpected."
64+
exit 1
65+
else
66+
echo "Artifact startup for $ENV exited with error code $RC."
67+
exit 1
68+
fi
69+
done

0 commit comments

Comments
 (0)