Skip to content

Test cardano-node

Test cardano-node #693

Workflow file for this run

name: "Test cardano-node"
env:
TESTNET: "cardano_node_master"
REGISTRY: ghcr.io/cardano-foundation/moog
EMAILS: '[email protected]'
DURATION: ${{ inputs.duration || 5 }}
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
env:
MOOG_GITHUB_PAT: ${{ secrets.MOOG_GITHUB_PAT }}
MOOG_WALLET_FILE: wallet.json
MOOG_MPFS_HOST: ${{ vars.MOOG_MPFS_HOST }}
MOOG_TOKEN_ID: ${{ vars.MOOG_TOKEN_ID }}
MOOG_PLATFORM: github
MOOG_REQUESTER: cfhal
timeout-minutes: 600
# 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: moog
name: Get latest moog release tag
uses: pozetroninc/github-action-get-latest-release@master
with:
repository: cardano-foundation/moog
- name: Download moog from latest release
uses: robinraju/[email protected]
with:
repository: cardano-foundation/moog
tag: ${{ steps.moog.outputs.release }}
fileName: "moog-*-linux64.tar.gz"
out-file-path: "."
extract: true
- name: Install moog
run: |
echo "Release: ${{ steps.moog.outputs.release }}"
sudo install -m 0755 moog /usr/local/bin/moog
moog --version
- name: Configure moog wallet
run: printf '%s' "${{ secrets.MOOG_REQUESTER_WALLET }}" | base64 --decode > $MOOG_WALLET_FILE
- name: Submit test
id: request
run: |
set -euo pipefail
TRY=$(moog facts test-runs --whose cfhal | jq 'map(select(.key.commitId == "${{ github.sha }}")) | length')
TRY=$(($TRY + 1)) # start with try=1
echo "TRY=$TRY"
RESULT=$(moog requester create-test -d "compose/testnets/$TESTNET" -c ${{ github.sha }} -r "$GITHUB_REPOSITORY" --try $TRY -t $DURATION)
# RESULT='{"txHash":"aa0c0bd995c255f31bf40b21304d0fdfa4f42d9fa6a753db7a8fa65d41d976c1","value":{"state":{"duration":1,"phase":"pending","signature":"e8e8d764c8cfe6c9378beddb360c9ef1345b6a2b9184508e92de9a6665fdcd5b65f134dcab2d4054990b6e4e13c94b5651254b36b3ffcec0ddcaf4c11ab38708"},"testRunId":"2d90645a3932b6d3ee04c4ccb7b810472ed35370a66b53b1ad80aa8ed2a99cd3"}}'
echo $RESULT
# Passing -e and -r in separate jq calls ensures we both unwrap
# the string quotes and fail if the json isn't as expected.
ID=$(echo $RESULT | jq -e .value.testRunId | jq -r .)
TXID=$(echo $RESULT | jq -e .txHash | jq -r .)
echo "id=$ID" >> "$GITHUB_OUTPUT"
echo "txHash=$TXID" >> "$GITHUB_OUTPUT"
- name: Wait for results
run: timeout $((($DURATION + 1) * 3600)) ./cli/scripts/wait-for-test.sh "${{ steps.request.outputs.id }}"