Backward compatibility #80
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Backward compatibility | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| total-releases: | |
| description: "Total number of releases to test" | |
| required: true | |
| type: number | |
| default: 3 | |
| cardano-node-version: | |
| description: "Cardano node version used in e2e" | |
| required: true | |
| type: string | |
| default: "10.5.1" | |
| signed-entity-types: | |
| description: "Signed entity types parameters (discriminants names in an ordered comma separated list)" | |
| required: true | |
| type: string | |
| default: "CardanoTransactions,CardanoStakeDistribution,CardanoDatabase,CardanoImmutableFilesFull" | |
| release-to-test: | |
| description: "Release to test against the latest published releases" | |
| required: true | |
| type: string | |
| default: "unstable" | |
| e2e-release: | |
| description: "Release used to build the end-to-end binary" | |
| required: true | |
| type: string | |
| default: "unstable" | |
| workflow_call: | |
| inputs: | |
| total-releases: | |
| type: number | |
| default: 3 | |
| cardano-node-version: | |
| type: string | |
| default: "10.5.1" | |
| signed-entity-types: | |
| type: string | |
| default: "CardanoTransactions,CardanoStakeDistribution,CardanoDatabase,CardanoImmutableFilesFull" | |
| release-to-test: | |
| type: string | |
| default: "unstable" | |
| e2e-release: | |
| type: string | |
| default: "unstable" | |
| jobs: | |
| prepare-env-variables: | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| cardano_node_version: ${{ steps.set-env.outputs.cardano_node_version }} | |
| steps: | |
| - name: Prepare env variables | |
| id: set-env | |
| shell: bash | |
| run: | | |
| echo "cardano_node_version=[\"${{ inputs.cardano-node-version }}\"]" >> $GITHUB_OUTPUT | |
| prepare-binaries: | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| tags: ${{ steps.tags-test-lab.outputs.tags }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Download releases artifacts binaries | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| shell: bash | |
| run: | | |
| ./.github/workflows/scripts/download-distribution-binaries.sh ${{ inputs.total-releases }} ${{ inputs.release-to-test }} | |
| - name: Install stable toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| - name: Build e2e | |
| shell: bash | |
| run: | | |
| git checkout ${{ inputs.e2e-release }} | |
| cargo build --release --bin mithril-end-to-end | |
| mkdir -p ./mithril-binaries/e2e-${{ inputs.e2e-release }} | |
| cp ./target/release/mithril-end-to-end ./mithril-binaries/e2e-${{ inputs.e2e-release }} | |
| - name: Upload Mithril binaries | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: mithril-binaries | |
| path: ./mithril-binaries | |
| - name: Prepare test lab tags | |
| id: tags-test-lab | |
| shell: bash | |
| run: | | |
| TAGS=$(jq -c '.' ./mithril-binaries/tags.json) | |
| echo "Test Lab Tags: $TAGS" | |
| echo "tags=$TAGS" >> $GITHUB_OUTPUT | |
| e2e: | |
| runs-on: ubuntu-24.04 | |
| needs: [prepare-env-variables, prepare-binaries] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| tag: ${{ fromJSON(needs.prepare-binaries.outputs.tags) }} | |
| node: [mithril-aggregator, mithril-client, mithril-signer] | |
| cardano_node_version: ${{ fromJSON(needs.prepare-env-variables.outputs.cardano_node_version) }} | |
| run_id: ["#1"] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Download binaries | |
| uses: actions/download-artifact@v6 | |
| with: | |
| name: mithril-binaries | |
| path: ./mithril-binaries | |
| - name: Prepare binaries | |
| shell: bash | |
| run: | | |
| mkdir -p mithril-binaries/e2e | |
| cp ./mithril-binaries/e2e-${{ inputs.e2e-release }}/* ./mithril-binaries/e2e | |
| cp ./mithril-binaries/${{ inputs.release-to-test }}/* ./mithril-binaries/e2e | |
| cp --remove-destination ./mithril-binaries/${{ matrix.tag }}/${{ matrix.node }} ./mithril-binaries/e2e/ | |
| chmod +x ./mithril-binaries/e2e/mithril-aggregator | |
| chmod +x ./mithril-binaries/e2e/mithril-client | |
| chmod +x ./mithril-binaries/e2e/mithril-signer | |
| chmod +x ./mithril-binaries/e2e/mithril-relay | |
| chmod +x ./mithril-binaries/e2e/mithril-end-to-end | |
| mkdir artifacts | |
| - name: Run E2E tests | |
| uses: nick-fields/retry@v3 | |
| with: | |
| shell: bash | |
| max_attempts: 3 | |
| retry_on_exit_code: 2 | |
| timeout_minutes: 10 | |
| warning_on_retry: true | |
| command: | | |
| ./mithril-binaries/e2e/mithril-end-to-end -vvv \ | |
| --bin-directory ./mithril-binaries/e2e \ | |
| --work-directory=./artifacts \ | |
| --devnet-scripts-directory=./mithril-test-lab/mithril-devnet \ | |
| --cardano-node-version ${{ matrix.cardano_node_version }} \ | |
| --cardano-slot-length 0.25 \ | |
| --cardano-epoch-length 45.0 \ | |
| --signed-entity-types ${{ inputs.signed-entity-types }} | |
| EXIT_CODE=$? | |
| if [ $EXIT_CODE -eq 0 ]; then | |
| echo "RESULT=success" >> $GITHUB_ENV | |
| elif [ $EXIT_CODE -eq 3 ]; then | |
| echo "RESULT=incompatible" >> $GITHUB_ENV | |
| exit 0 | |
| else | |
| echo "RESULT=failure" >> $GITHUB_ENV | |
| fi | |
| exit $EXIT_CODE | |
| - name: Define the JSON file name for the test result | |
| shell: bash | |
| if: success() || failure() | |
| run: echo "RESULT_FILE_NAME=e2e-test-result-run_${{ github.run_number }}-attempt_${{ github.run_attempt }}-tag_${{ matrix.tag }}-node-${{ matrix.node }}-cardano-${{ matrix.cardano_node_version }}-run_id_${{ matrix.run_id }}" >> $GITHUB_ENV | |
| - name: Write test result JSON | |
| if: success() || failure() | |
| shell: bash | |
| run: | | |
| AGGREGATOR_TAG="${{ inputs.release-to-test }}" | |
| SIGNER_TAG="${{ inputs.release-to-test }}" | |
| CLIENT_TAG="${{ inputs.release-to-test }}" | |
| case "$NODE" in | |
| mithril-aggregator) | |
| AGGREGATOR_TAG="${{ matrix.tag }}" | |
| ;; | |
| mithril-signer) | |
| SIGNER_TAG="${{ matrix.tag }}" | |
| ;; | |
| mithril-client) | |
| CLIENT_TAG="${{ matrix.tag }}" | |
| ;; | |
| esac | |
| jq -n --arg TAG "${{ matrix.tag }}" \ | |
| --arg NODE "${{ matrix.node }}" \ | |
| --arg CARDANO_NODE "${{ matrix.cardano_node_version }}" \ | |
| --arg AGGREGATOR "$AGGREGATOR_TAG" \ | |
| --arg SIGNER "$SIGNER_TAG" \ | |
| --arg CLIENT "$CLIENT_TAG" \ | |
| --arg RESULT "${{ env.RESULT }}" \ | |
| '{tag: $TAG, node: $NODE, mithril_signer: $SIGNER, mithril_aggregator: $AGGREGATOR, mithril_client: $CLIENT, cardano_node_version: $CARDANO_NODE, result: $RESULT}' \ | |
| > ./${{ env.RESULT_FILE_NAME }}.json | |
| - name: Upload test result JSON | |
| if: success() || failure() | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: ${{ env.RESULT_FILE_NAME }} | |
| path: ./${{ env.RESULT_FILE_NAME }}.json | |
| - name: Upload E2E Tests Artifacts | |
| if: ${{ failure() }} | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: mithril-e2e-tests-artifacts-run_${{ github.run_number }}-attempt_${{ github.run_attempt }}-tag_${{ matrix.tag }}-node-${{ matrix.node }}-cardano-${{ matrix.cardano_node_version }}-run_id_${{ matrix.run_id }} | |
| path: | | |
| ./artifacts/* | |
| # including node.sock makes the upload fails so exclude them: | |
| !./artifacts/**/node.sock | |
| # exclude cardano tools, saving ~500mb of data: | |
| !./artifacts/devnet/bin/ | |
| if-no-files-found: error | |
| summarize-test-results: | |
| runs-on: ubuntu-24.04 | |
| needs: [e2e] | |
| if: success() || failure() | |
| steps: | |
| - name: Download all test result artifacts | |
| uses: actions/download-artifact@v6 | |
| with: | |
| path: ./test-results | |
| pattern: e2e-test-result* | |
| merge-multiple: true | |
| - name: Concatenate JSON result files into summary.json | |
| shell: bash | |
| run: | | |
| jq -s '.' ./test-results/e2e-test-result-*.json > ./test-results/summary.json | |
| - name: Add distributions backward compatibility summary | |
| shell: bash | |
| run: | | |
| CHECK_MARK=":heavy_check_mark:" | |
| WARN_MARK=":warning:" | |
| CROSS_MARK=":no_entry:" | |
| echo "## Distributions backward compatibility" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "This is the compatibility report of the latest distributions against **'${{ inputs.release-to-test }}'**." >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Signed entity types**: ${{ inputs.signed-entity-types }}" >> $GITHUB_STEP_SUMMARY | |
| echo "**Cardano nodes**: ${{ inputs.cardano-node-version }}" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| Compatibility | mithril-signer | mithril-aggregator | mithril-client |" >> $GITHUB_STEP_SUMMARY | |
| echo "| --- | :---: | :---: | :---: |" >> $GITHUB_STEP_SUMMARY | |
| # Transform summary.json into Markdown table rows | |
| jq -r --arg CHECK_MARK "$CHECK_MARK" --arg WARN_MARK "$WARN_MARK" --arg CROSS_MARK "$CROSS_MARK" \ | |
| 'def parseresult(result): if result == "success" then $CHECK_MARK elif result == "incompatible" then $WARN_MARK else $CROSS_MARK end; | |
| group_by(.tag) | sort_by(.[0].tag | sub("-[a-z]+$"; "") | tonumber) | reverse | | |
| .[] | | |
| { | |
| tag: .[0].tag, | |
| signer: (map(select(.node == "mithril-signer") | parseresult(.result)) | join("")), | |
| aggregator: (map(select(.node == "mithril-aggregator") | parseresult(.result)) | join("")), | |
| client: (map(select(.node == "mithril-client") | parseresult(.result)) | join("")) | |
| } | | |
| "| `\(.tag)` | \(.signer) | \(.aggregator) | \(.client) |"' "./test-results/summary.json" >> $GITHUB_STEP_SUMMARY | |
| cat "$GITHUB_STEP_SUMMARY" |