Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 49 additions & 5 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,56 @@ on:
branches: [ "main" ]

jobs:

build:

runs-on: ubuntu-latest
timeout-minutes: 3

steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build . --file Dockerfile --tag testnet-docker-image:$(date +%s)
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub (if credentials available)
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
continue-on-error: true

- name: Extract metadata
id: meta
shell: bash
run: |
set -euo pipefail
echo "tag=$(date +%s)" >> $GITHUB_OUTPUT
echo "sha=${GITHUB_SHA::8}" >> $GITHUB_OUTPUT

- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
tags: |
testnet-docker-image:${{ steps.meta.outputs.tag }}
testnet-docker-image:${{ steps.meta.outputs.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
push: false
load: true

- name: Test Docker image
shell: bash
run: |
set -euo pipefail
docker images | grep testnet-docker-image
echo "Docker image built successfully"

- name: Cleanup
if: always()
shell: bash
run: |
set -euo pipefail
docker system prune -f || true
113 changes: 98 additions & 15 deletions .github/workflows/test-start-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,118 @@ on:
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 3

steps:
- uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker
uses: docker/setup-buildx-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Install Docker Compose
- name: Verify Docker Compose
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y docker-compose
set -euo pipefail
if docker compose version >/dev/null 2>&1; then
echo "Using Docker Compose plugin"
docker compose version
elif command -v docker-compose >/dev/null 2>&1; then
echo "Using docker-compose standalone"
docker-compose --version
else
echo "Error: Docker Compose not available"
exit 1
fi

- name: Start Preprod node, wait 30s then stop node
- name: Test Preprod node
shell: bash
timeout-minutes: 10
run: |
printf "1\n" | /bin/bash ./start-node.sh 2>&1 | tee script_output.txt &
set -euo pipefail
printf "2\n1\n" | ./start-node.sh 2>&1 | tee preprod_output.txt &
START_PID=$!
sleep 30
/bin/bash ./stop-nodes.sh
if ! kill -0 $START_PID 2>/dev/null; then
echo "Error: start-node.sh process died unexpectedly"
exit 1
fi
./stop-nodes.sh
wait $START_PID || true
if [ -f preprod_output.txt ]; then
echo "=== Preprod Node Output ==="
cat preprod_output.txt
fi

- name: Cleanup after Preprod
if: always()
shell: bash
run: |
set -euo pipefail
./stop-nodes.sh || true
docker ps -a --filter "name=node-" --format "{{.Names}}" | xargs -r docker rm -f || true

- name: Start Preview node, wait 30s then stop node
- name: Test Preview node
shell: bash
timeout-minutes: 3
run: |
printf "2\n" | /bin/bash ./start-node.sh 2>&1 | tee script_output.txt &
set -euo pipefail
printf "3\n1\n" | ./start-node.sh 2>&1 | tee preview_output.txt &
START_PID=$!
sleep 30
/bin/bash ./stop-nodes.sh
if ! kill -0 $START_PID 2>/dev/null; then
echo "Error: start-node.sh process died unexpectedly"
exit 1
fi
./stop-nodes.sh
wait $START_PID || true
if [ -f preview_output.txt ]; then
echo "=== Preview Node Output ==="
cat preview_output.txt
fi

- name: Start SanchoNet node, wait 30s then stop node
- name: Cleanup after Preview
if: always()
shell: bash
run: |
printf "3\n" | /bin/bash ./start-node.sh 2>&1 | tee script_output.txt &
set -euo pipefail
./stop-nodes.sh || true
docker ps -a --filter "name=node-" --format "{{.Names}}" | xargs -r docker rm -f || true

- name: Test SanchoNet node
shell: bash
timeout-minutes: 3
run: |
set -euo pipefail
printf "4\n1\n" | ./start-node.sh 2>&1 | tee sancho_output.txt &
START_PID=$!
sleep 30
/bin/bash ./stop-nodes.sh
if ! kill -0 $START_PID 2>/dev/null; then
echo "Error: start-node.sh process died unexpectedly"
exit 1
fi
./stop-nodes.sh
wait $START_PID || true
if [ -f sancho_output.txt ]; then
echo "=== SanchoNet Node Output ==="
cat sancho_output.txt
fi

- name: Final cleanup
if: always()
shell: bash
run: |
set -euo pipefail
./stop-nodes.sh || true
docker ps -a --filter "name=node-" --format "{{.Names}}" | xargs -r docker rm -f || true
docker system prune -f || true

- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: node-logs
path: |
*_output.txt
script_output.txt
retention-days: 7
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ services:
- ./keys:/keys
- ./txs:/txs
- ./dumps:/dumps
- ./utilities:/utilities
logging:
driver: "json-file"
options:
Expand Down
13 changes: 7 additions & 6 deletions scripts/cc/authorize-hot-key.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
#!/bin/bash

# Define directory paths
keys_dir="./keys"
txs_dir="./txs/cc"
# Get the script's directory and project root
script_dir=$(dirname "$0")
project_root=$(cd "$script_dir/../.." && pwd)

# Define directory paths relative to project root
keys_dir="$project_root/keys"
txs_dir="$project_root/txs/cc"
tx_path_stub="$txs_dir/auth-hot"
tx_cert_path="$tx_path_stub.cert"
tx_unsigned_path="$tx_path_stub.unsigned"
tx_signed_path="$tx_path_stub.signed"

# Get the script's directory
script_dir=$(dirname "$0")

# Get the container name from the get-container script
container_name="$("$script_dir/../helper/get-container.sh")"

Expand Down
9 changes: 5 additions & 4 deletions scripts/cc/generate-cc-keys.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/bash

# Define directories
keys_dir="./keys"

# Get the script's directory
# Get the script's directory and project root
script_dir=$(dirname "$0")
project_root=$(cd "$script_dir/../.." && pwd)

# Define directory paths relative to project root
keys_dir="$project_root/keys"

# Get the container name from the get-container script
container_name="$("$script_dir/../helper/get-container.sh")"
Expand Down
9 changes: 5 additions & 4 deletions scripts/cc/generate-new-hot-key.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/bash

# Define directories
keys_dir="./keys"

# Get the script's directory
# Get the script's directory and project root
script_dir=$(dirname "$0")
project_root=$(cd "$script_dir/../.." && pwd)

# Define directory paths relative to project root
keys_dir="$project_root/keys"

# Get the container name from the get-container script
container_name="$("$script_dir/../helper/get-container.sh")"
Expand Down
14 changes: 7 additions & 7 deletions scripts/cc/resign-cold-key.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#!/bin/bash

# Define directory paths
keys_dir="./keys"
txs_dir="./txs/cc"
# Get the script's directory and project root
script_dir=$(dirname "$0")
project_root=$(cd "$script_dir/../.." && pwd)

# Define directory paths relative to project root
keys_dir="$project_root/keys"
txs_dir="$project_root/txs/cc"
tx_path_stub="$txs_dir/resign-cold"
tx_cert_path="$tx_path_stub.cert"
tx_unsigned_path="$tx_path_stub.unsigned"
tx_signed_path="$tx_path_stub.signed"


# Get the script's directory
script_dir=$(dirname "$0")

# Get the container name from the get-container script
container_name="$("$script_dir/../helper/get-container.sh")"

Expand Down
13 changes: 7 additions & 6 deletions scripts/cc/vote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@ GA_TX_INDEX="0"

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Define directory paths
keys_dir="./keys"
txs_dir="./txs/cc"
# Get the script's directory and project root
script_dir=$(dirname "$0")
project_root=$(cd "$script_dir/../.." && pwd)

# Define directory paths relative to project root
keys_dir="$project_root/keys"
txs_dir="$project_root/txs/cc"
tx_path_stub="$txs_dir/cc-vote"
tx_cert_path="$tx_path_stub.cert"
tx_unsigned_path="$tx_path_stub.unsigned"
tx_signed_path="$tx_path_stub.signed"

# Get the script's directory
script_dir=$(dirname "$0")

# Get the container name from the get-container script
container_name="$("$script_dir/../helper/get-container.sh")"

Expand Down
11 changes: 6 additions & 5 deletions scripts/drep/create-and-register-multisig.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/bin/bash

# Define directories
keys_dir="./keys"
txs_dir="./txs/multi-sig"

# Get the script's directory
# Get the script's directory and project root
script_dir=$(dirname "$0")
project_root=$(cd "$script_dir/../.." && pwd)

# Define directory paths relative to project root
keys_dir="$project_root/keys"
txs_dir="$project_root/txs/multi-sig"

# Get the container name from the get-container script
container_name="$("$script_dir/../helper/get-container.sh")"
Expand Down
Loading