|
| 1 | +# CI for Aztec Network Scenarios. |
| 2 | +# Effectively runs CI_SCENARIO_TEST=1 spartan/bootstrap.sh test |
| 3 | +# Triggered by network-deployments event, which is emitted by ci3.yml when a tagged release passes "normal" CI. |
| 4 | +# |
| 5 | +name: Test Network Scenarios |
| 6 | + |
| 7 | +on: |
| 8 | + repository_dispatch: |
| 9 | + types: |
| 10 | + - network-deployments |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: network-scenarios-${{ github.event.client_payload.major_version }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +jobs: |
| 17 | + test_network_scenarios_dispatch_deploy_scenario_network: |
| 18 | + uses: ./.github/workflows/deploy-scenario-network.yml |
| 19 | + with: |
| 20 | + cluster: aztec-gke-private |
| 21 | + namespace: v${{ github.event.client_payload.major_version }}-scenario |
| 22 | + ref: ${{ github.event.client_payload.ref }} |
| 23 | + aztec_docker_image: "aztecprotocol/aztec:${{ github.event.client_payload.semver }}" |
| 24 | + devnet_mnemonic: "test test test test test test test test test test test junk" |
| 25 | + rollup_deployment_mnemonic: "test test test test test test test test test test test junk" |
| 26 | + secrets: |
| 27 | + GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }} |
| 28 | + |
| 29 | + ci: |
| 30 | + runs-on: ubuntu-latest |
| 31 | + steps: |
| 32 | + ############# |
| 33 | + # Prepare Env |
| 34 | + ############# |
| 35 | + - name: Checkout |
| 36 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| 37 | + with: |
| 38 | + ref: ${{ github.sha }} |
| 39 | + persist-credentials: false |
| 40 | + |
| 41 | + - name: CI Network Scenario Override |
| 42 | + run: echo "CI_NETWORK_SCENARIO=1" >> $GITHUB_ENV |
| 43 | + |
| 44 | + - name: Compute Target Branch |
| 45 | + id: target_branch |
| 46 | + run: | |
| 47 | + if [ "${{ github.event_name }}" == "merge_group" ]; then |
| 48 | + target_branch=${{ github.event.merge_group.base_ref }} |
| 49 | + elif [ "${{ github.event_name }}" == "pull_request" ]; then |
| 50 | + target_branch=${{ github.event.pull_request.base.ref }} |
| 51 | + else |
| 52 | + target_branch=${{ github.ref_name }} |
| 53 | + fi |
| 54 | + target_branch=${target_branch#refs/heads/} |
| 55 | + echo "target_branch=$target_branch" >> $GITHUB_OUTPUT |
| 56 | + echo "TARGET_BRANCH=${target_branch}" >> $GITHUB_ENV |
| 57 | +
|
| 58 | + - name: Setup |
| 59 | + run: | |
| 60 | + # Ensure we can SSH into the spot instances we request. |
| 61 | + mkdir -p ~/.ssh |
| 62 | + echo ${{ secrets.BUILD_INSTANCE_SSH_KEY }} | base64 --decode > ~/.ssh/build_instance_key |
| 63 | + chmod 600 ~/.ssh/build_instance_key |
| 64 | + sudo apt install -y --no-install-recommends redis-tools parallel |
| 65 | +
|
| 66 | + - name: Prepare GCP key |
| 67 | + env: |
| 68 | + GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }} |
| 69 | + run: | |
| 70 | + echo "$GCP_SA_KEY" | base64 -w 0 > gcp_sa_key.b64 |
| 71 | + echo "GCP_SA_KEY_B64=$(cat gcp_sa_key.b64)" >> $GITHUB_ENV |
| 72 | +
|
| 73 | + - name: Get Tree Hash |
| 74 | + run: echo "TREE_HASH=$(git rev-parse HEAD^{tree})" >> $GITHUB_ENV |
| 75 | + |
| 76 | + - name: Check CI Cache |
| 77 | + id: ci_cache |
| 78 | + uses: actions/cache@v3 |
| 79 | + with: |
| 80 | + path: ci-success.txt |
| 81 | + key: ci-network-scenario-${{ env.TREE_HASH }} |
| 82 | + |
| 83 | + ############# |
| 84 | + # Run |
| 85 | + ############# |
| 86 | + - name: Run |
| 87 | + if: steps.ci_cache.outputs.cache-hit != 'true' |
| 88 | + env: |
| 89 | + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 90 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 91 | + GITHUB_TOKEN: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }} |
| 92 | + RUN_ID: ${{ github.run_id }} |
| 93 | + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} |
| 94 | + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} |
| 95 | + DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} |
| 96 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 97 | + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |
| 98 | + # Nightly test env vars. |
| 99 | + GCP_SA_KEY_B64: ${{ env.GCP_SA_KEY_B64 }} |
| 100 | + EXTERNAL_ETHEREUM_HOSTS: "https://json-rpc.${{ secrets.GCP_SEPOLIA_URL }}?key=${{ secrets.GCP_SEPOLIA_API_KEY }},${{ secrets.INFURA_SEPOLIA_URL }}" |
| 101 | + EXTERNAL_ETHEREUM_CONSENSUS_HOST: "https://beacon.${{ secrets.GCP_SEPOLIA_URL }}" |
| 102 | + EXTERNAL_ETHEREUM_CONSENSUS_HOST_API_KEY: ${{ secrets.GCP_SEPOLIA_API_KEY }} |
| 103 | + EXTERNAL_ETHEREUM_CONSENSUS_HOST_API_KEY_HEADER: "X-goog-api-key" |
| 104 | + GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} |
| 105 | + NAMESPACE: "v${{ github.event.client_payload.major_version }}-scenario" |
| 106 | + run: | |
| 107 | + exec ./ci.sh network-scenario |
| 108 | +
|
| 109 | + - name: Save CI Success |
| 110 | + if: steps.ci_cache.outputs.cache-hit != 'true' |
| 111 | + run: echo "success" > ci-success.txt |
0 commit comments