From fca928aa9bafec82229d0675e3ade627e2a15622 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Raynaud Date: Mon, 6 Jan 2025 11:06:03 +0100 Subject: [PATCH] refactor: better input handling with 'workflow_call' in 'Backward compatibility' workflow --- .github/workflows/backward-compatibility.yml | 49 ++++++++------------ 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/.github/workflows/backward-compatibility.yml b/.github/workflows/backward-compatibility.yml index 20be74837e7..64de956aec7 100644 --- a/.github/workflows/backward-compatibility.yml +++ b/.github/workflows/backward-compatibility.yml @@ -2,6 +2,19 @@ name: Backward compatibility on: workflow_call: + inputs: + total-releases: + required: true + type: number + default: 3 + cardano-node-version: + required: true + type: string + default: "10.1.3" + signed-entity-types: + required: true + type: string + default: "CardanoTransactions,CardanoStakeDistribution" workflow_dispatch: inputs: total-releases: @@ -21,30 +34,8 @@ on: default: "CardanoTransactions,CardanoStakeDistribution" jobs: - prepare-env-variables: - runs-on: ubuntu-22.04 - outputs: - total_releases: ${{ steps.set-env.outputs.total_releases }} - cardano_node_version: ${{ steps.set-env.outputs.cardano_node_version }} - signed-entity-types: ${{ steps.set-env.outputs.signed-entity-types }} - steps: - - name: Prepare env variables - id: set-env - shell: bash - run: | - if [[ "${{ github.event_name }}" == "schedule" ]]; then - echo "total_releases=3" >> $GITHUB_OUTPUT - echo 'cardano_node_version=["10.1.3"]' >> $GITHUB_OUTPUT - echo 'signed-entity-types=CardanoTransactions,CardanoStakeDistribution' >> $GITHUB_OUTPUT - else - echo "total_releases=${{ inputs.total-releases }}" >> $GITHUB_OUTPUT - echo "cardano_node_version=[\"${{ inputs.cardano-node-version }}\"]" >> $GITHUB_OUTPUT - echo 'signed-entity-types=${{ inputs.signed-entity-types }}' >> $GITHUB_OUTPUT - fi - prepare-binaries: runs-on: ubuntu-22.04 - needs: [prepare-env-variables] outputs: tags: ${{ steps.tags-test-lab.outputs.tags }} steps: @@ -56,7 +47,7 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} shell: bash run: | - ./.github/workflows/scripts/download-distribution-binaries.sh ${{ needs.prepare-env-variables.outputs.total_releases }} + ./.github/workflows/scripts/download-distribution-binaries.sh ${{ inputs.total_releases }} - name: Install stable toolchain uses: dtolnay/rust-toolchain@master @@ -85,13 +76,13 @@ jobs: e2e: runs-on: ubuntu-22.04 - needs: [prepare-env-variables, prepare-binaries] + needs: [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) }} + cardano_node_version: ${{ fromJSON(inputs.cardano_node_version) }} run_id: ["#1"] steps: @@ -134,7 +125,7 @@ jobs: --cardano-node-version ${{ matrix.cardano_node_version }} \ --cardano-slot-length 0.25 \ --cardano-epoch-length 45.0 \ - --signed-entity-types ${{ needs.prepare-env-variables.outputs.signed-entity-types }} + --signed-entity-types ${{ inputs.signed-entity-types }} EXIT_CODE=$? if [ $EXIT_CODE -eq 0 ]; then echo "SUCCESS=true" >> $GITHUB_ENV @@ -200,7 +191,7 @@ jobs: summarize-test-results: runs-on: ubuntu-22.04 - needs: [prepare-env-variables, e2e] + needs: [e2e] if: success() || failure() steps: @@ -228,8 +219,8 @@ jobs: echo "This is the compatibility report of previous distributions nodes with the current unstable nodes." >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY - echo "**Signed entity types**: ${{ needs.prepare-env-variables.outputs.signed-entity-types }}" >> $GITHUB_STEP_SUMMARY - echo "**Cardano nodes**: ${{ needs.prepare-env-variables.outputs.cardano_node_version }}" >> $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