|
| 1 | +name: E2E Kind Tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + old_version: |
| 10 | + description: "Old version tag for upgrade tests (used by hardfork/governance/comprehensive)" |
| 11 | + default: "v1.1.2" |
| 12 | + type: string |
| 13 | + |
| 14 | +env: |
| 15 | + OLD_VERSION: ${{ inputs.old_version || 'v1.1.2' }} |
| 16 | + DOCKER_IMAGE: mocachain/moca |
| 17 | + DOCKER_TAG: e2e-local |
| 18 | + CGO_CFLAGS: "-O -D__BLST_PORTABLE__" |
| 19 | + CGO_CFLAGS_ALLOW: "-O -D__BLST_PORTABLE__" |
| 20 | + |
| 21 | +jobs: |
| 22 | + # ── Build Docker images once, share via artifact ───────────────────────────── |
| 23 | + build-e2e-images: |
| 24 | + name: Build E2E Images |
| 25 | + runs-on: ubuntu-latest |
| 26 | + timeout-minutes: 30 |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v6 |
| 29 | + |
| 30 | + - name: Set up Docker Buildx |
| 31 | + uses: docker/setup-buildx-action@v4 |
| 32 | + |
| 33 | + - name: Build current version image |
| 34 | + uses: docker/build-push-action@v7 |
| 35 | + with: |
| 36 | + context: . |
| 37 | + file: e2e/kind/Dockerfile.e2e |
| 38 | + tags: ${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_TAG }} |
| 39 | + load: true |
| 40 | + no-cache: true |
| 41 | + |
| 42 | + - name: Build old version image |
| 43 | + uses: docker/build-push-action@v7 |
| 44 | + with: |
| 45 | + context: . |
| 46 | + file: e2e/kind/Dockerfile.e2e-gitref |
| 47 | + build-args: GIT_REF=${{ env.OLD_VERSION }} |
| 48 | + tags: ${{ env.DOCKER_IMAGE }}:${{ env.OLD_VERSION }} |
| 49 | + load: true |
| 50 | + no-cache: true |
| 51 | + |
| 52 | + - name: Save images |
| 53 | + run: | |
| 54 | + docker save \ |
| 55 | + "$DOCKER_IMAGE:$DOCKER_TAG" \ |
| 56 | + "$DOCKER_IMAGE:$OLD_VERSION" \ |
| 57 | + | gzip > /tmp/e2e-images.tar.gz |
| 58 | +
|
| 59 | + - name: Upload images |
| 60 | + uses: actions/upload-artifact@v7 |
| 61 | + with: |
| 62 | + name: e2e-images |
| 63 | + path: /tmp/e2e-images.tar.gz |
| 64 | + retention-days: 1 |
| 65 | + |
| 66 | + # ── Run tests in parallel, reusing pre-built images ────────────────────────── |
| 67 | + e2e-tests: |
| 68 | + name: "E2E: ${{ matrix.name }}" |
| 69 | + needs: build-e2e-images |
| 70 | + runs-on: ubuntu-latest |
| 71 | + timeout-minutes: 20 |
| 72 | + strategy: |
| 73 | + fail-fast: false |
| 74 | + matrix: |
| 75 | + include: |
| 76 | + - name: Smoke |
| 77 | + script: test_smoke.sh |
| 78 | + - name: Upgrade (hardfork) |
| 79 | + script: test_upgrade_hardfork.sh |
| 80 | + - name: Upgrade (governance) |
| 81 | + script: test_upgrade_governance.sh |
| 82 | + - name: Comprehensive |
| 83 | + script: test_upgrade_comprehensive.sh |
| 84 | + foundry: true |
| 85 | + - name: Validator devcontainer parity |
| 86 | + script: test_validator_devcontainer_parity.sh |
| 87 | + - name: RPC suite |
| 88 | + script: test_rpc_suite.sh |
| 89 | + foundry: true |
| 90 | + |
| 91 | + steps: |
| 92 | + - uses: actions/checkout@v6 |
| 93 | + |
| 94 | + - name: Download images |
| 95 | + uses: actions/download-artifact@v8 |
| 96 | + with: |
| 97 | + name: e2e-images |
| 98 | + path: /tmp |
| 99 | + |
| 100 | + - name: Load images into Docker |
| 101 | + run: gunzip -c /tmp/e2e-images.tar.gz | docker load |
| 102 | + |
| 103 | + - name: Install Kind |
| 104 | + run: | |
| 105 | + curl -sSLo ./kind "https://kind.sigs.k8s.io/dl/v0.29.0/kind-linux-amd64" |
| 106 | + chmod +x ./kind |
| 107 | + sudo mv ./kind /usr/local/bin/kind |
| 108 | +
|
| 109 | + - name: Install Foundry |
| 110 | + if: matrix.foundry |
| 111 | + uses: foundry-rs/foundry-toolchain@v1 |
| 112 | + |
| 113 | + - name: Run ${{ matrix.name }} |
| 114 | + env: |
| 115 | + FW_SKIP_BUILD: "true" |
| 116 | + FW_SKIP_CLEANUP: "true" |
| 117 | + run: bash e2e/kind/tests/${{ matrix.script }} |
| 118 | + |
| 119 | + - name: Collect debug logs |
| 120 | + if: failure() |
| 121 | + run: | |
| 122 | + mkdir -p /tmp/e2e-logs |
| 123 | + for i in 0 1 2 3; do |
| 124 | + kubectl logs -n moca-e2e "validator-${i}-0" -c mocad --tail=200 \ |
| 125 | + > "/tmp/e2e-logs/validator-${i}.log" 2>/dev/null || true |
| 126 | + kubectl describe pod -n moca-e2e "validator-${i}-0" \ |
| 127 | + > "/tmp/e2e-logs/validator-${i}-describe.txt" 2>/dev/null || true |
| 128 | + done |
| 129 | +
|
| 130 | + - name: Upload debug logs |
| 131 | + if: failure() |
| 132 | + uses: actions/upload-artifact@v7 |
| 133 | + with: |
| 134 | + name: e2e-logs-${{ matrix.name }} |
| 135 | + path: /tmp/e2e-logs |
| 136 | + retention-days: 7 |
0 commit comments