|
| 1 | +name: "antithesis-leios" |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths: |
| 6 | + - "antithesis/**" |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + paths: |
| 11 | + - "antithesis/**" |
| 12 | + workflow_dispatch: |
| 13 | + inputs: |
| 14 | + push_images: |
| 15 | + description: 'Push images to GHCR' |
| 16 | + required: false |
| 17 | + default: 'false' |
| 18 | + type: boolean |
| 19 | + |
| 20 | +env: |
| 21 | + REGISTRY: ghcr.io |
| 22 | + IMAGE_PREFIX: ${{ github.repository }} |
| 23 | + |
| 24 | +jobs: |
| 25 | + build-images: |
| 26 | + name: "Build Antithesis Docker images" |
| 27 | + runs-on: ubuntu-22.04 |
| 28 | + permissions: |
| 29 | + contents: read |
| 30 | + packages: write |
| 31 | + |
| 32 | + steps: |
| 33 | + - name: Checkout repository |
| 34 | + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 |
| 35 | + |
| 36 | + - name: Set up Docker Buildx |
| 37 | + uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3 |
| 38 | + |
| 39 | + - name: Log in to Container Registry |
| 40 | + if: github.event_name == 'push' || github.event.inputs.push_images == 'true' |
| 41 | + uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3 |
| 42 | + with: |
| 43 | + registry: ${{ env.REGISTRY }} |
| 44 | + username: ${{ github.actor }} |
| 45 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 46 | + |
| 47 | + - name: Extract metadata for cardano-node-leios |
| 48 | + id: meta-cardano-node |
| 49 | + uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5 |
| 50 | + with: |
| 51 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/cardano-node-leios |
| 52 | + tags: | |
| 53 | + type=sha |
| 54 | + type=ref,event=branch |
| 55 | + type=ref,event=pr |
| 56 | +
|
| 57 | + - name: Build cardano-node-leios image |
| 58 | + uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6 |
| 59 | + with: |
| 60 | + context: . |
| 61 | + file: ./antithesis/Dockerfile.cardano-node |
| 62 | + platforms: linux/amd64 |
| 63 | + push: ${{ github.event_name == 'push' || github.event.inputs.push_images == 'true' }} |
| 64 | + tags: ${{ steps.meta-cardano-node.outputs.tags }} |
| 65 | + labels: ${{ steps.meta-cardano-node.outputs.labels }} |
| 66 | + cache-from: type=gha,scope=cardano-node-leios |
| 67 | + cache-to: type=gha,mode=max,scope=cardano-node-leios |
| 68 | + |
| 69 | + - name: Extract metadata for cardano-node-bp |
| 70 | + id: meta-cardano-node-bp |
| 71 | + uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5 |
| 72 | + with: |
| 73 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/cardano-node-bp |
| 74 | + tags: | |
| 75 | + type=sha |
| 76 | + type=ref,event=branch |
| 77 | + type=ref,event=pr |
| 78 | +
|
| 79 | + - name: Build cardano-node-bp image |
| 80 | + uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6 |
| 81 | + with: |
| 82 | + context: . |
| 83 | + file: ./antithesis/Dockerfile.cardano-node-bp |
| 84 | + platforms: linux/amd64 |
| 85 | + push: ${{ github.event_name == 'push' || github.event.inputs.push_images == 'true' }} |
| 86 | + tags: ${{ steps.meta-cardano-node-bp.outputs.tags }} |
| 87 | + labels: ${{ steps.meta-cardano-node-bp.outputs.labels }} |
| 88 | + cache-from: type=gha,scope=cardano-node-bp |
| 89 | + cache-to: type=gha,mode=max,scope=cardano-node-bp |
| 90 | + |
| 91 | + - name: Extract metadata for immdb-server |
| 92 | + id: meta-immdb-server |
| 93 | + uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5 |
| 94 | + with: |
| 95 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/immdb-server |
| 96 | + tags: | |
| 97 | + type=sha |
| 98 | + type=ref,event=branch |
| 99 | + type=ref,event=pr |
| 100 | +
|
| 101 | + - name: Build immdb-server image |
| 102 | + uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6 |
| 103 | + with: |
| 104 | + context: . |
| 105 | + file: ./antithesis/Dockerfile.immdb-server |
| 106 | + platforms: linux/amd64 |
| 107 | + push: ${{ github.event_name == 'push' || github.event.inputs.push_images == 'true' }} |
| 108 | + tags: ${{ steps.meta-immdb-server.outputs.tags }} |
| 109 | + labels: ${{ steps.meta-immdb-server.outputs.labels }} |
| 110 | + cache-from: type=gha,scope=immdb-server |
| 111 | + cache-to: type=gha,mode=max,scope=immdb-server |
| 112 | + |
| 113 | + - name: Extract metadata for analysis |
| 114 | + id: meta-analysis |
| 115 | + uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5 |
| 116 | + with: |
| 117 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/leios-analysis |
| 118 | + tags: | |
| 119 | + type=sha |
| 120 | + type=ref,event=branch |
| 121 | + type=ref,event=pr |
| 122 | +
|
| 123 | + - name: Build analysis image |
| 124 | + uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6 |
| 125 | + with: |
| 126 | + context: . |
| 127 | + file: ./antithesis/Dockerfile.analysis |
| 128 | + platforms: linux/amd64 |
| 129 | + push: ${{ github.event_name == 'push' || github.event.inputs.push_images == 'true' }} |
| 130 | + tags: ${{ steps.meta-analysis.outputs.tags }} |
| 131 | + labels: ${{ steps.meta-analysis.outputs.labels }} |
| 132 | + cache-from: type=gha,scope=leios-analysis |
| 133 | + cache-to: type=gha,mode=max,scope=leios-analysis |
| 134 | + |
| 135 | + test-local: |
| 136 | + name: "Test local docker-compose stack" |
| 137 | + runs-on: ubuntu-22.04 |
| 138 | + needs: build-images |
| 139 | + timeout-minutes: 120 |
| 140 | + |
| 141 | + steps: |
| 142 | + - name: Checkout repository |
| 143 | + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 |
| 144 | + |
| 145 | + - name: Set up Docker Buildx |
| 146 | + uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3 |
| 147 | + |
| 148 | + - name: Run local test |
| 149 | + working-directory: ./antithesis |
| 150 | + run: | |
| 151 | + ./scripts/test-local.sh |
| 152 | + env: |
| 153 | + TEST_DURATION: 30 |
| 154 | + STARTUP_TIMEOUT: 300 |
| 155 | + ENABLE_WAN_EMULATION: true |
| 156 | + |
| 157 | + # ========================================================================== |
| 158 | + # Submit to Antithesis via Moog |
| 159 | + # ========================================================================== |
| 160 | + # Requires the following GitHub configuration: |
| 161 | + # |
| 162 | + # Secrets: |
| 163 | + # MOOG_GITHUB_PAT - GitHub PAT for Moog API access |
| 164 | + # MOOG_REQUESTER_WALLET - Base64-encoded Cardano preprod wallet JSON |
| 165 | + # |
| 166 | + # Variables: |
| 167 | + # MOOG_MPFS_HOST - MPFS service URL (default: https://mpfs.plutimus.com) |
| 168 | + # MOOG_REQUESTER - GitHub username registered as Moog requester |
| 169 | + # |
| 170 | + # Prerequisites: |
| 171 | + # - Requester registered with Moog (Ed25519 keypair, CODEOWNERS entry) |
| 172 | + # - CF Moog agent has whitelisted this repository |
| 173 | + # |
| 174 | + submit-antithesis: |
| 175 | + name: "Submit Antithesis test via Moog" |
| 176 | + runs-on: ubuntu-latest |
| 177 | + needs: build-images |
| 178 | + if: github.event_name == 'push' && github.ref == 'refs/heads/main' && secrets.MOOG_GITHUB_PAT != '' |
| 179 | + permissions: |
| 180 | + contents: read |
| 181 | + |
| 182 | + steps: |
| 183 | + - name: Checkout repository |
| 184 | + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 |
| 185 | + |
| 186 | + - name: Get latest Moog release tag |
| 187 | + id: moog-release |
| 188 | + run: | |
| 189 | + TAG=$(gh api repos/cardano-foundation/moog/releases/latest --jq '.tag_name') |
| 190 | + echo "tag=$TAG" >> "$GITHUB_OUTPUT" |
| 191 | + echo "Moog release: $TAG" |
| 192 | + env: |
| 193 | + GH_TOKEN: ${{ secrets.MOOG_GITHUB_PAT }} |
| 194 | + |
| 195 | + - name: Download and install Moog |
| 196 | + run: | |
| 197 | + gh release download "$MOOG_TAG" \ |
| 198 | + -R cardano-foundation/moog \ |
| 199 | + -p "moog-*-linux64.tar.gz" -O moog.tar.gz |
| 200 | + tar xzf moog.tar.gz |
| 201 | + sudo mv moog /usr/local/bin/ |
| 202 | + moog --version |
| 203 | + env: |
| 204 | + GH_TOKEN: ${{ secrets.MOOG_GITHUB_PAT }} |
| 205 | + MOOG_TAG: ${{ steps.moog-release.outputs.tag }} |
| 206 | + |
| 207 | + - name: Configure wallet |
| 208 | + run: echo "$MOOG_WALLET" | base64 -d > wallet.json |
| 209 | + env: |
| 210 | + MOOG_WALLET: ${{ secrets.MOOG_REQUESTER_WALLET }} |
| 211 | + |
| 212 | + - name: Submit test to Antithesis |
| 213 | + run: | |
| 214 | + echo "Submitting Antithesis test for commit ${GITHUB_SHA}..." |
| 215 | + moog requester create-test \ |
| 216 | + -d "antithesis/testnets/leios-devnet" \ |
| 217 | + -c "${GITHUB_SHA}" \ |
| 218 | + -r "${GITHUB_REPOSITORY}" \ |
| 219 | + -t 30 |
| 220 | + env: |
| 221 | + MOOG_GITHUB_PAT: ${{ secrets.MOOG_GITHUB_PAT }} |
| 222 | + MOOG_WALLET_FILE: wallet.json |
| 223 | + MOOG_MPFS_HOST: ${{ vars.MOOG_MPFS_HOST || 'https://mpfs.plutimus.com' }} |
| 224 | + MOOG_PLATFORM: github |
| 225 | + MOOG_REQUESTER: ${{ vars.MOOG_REQUESTER }} |
0 commit comments