Skip to content

Commit ebc1f7c

Browse files
authored
Merge pull request #763 from input-output-hk/test/antithesis
Add Antithesis testing infrastructure for Leios consensus
2 parents 160323c + 3ed6df5 commit ebc1f7c

36 files changed

+3561
-146
lines changed
Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
name: "antithesis-leios"
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "antithesis/**"
7+
push:
8+
branches:
9+
- main
10+
paths:
11+
- "antithesis/**"
12+
workflow_dispatch:
13+
inputs:
14+
push_images:
15+
description: 'Push images to GHCR'
16+
required: false
17+
default: 'false'
18+
type: boolean
19+
20+
env:
21+
REGISTRY: ghcr.io
22+
IMAGE_PREFIX: ${{ github.repository }}
23+
24+
jobs:
25+
build-images:
26+
name: "Build Antithesis Docker images"
27+
runs-on: ubuntu-22.04
28+
permissions:
29+
contents: read
30+
packages: write
31+
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
35+
36+
- name: Set up Docker Buildx
37+
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
38+
39+
- name: Log in to Container Registry
40+
if: github.event_name == 'push' || github.event.inputs.push_images == 'true'
41+
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
42+
with:
43+
registry: ${{ env.REGISTRY }}
44+
username: ${{ github.actor }}
45+
password: ${{ secrets.GITHUB_TOKEN }}
46+
47+
- name: Extract metadata for cardano-node-leios
48+
id: meta-cardano-node
49+
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
50+
with:
51+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/cardano-node-leios
52+
tags: |
53+
type=sha
54+
type=ref,event=branch
55+
type=ref,event=pr
56+
57+
- name: Build cardano-node-leios image
58+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6
59+
with:
60+
context: .
61+
file: ./antithesis/Dockerfile.cardano-node
62+
platforms: linux/amd64
63+
push: ${{ github.event_name == 'push' || github.event.inputs.push_images == 'true' }}
64+
tags: ${{ steps.meta-cardano-node.outputs.tags }}
65+
labels: ${{ steps.meta-cardano-node.outputs.labels }}
66+
cache-from: type=gha,scope=cardano-node-leios
67+
cache-to: type=gha,mode=max,scope=cardano-node-leios
68+
69+
- name: Extract metadata for cardano-node-bp
70+
id: meta-cardano-node-bp
71+
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
72+
with:
73+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/cardano-node-bp
74+
tags: |
75+
type=sha
76+
type=ref,event=branch
77+
type=ref,event=pr
78+
79+
- name: Build cardano-node-bp image
80+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6
81+
with:
82+
context: .
83+
file: ./antithesis/Dockerfile.cardano-node-bp
84+
platforms: linux/amd64
85+
push: ${{ github.event_name == 'push' || github.event.inputs.push_images == 'true' }}
86+
tags: ${{ steps.meta-cardano-node-bp.outputs.tags }}
87+
labels: ${{ steps.meta-cardano-node-bp.outputs.labels }}
88+
cache-from: type=gha,scope=cardano-node-bp
89+
cache-to: type=gha,mode=max,scope=cardano-node-bp
90+
91+
- name: Extract metadata for immdb-server
92+
id: meta-immdb-server
93+
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
94+
with:
95+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/immdb-server
96+
tags: |
97+
type=sha
98+
type=ref,event=branch
99+
type=ref,event=pr
100+
101+
- name: Build immdb-server image
102+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6
103+
with:
104+
context: .
105+
file: ./antithesis/Dockerfile.immdb-server
106+
platforms: linux/amd64
107+
push: ${{ github.event_name == 'push' || github.event.inputs.push_images == 'true' }}
108+
tags: ${{ steps.meta-immdb-server.outputs.tags }}
109+
labels: ${{ steps.meta-immdb-server.outputs.labels }}
110+
cache-from: type=gha,scope=immdb-server
111+
cache-to: type=gha,mode=max,scope=immdb-server
112+
113+
- name: Extract metadata for analysis
114+
id: meta-analysis
115+
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
116+
with:
117+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/leios-analysis
118+
tags: |
119+
type=sha
120+
type=ref,event=branch
121+
type=ref,event=pr
122+
123+
- name: Build analysis image
124+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6
125+
with:
126+
context: .
127+
file: ./antithesis/Dockerfile.analysis
128+
platforms: linux/amd64
129+
push: ${{ github.event_name == 'push' || github.event.inputs.push_images == 'true' }}
130+
tags: ${{ steps.meta-analysis.outputs.tags }}
131+
labels: ${{ steps.meta-analysis.outputs.labels }}
132+
cache-from: type=gha,scope=leios-analysis
133+
cache-to: type=gha,mode=max,scope=leios-analysis
134+
135+
test-local:
136+
name: "Test local docker-compose stack"
137+
runs-on: ubuntu-22.04
138+
needs: build-images
139+
timeout-minutes: 120
140+
141+
steps:
142+
- name: Checkout repository
143+
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
144+
145+
- name: Set up Docker Buildx
146+
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
147+
148+
- name: Run local test
149+
working-directory: ./antithesis
150+
run: |
151+
./scripts/test-local.sh
152+
env:
153+
TEST_DURATION: 30
154+
STARTUP_TIMEOUT: 300
155+
ENABLE_WAN_EMULATION: true
156+
157+
# ==========================================================================
158+
# Submit to Antithesis via Moog
159+
# ==========================================================================
160+
# Requires the following GitHub configuration:
161+
#
162+
# Secrets:
163+
# MOOG_GITHUB_PAT - GitHub PAT for Moog API access
164+
# MOOG_REQUESTER_WALLET - Base64-encoded Cardano preprod wallet JSON
165+
#
166+
# Variables:
167+
# MOOG_MPFS_HOST - MPFS service URL (default: https://mpfs.plutimus.com)
168+
# MOOG_REQUESTER - GitHub username registered as Moog requester
169+
#
170+
# Prerequisites:
171+
# - Requester registered with Moog (Ed25519 keypair, CODEOWNERS entry)
172+
# - CF Moog agent has whitelisted this repository
173+
#
174+
submit-antithesis:
175+
name: "Submit Antithesis test via Moog"
176+
runs-on: ubuntu-latest
177+
needs: build-images
178+
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && secrets.MOOG_GITHUB_PAT != ''
179+
permissions:
180+
contents: read
181+
182+
steps:
183+
- name: Checkout repository
184+
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
185+
186+
- name: Get latest Moog release tag
187+
id: moog-release
188+
run: |
189+
TAG=$(gh api repos/cardano-foundation/moog/releases/latest --jq '.tag_name')
190+
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
191+
echo "Moog release: $TAG"
192+
env:
193+
GH_TOKEN: ${{ secrets.MOOG_GITHUB_PAT }}
194+
195+
- name: Download and install Moog
196+
run: |
197+
gh release download "$MOOG_TAG" \
198+
-R cardano-foundation/moog \
199+
-p "moog-*-linux64.tar.gz" -O moog.tar.gz
200+
tar xzf moog.tar.gz
201+
sudo mv moog /usr/local/bin/
202+
moog --version
203+
env:
204+
GH_TOKEN: ${{ secrets.MOOG_GITHUB_PAT }}
205+
MOOG_TAG: ${{ steps.moog-release.outputs.tag }}
206+
207+
- name: Configure wallet
208+
run: echo "$MOOG_WALLET" | base64 -d > wallet.json
209+
env:
210+
MOOG_WALLET: ${{ secrets.MOOG_REQUESTER_WALLET }}
211+
212+
- name: Submit test to Antithesis
213+
run: |
214+
echo "Submitting Antithesis test for commit ${GITHUB_SHA}..."
215+
moog requester create-test \
216+
-d "antithesis/testnets/leios-devnet" \
217+
-c "${GITHUB_SHA}" \
218+
-r "${GITHUB_REPOSITORY}" \
219+
-t 30
220+
env:
221+
MOOG_GITHUB_PAT: ${{ secrets.MOOG_GITHUB_PAT }}
222+
MOOG_WALLET_FILE: wallet.json
223+
MOOG_MPFS_HOST: ${{ vars.MOOG_MPFS_HOST || 'https://mpfs.plutimus.com' }}
224+
MOOG_PLATFORM: github
225+
MOOG_REQUESTER: ${{ vars.MOOG_REQUESTER }}

