Skip to content

Test cardano-node

Test cardano-node #655

Workflow file for this run

name: "Test cardano-node"
env:
TESTNET: "cardano_node_master"
REGISTRY: ghcr.io/cardano-foundation/antithesis
EMAILS: '[email protected]'
DEFAULT_DURATION: 300 # in minutes
on:
# can be dispatched manually
workflow_dispatch:
inputs:
test:
description: 'Test configuration to run (a directory in compose/testnets)'
required: true
default: cardano_node_master
type: string
duration:
description: 'Test duration (in hours)'
required: false
default: 5
type: number
schedule:
# run every 6 hours
- cron: '5 1,7,13,19 * * *'
jobs:
run-cardano-node:
runs-on: ubuntu-latest
timeout-minutes: 300
# required permissions to be able to push to registry
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: 🚧 Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: 📥 Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref_name || '' }}
- name: 🔑 Login Docker Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: anti
name: Get latest antithesis release tag
uses: pozetroninc/github-action-get-latest-release@master
with:
repository: cardano-foundation/antithesis
- name: Download anti CLI from latest release
uses: robinraju/[email protected]
with:
repository: cardano-foundation/antithesis
tag: ${{ steps.anti.outputs.release }}
fileName: "anti-*-linux64.tar.gz"
out-file-path: "./anti-cli"
extract: true
- name: Install anti
run: |
echo "Release: ${{ steps.anti.outputs.release }}"
ls -la anti-cli
sudo install -m 0755 anti-cli/anti /usr/local/bin/anti
anti --version
- name: Submit test
id: request
env:
ANTI_GITHUB_PAT: ${{ secrets.ANTI_GITHUB_PAT }}
ANTI_WALLET_FILE: wallet.json
ANTI_SSH_FILE: cfhal_ed25519
ANTI_MPFS_HOST: ${{ vars.ANTI_MPFS_HOST }}
ANTI_TOKEN_ID: ${{ vars.ANTI_TOKEN_ID }}
ANTI_PLATFORM: github
ANTI_REQUESTER: cfhal
run: |
set -euo pipefail
printf '%s' "${{ secrets.ANTI_REQUESTER_WALLET }}" | base64 --decode > $ANTI_WALLET_FILE
printf '%s' "${{ secrets.ANTI_SSH_KEY }}" > $ANTI_SSH_FILE
TRY=$(anti facts test-runs --whose cfhal | jq 'map(select(.key.commitId == "${{ github.sha }}")) | length')
TRY=$(($TRY + 1)) # start with try=1
echo "TRY=$TRY"
# TODO: use duration or DEFAULT_DURATION
# RESULT=$(anti requester create-test -d compose/testnets/cardano_node_with_adversary -c ${{ github.sha }} -r "cardano-foundation/antithesis" --try $TRY -t 1)
RESULT='{"txHash":"3fec16b1c7db6107146d18401f2a061ddaafe3a382e58d0297bd0113f9af1039","value":{"state":{"duration":1,"phase":"pending","signature":"977dca1597c2d92d25a597505adc36092541f6c6932ea6af11e2611b4b65ff8868fd6c25c8e314d6b2f74fab08ba97fd8a03d371c08ff8708e1f41a54f3d850c"},"testRunId":"43b510664edb6acec0b9b5c9fe66deddce1099064ccd6c4fc52cddcd606b8a08"}}'
echo $RESULT
# TXID=#result
# set output
echo "id=$(echo $RESULT | jq -r .value.testRunId)" >> "$GITHUB_OUTPUT"
echo "txHash=$(echo $RESULT | jq -r .txHash)" >> "$GITHUB_OUTPUT"
- name: Wait for results
run: |
function query_run() { anti facts test-runs --whose cfhal | jq 'map(select(.id == "${{ steps.request.outputs.id }}"))[0]'; }
# TODO: handle rejected phase values
until [[ $(query_run | jq .value.phase) != "pending" ]]; do
sleep 10
done
[[ $(query_run | jq .value.phase) == "finished" ]]