Skip to content

Devnet Tests

Devnet Tests #25

Workflow file for this run

name: Devnet Tests
on:
schedule:
- cron: "0 2 * * *"
workflow_dispatch:
inputs:
skip_deployment:
description: "Skip deployment and use existing contracts"
required: false
type: boolean
default: false
jobs:
devnet-tests:
name: Devnet Tests
runs-on: ubuntu-latest
env:
AZTEC_ENV: devnet
VERSION: 3.0.0-devnet.5
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "yarn"
- name: Install Aztec CLI
run: |
curl -s https://install.aztec.network > tmp.sh
bash tmp.sh <<< yes "yes"
- name: Update path
run: echo "/home/runner/.aztec/bin" >> $GITHUB_PATH
- name: Set Aztec version
run: |
aztec-up ${{ env.VERSION }}
- name: Install project dependencies
run: yarn
- name: Compile contracts
run: script -e -c "${AZTEC_NARGO:-aztec-nargo} compile && aztec-postprocess-contract"
- name: Generate contract artifacts
run: script -e -c "aztec codegen target --outdir src/artifacts"
- name: Setup devnet environment
run: |
echo "πŸ“‹ Using devnet configuration from config/devnet.json"
cat config/devnet.json
- name: Test devnet connectivity
run: |
echo "Testing devnet connectivity..."
curl -s https://devnet.aztec-labs.com/status || echo "Warning: Could not connect to devnet"
- name: Deploy account to devnet
if: ${{ !inputs.skip_deployment }}
run: |
TEMP_OUTPUT=$(mktemp)
if script -e -c "yarn deploy-account::devnet" > "$TEMP_OUTPUT" 2>&1; then
echo "βœ… Deploy account to devnet completed successfully"
else
echo "❌ Deploy account script failed"
cat "$TEMP_OUTPUT"
rm "$TEMP_OUTPUT"
exit 1
fi
cat "$TEMP_OUTPUT"
SECRET_KEY=$(grep -o "πŸ”‘ Secret key generated: 0x[a-fA-F0-9]*" "$TEMP_OUTPUT" | head -1 | sed 's/πŸ”‘ Secret key generated: //' || echo "")
SIGNING_KEY=$(grep -o "πŸ–ŠοΈ Signing key generated: 0x[a-fA-F0-9]*" "$TEMP_OUTPUT" | head -1 | sed 's/πŸ–ŠοΈ Signing key generated: //' || echo "")
SALT_VALUE=$(grep -o "πŸ§‚ Salt generated: 0x[a-fA-F0-9]*" "$TEMP_OUTPUT" | head -1 | sed 's/πŸ§‚ Salt generated: //' || echo "")
rm "$TEMP_OUTPUT"
if [ -n "$SECRET_KEY" ] && [ -n "$SIGNING_KEY" ] && [ -n "$SALT_VALUE" ]; then
echo "SECRET=\"$SECRET_KEY\"" >> .env
echo "SIGNING_KEY=\"$SIGNING_KEY\"" >> .env
echo "SALT=\"$SALT_VALUE\"" >> .env
echo "πŸ“‹ Saved credentials to .env file"
else
echo "❌ Failed to extract SECRET, SIGNING_KEY, and/or SALT from deploy output"
exit 1
fi
- name: Deploy contract to devnet
if: ${{ !inputs.skip_deployment }}
run: |
TEMP_OUTPUT=$(mktemp)
if script -e -c "yarn deploy::devnet" > "$TEMP_OUTPUT" 2>&1; then
echo "βœ… Deploy contract to devnet completed successfully"
else
echo "❌ Deploy contract script failed"
cat "$TEMP_OUTPUT"
rm "$TEMP_OUTPUT"
exit 1
fi
cat "$TEMP_OUTPUT"
VOTING_CONTRACT_ADDRESS=$(grep -o "Contract address: 0x[a-fA-F0-9]*" "$TEMP_OUTPUT" | head -1 | sed 's/Contract address: //' || echo "")
rm "$TEMP_OUTPUT"
if [ -n "$VOTING_CONTRACT_ADDRESS" ]; then
echo "VOTING_CONTRACT_ADDRESS=\"$VOTING_CONTRACT_ADDRESS\"" >> .env
echo "πŸ“‹ Saved contract address to .env file"
else
echo "⚠️ Warning: Could not extract contract address"
fi
- name: Run devnet scripts
run: |
echo "Running devnet scripts..."
script -e -c "yarn get-block::devnet"
- name: Run interaction test with existing contract
if: ${{ inputs.skip_deployment }}
run: |
echo "Running interaction with existing contract on devnet..."
script -e -c "yarn interaction-existing-contract::devnet"
- name: Run JavaScript tests on devnet
run: |
echo "Running JavaScript tests against devnet..."
script -e -c "rm -rf store/pxe"
script -e -c "ENV=devnet NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --runInBand --config jest.integration.config.json"
- name: Profile deployment on devnet
if: ${{ !inputs.skip_deployment }}
run: |
script -e -c "yarn profile::devnet"