Skip to content

.github/workflows/nightly-kind-test.yml #205

.github/workflows/nightly-kind-test.yml

.github/workflows/nightly-kind-test.yml #205

name: KIND network tests
on:
workflow_dispatch:
schedule:
- cron: "00 08 * * 1-5"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
DOCKERHUB_PASSWORD: "${{ secrets.DOCKERHUB_PASSWORD }}"
RUN_ID: ${{ github.run_id }}
RUN_ATTEMPT: ${{ github.run_attempt }}
USERNAME: ${{ github.event.pull_request.user.login || github.actor }}
GITHUB_TOKEN: ${{ github.token }}
GH_SELF_HOSTED_RUNNER_TOKEN: ${{ secrets.GH_SELF_HOSTED_RUNNER_TOKEN }}
LOG_ID: ${{ github.run_id }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
BUILD_INSTANCE_SSH_KEY: ${{ secrets.BUILD_INSTANCE_SSH_KEY }}
GIT_COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
EXTERNAL_ETHEREUM_HOST: "https://json-rpc.${{ secrets.SEPOLIA_EXTERNAL_HOST }}?key=${{ secrets.SEPOLIA_API_KEY }}"
EXTERNAL_ETHEREUM_CONSENSUS_HOST: "https://beacon.${{ secrets.SEPOLIA_EXTERNAL_HOST }}"
GCP_API_KEY_HEADER: "X-goog-api-key"
jobs:
setup:
uses: ./.github/workflows/setup-runner.yml
with:
username: ${{ github.actor }}
runner_type: builder-x86
secrets: inherit
find-image:
runs-on: ubuntu-latest
outputs:
image_tag: ${{ steps.find-tag.outputs.tag }}
commit: ${{ steps.find-tag.outputs.commit }}
steps:
- uses: actions/checkout@v4
with:
ref: "${{ env.GIT_COMMIT }}"
fetch-depth: 0
- name: Find latest available image tag
id: find-tag
run: |
set -x
COMMIT=${{ env.GIT_COMMIT }}
MAX_ATTEMPTS=10
for ((i=0; i<MAX_ATTEMPTS; i++)); do
if docker pull aztecprotocol/aztec:$COMMIT-amd64 >/dev/null 2>&1; then
echo "tag=$COMMIT-amd64" >> $GITHUB_OUTPUT
echo "commit=$COMMIT" >> $GITHUB_OUTPUT
exit 0
fi
# Get previous commit
COMMIT=$(git rev-parse "$COMMIT^")
done
echo "Error: Could not find a valid image tag after $MAX_ATTEMPTS attempts"
exit 1
test:
needs: [setup, find-image]
runs-on: ubuntu-latest
strategy:
matrix:
test:
- test-kind-transfer
# - test-kind-reorg
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: "${{ needs.find-image.outputs.commit }}"
- name: Setup
run: |
# Ensure we can SSH into the spot instances we request.
mkdir -p ~/.ssh
echo ${{ secrets.BUILD_INSTANCE_SSH_KEY }} | base64 --decode > ~/.ssh/build_instance_key
chmod 600 ~/.ssh/build_instance_key
- name: Run Tests
timeout-minutes: 90
run: |
./ci3/bootstrap_ec2 \
"docker pull aztecprotocol/aztec:${{ needs.find-image.outputs.image_tag }} && \
./bootstrap.sh fast && \
AZTEC_DOCKER_TAG=${{ needs.find-image.outputs.image_tag }} \
FORCE_COLOR=1 \
./spartan/bootstrap.sh ${{ matrix.test }}"
proving-test:
needs: [setup, find-image]
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
with:
ref: "${{ needs.find-image.outputs.commit }}"
- uses: ./.github/ci-setup-action
- name: Setup
run: |
# Ensure we can SSH into the spot instances we request.
mkdir -p ~/.ssh
echo ${{ secrets.BUILD_INSTANCE_SSH_KEY }} | base64 --decode > ~/.ssh/build_instance_key
chmod 600 ~/.ssh/build_instance_key
- name: Run Proving Test
timeout-minutes: 90
run: |
./ci3/bootstrap_ec2 \
"docker pull aztecprotocol/aztec:${{ needs.find-image.outputs.image_tag }} && \
./bootstrap.sh fast && \
AZTEC_DOCKER_TAG=${{ needs.find-image.outputs.image_tag }} \
FORCE_COLOR=1 \
./spartan/bootstrap.sh test-proving"
kind-sepolia-test:
needs: [setup, find-image]
runs-on: ubuntu-latest
strategy:
matrix:
test:
# - test-kind-4epochs
- test-kind-transfer
steps:
- uses: actions/checkout@v4
with:
ref: "${{ needs.find-image.outputs.commit }}"
- name: Setup
run: |
# Ensure we can SSH into the spot instances we request.
mkdir -p ~/.ssh
echo ${{ secrets.BUILD_INSTANCE_SSH_KEY }} | base64 --decode > ~/.ssh/build_instance_key
chmod 600 ~/.ssh/build_instance_key
- name: Run Sepolia Tests
run: |
./ci3/bootstrap_ec2 \
"docker pull aztecprotocol/aztec:${{ needs.find-image.outputs.image_tag }} && \
./bootstrap.sh fast && \
AZTEC_DOCKER_TAG=${{ needs.find-image.outputs.image_tag }} \
FORCE_COLOR=1 \
EXTERNAL_ETHEREUM_HOST=${{ env.EXTERNAL_ETHEREUM_HOST }} \
EXTERNAL_ETHEREUM_CONSENSUS_HOST=${{ env.EXTERNAL_ETHEREUM_CONSENSUS_HOST }} \
EXTERNAL_ETHEREUM_CONSENSUS_HOST_API_KEY=${{ secrets.SEPOLIA_API_KEY }} \
EXTERNAL_ETHEREUM_CONSENSUS_HOST_API_KEY_HEADER=${{ env.GCP_API_KEY_HEADER }} \
L1_DEPLOYMENT_PRIVATE_KEY=${{ secrets.SEPOLIA_L1_DEPLOYMENT_PRIVATE_KEY }} \
L1_ACCOUNTS_MNEMONIC="${{ secrets.SEPOLIA_ACCOUNTS_MNEMONIC }}" \
SEPOLIA_RUN=true \
./spartan/bootstrap.sh ${{ matrix.test }}"
success-check:
runs-on: ubuntu-latest
needs:
- test
- proving-test
- kind-sepolia-test
if: always()
steps:
- name: Report overall success
env:
# We treat any skipped or failing jobs as a failure for the workflow as a whole.
FAIL: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
run: |
if [[ $FAIL == true ]]; then
echo "Test failed."
exit 1
fi
notify:
needs:
- success-check
runs-on: ubuntu-20.04
if: ${{ github.ref == 'refs/heads/master' && failure() }}
steps:
- name: Send notification to aztec3-ci channel if workflow failed on master
uses: slackapi/slack-github-action@v1.25.0
with:
payload: |
{
"url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFY_WORKFLOW_TRIGGER_URL }}