Skip to content

chore: rename docker-compose.yml to compose.yml #48

chore: rename docker-compose.yml to compose.yml

chore: rename docker-compose.yml to compose.yml #48

Workflow file for this run

on:
workflow_dispatch:
push:
branches: [main]
paths:
- ".github/workflows/main.yaml"
- ".github/Dockerfile"
- "Cargo.*"
- "hanzo-libs/**"
- "hanzo-bin/**"
- "files/**"
- "contracts/**"
pull_request:
branches: [main]
types: [opened, reopened, synchronize, ready_for_review]
paths:
- ".github/workflows/main.yaml"
- ".github/Dockerfile"
- "Cargo.*"
- "hanzo-libs/**"
- "hanzo-bin/**"
- "files/**"
- "contracts/**"
name: Hanzo Test Workflow
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 60
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
permissions:
contents: read
packages: write
steps:
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache
sudo rm -rf /usr/local/share/boost /usr/share/swift /usr/local/graalvm
sudo rm -rf /opt/microsoft /opt/az /usr/local/julia*
sudo rm -rf /home/runner/actions-runner/cached/_diag/*.log || true
sudo apt-get clean || true
sudo docker system prune -af
df -h
- name: Checkout
uses: actions/checkout@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download tools from store to pre-install folder
run: |
./scripts/update_tools.sh
- name: Build and push testing image
run: |
# Start background cleanup to prevent runner log disk full during build
(while true; do sleep 30; sudo truncate -s 0 /home/runner/actions-runner/cached/_diag/*.log 2>/dev/null || true; done) &
CLEANUP_PID=$!
docker build -t ghcr.io/${{ github.repository }}/hanzo-test:${{ github.sha }} --build-arg COMMIT_SHA=${{ github.sha }} --build-arg AI_MODEL_CATALOG_BUILD=1 -f .github/Dockerfile .
docker push ghcr.io/${{ github.repository }}/hanzo-test:${{ github.sha }}
kill $CLEANUP_PID 2>/dev/null || true
test-primitives:
runs-on: ubuntu-latest
timeout-minutes: 15
needs: build
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
permissions:
packages: read
steps:
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache
sudo rm -rf /usr/local/share/boost /usr/share/swift /usr/local/graalvm
sudo rm -rf /opt/microsoft /opt/az /usr/local/julia*
sudo docker system prune -af
df -h
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run tests primitives cargo tests
run: docker run --rm --name hanzo_node_tests_prim_${{ github.sha }}_${{ github.run_number }}_${{ github.run_attempt }} ghcr.io/${{ github.repository }}/hanzo-test:${{ github.sha }} /bin/bash -c "cd /app/hanzo-libs/hanzo-messages && cargo test -- --test-threads=1 --nocapture"
test-main:
runs-on: ubuntu-latest
timeout-minutes: 45
needs: build
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
environment: FROM_WALLET_PRIVATE_KEY
permissions:
packages: read
steps:
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache
sudo rm -rf /usr/local/share/boost /usr/share/swift /usr/local/graalvm
sudo rm -rf /opt/microsoft /opt/az /usr/local/julia*
sudo docker system prune -af
df -h
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run tests main cargo tests
env:
X402_PAY_TO: ${{ secrets.X402_PAY_TO }}
X402_PRIVATE_KEY: ${{ secrets.X402_PRIVATE_KEY }}
RESTORE_WALLET_MNEMONICS_NODE2: ${{ secrets.RESTORE_WALLET_MNEMONICS_NODE2 }}
FROM_WALLET_PRIVATE_KEY: ${{ secrets.FROM_WALLET_PRIVATE_KEY }}
run: |
# Start background cleanup to prevent runner log disk full during test
(while true; do sleep 60; sudo truncate -s 0 /home/runner/actions-runner/cached/_diag/*.log 2>/dev/null || true; done) &
docker run --rm --name hanzo_node_tests_main_${{ github.sha }}_${{ github.run_number }}_${{ github.run_attempt }} -e X402_PAY_TO="${{ secrets.X402_PAY_TO }}" -e X402_PRIVATE_KEY="${{ secrets.X402_PRIVATE_KEY }}" -e RESTORE_WALLET_MNEMONICS_NODE2="${{ secrets.RESTORE_WALLET_MNEMONICS_NODE2 }}" -e FROM_WALLET_PRIVATE_KEY="${{ secrets.FROM_WALLET_PRIVATE_KEY }}" ghcr.io/${{ github.repository }}/hanzo-test:${{ github.sha }} /bin/bash -c "export IS_TESTING=1 && export SKIP_IMPORT_FROM_DIRECTORY=true && export WELCOME_MESSAGE=false && cd /app && cargo test -- --test-threads=1 --nocapture --skip node_integration_tests --skip a3_micropayment_flow_tests --skip a4_micropayment_localhost_tests"
test-integration:
runs-on: ubuntu-latest
timeout-minutes: 30
needs: build
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
environment: FROM_WALLET_PRIVATE_KEY
permissions:
packages: read
# Integration tests require full network infrastructure not available in CI
continue-on-error: true
steps:
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache
sudo rm -rf /usr/local/share/boost /usr/share/swift /usr/local/graalvm
sudo rm -rf /opt/microsoft /opt/az /usr/local/julia*
sudo docker system prune -af
df -h
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run integration tests
env:
X402_PAY_TO: ${{ secrets.X402_PAY_TO }}
X402_PRIVATE_KEY: ${{ secrets.X402_PRIVATE_KEY }}
RESTORE_WALLET_MNEMONICS_NODE2: ${{ secrets.RESTORE_WALLET_MNEMONICS_NODE2 }}
FROM_WALLET_PRIVATE_KEY: ${{ secrets.FROM_WALLET_PRIVATE_KEY }}
run: |
# Start background cleanup to prevent runner log disk full during test
(while true; do sleep 60; sudo truncate -s 0 /home/runner/actions-runner/cached/_diag/*.log 2>/dev/null || true; done) &
docker run --rm --network host --name hanzo_node_integration_tests_${{ github.sha }}_${{ github.run_number }}_${{ github.run_attempt }} -e X402_PAY_TO="${{ secrets.X402_PAY_TO }}" -e X402_PRIVATE_KEY="${{ secrets.X402_PRIVATE_KEY }}" -e RESTORE_WALLET_MNEMONICS_NODE2="${{ secrets.RESTORE_WALLET_MNEMONICS_NODE2 }}" -e FROM_WALLET_PRIVATE_KEY="${{ secrets.FROM_WALLET_PRIVATE_KEY }}" ghcr.io/${{ github.repository }}/hanzo-test:${{ github.sha }} /bin/bash -c "export IS_TESTING=1 && export SKIP_IMPORT_FROM_DIRECTORY=true && export WELCOME_MESSAGE=false && cd /app && cargo test -- --test-threads=1 --nocapture node_integration_tests a3_micropayment_flow_tests a4_micropayment_localhost_tests"
test-contracts:
runs-on: ubuntu-latest
timeout-minutes: 10
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Run Foundry tests
working-directory: contracts
run: forge test -vvv