antithesis/Dockerfile

Lines changed: 0 additions & 33 deletions
This file was deleted.

antithesis/Dockerfile.analysis

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dockerfile for Python analysis sidecar
2+
# Part of Leios Antithesis project
3+
4+
FROM python:3.11-slim
5+
6+
# Install pip dependencies
7+
RUN pip install --no-cache-dir pandas matplotlib antithesis
8+
9+
# Create working directory
10+
WORKDIR /app
11+
12+
# Copy analysis scripts
13+
COPY antithesis/analyse.py /app/analyse.py
14+
COPY antithesis/entrypoint-analysis.py /app/entrypoint-analysis.py
15+
16+
# Make entrypoint executable
17+
RUN chmod +x /app/entrypoint-analysis.py
18+
19+
# Set entrypoint to the analysis script
20+
ENTRYPOINT ["python", "-u", "/app/entrypoint-analysis.py"]

antithesis/Dockerfile.cardano-node

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
FROM ghcr.io/blinklabs-io/haskell:9.6.6-3.12.1.0-3 AS cardano-node-build
2+
3+
RUN echo "Building leios-prototype branch..." \
4+
&& git clone https://github.com/intersectmbo/cardano-node.git \
5+
&& cd cardano-node \
6+
&& git fetch --all --recurse-submodules --tags \
7+
&& git checkout leios-prototype \
8+
&& echo "with-compiler: ghc-${GHC_VERSION}" >> cabal.project.local \
9+
&& echo "tests: False" >> cabal.project.local \
10+
&& cabal update \
11+
&& cabal install exe:cardano-node --install-method=copy --installdir=/root/.local/bin/ \
12+
&& rm -rf /root/.cabal/packages \
13+
&& rm -rf /usr/local/lib/ghc-${GHC_VERSION}/ /usr/local/share/doc/ghc-${GHC_VERSION}/ \
14+
&& rm -rf dist-newstyle/ \
15+
&& rm -rf /root/.cabal/store/ghc-${GHC_VERSION}
16+
17+
FROM debian:bookworm-slim AS cardano-node-leios
18+
19+
ENV LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
20+
ENV PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
21+
22+
COPY --from=cardano-node-build /usr/local/lib/ /usr/local/lib/
23+
COPY --from=cardano-node-build /usr/local/include/ /usr/local/include/
24+
COPY --from=cardano-node-build /root/.local/bin/cardano-* /usr/local/bin/
25+
26+
RUN apt-get update -y && \
27+
apt-get install -y \
28+
bc \
29+
curl \
30+
iproute2 \
31+
jq \
32+
libffi8 \
33+
libgmp10 \
34+
liblmdb0 \
35+
libncursesw5 \
36+
libnuma1 \
37+
libsystemd0 \
38+
libssl3 \
39+
libtinfo6 \
40+
llvm-14-runtime \
41+
lsof \
42+
netbase \
43+
pkg-config \
44+
procps \
45+
socat \
46+
sqlite3 \
47+
wget \
48+
zlib1g && \
49+
rm -rf /var/lib/apt/lists/* && \
50+
ldconfig
51+
52+
# Create directories for Leios
53+
RUN mkdir -p /app/config /app/genesis /app/scripts /data /logs
54+
55+
# Copy genesis files (baked in)
56+
COPY demo/2025-11/data/2025-10-10-13-29-24641-1050-50-blocks-50-coay-sup/genesis/*.json /app/genesis/
57+
58+
# Copy config files
59+
COPY demo/2025-11/data/node0/config.json /app/config/node0-config.json
60+
COPY demo/2025-11/data/downstream-node/config.json /app/config/downstream-config.json
61+
COPY demo/2025-11/data/topology.template.json /app/config/topology.template.json
62+
63+
# Copy scripts
64+
COPY antithesis/scripts/init-node0.sh /app/scripts/
65+
COPY antithesis/scripts/init-downstream.sh /app/scripts/
66+
COPY antithesis/scripts/run-cardano-node.sh /app/scripts/
67+
COPY antithesis/scripts/setup-wan-emulation.sh /app/scripts/
68+
69+
RUN chmod +x /app/scripts/*.sh /usr/local/bin/*
70+
71+
WORKDIR /data
72+
73+
CMD ["/app/scripts/run-cardano-node.sh", "node0"]

0 commit comments

Comments
 (0)