Skip to content

ci: add support for testing a specific release in Backward compatibility workflow #2658

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 29 additions & 7 deletions .github/workflows/backward-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ on:
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:
Expand All @@ -29,6 +39,12 @@ on:
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:
Expand All @@ -49,13 +65,16 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
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 }}
./.github/workflows/scripts/download-distribution-binaries.sh ${{ inputs.total-releases }} ${{ inputs.release-to-test }}

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@master
Expand All @@ -65,8 +84,10 @@ jobs:
- name: Build e2e
shell: bash
run: |
git checkout ${{ inputs.e2e-release }}
cargo build --release --bin mithril-end-to-end
cp ./target/release/mithril-end-to-end ./mithril-binaries/unstable
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@v4
Expand Down Expand Up @@ -107,7 +128,8 @@ jobs:
shell: bash
run: |
mkdir -p mithril-binaries/e2e
cp ./mithril-binaries/unstable/* ./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
Expand Down Expand Up @@ -151,9 +173,9 @@ jobs:
if: success() || failure()
shell: bash
run: |
AGGREGATOR_TAG="unstable"
SIGNER_TAG="unstable"
CLIENT_TAG="unstable"
AGGREGATOR_TAG="${{ inputs.release-to-test }}"
SIGNER_TAG="${{ inputs.release-to-test }}"
CLIENT_TAG="${{ inputs.release-to-test }}"

case "$NODE" in
mithril-aggregator)
Expand Down Expand Up @@ -224,7 +246,7 @@ jobs:
echo "## Distributions backward compatibility" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

echo "This is the compatibility report of previous distributions nodes with the current unstable nodes." >> $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
Expand Down
21 changes: 17 additions & 4 deletions .github/workflows/scripts/download-distribution-binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,28 @@
set -e

TOTAL_RELEASES=$1
TAG_TO_TEST=$2
ASSETS_DIRECTORY="./mithril-binaries"
TAG_FILE=$ASSETS_DIRECTORY/tags.json
TAGS_TO_COMPARE=()

echo ">> Retrieving artifacts for last ${TOTAL_RELEASES} releases and unstable"
mkdir -p $ASSETS_DIRECTORY
gh api /repos/input-output-hk/mithril/releases | jq -r --argjson TOTAL $TOTAL_RELEASES '[.[] | select(.prerelease == false)] | [.[:$TOTAL][].tag_name]' >> $TAG_FILE
LATEST_TAGS=$(gh api /repos/input-output-hk/mithril/releases | jq -r '[.[] | select(.prerelease == false)][].tag_name' | head -n "$TOTAL_RELEASES")

TAG_NAMES=$(cat $TAG_FILE | jq -r '.[]' | tr '\n' ' ')
for TAG_NAME in unstable $TAG_NAMES
for TAG in $LATEST_TAGS; do
if [[ "$TAG" == "$TAG_TO_TEST" ]]; then
continue
fi
TAGS_TO_COMPARE+=("$TAG")
done

printf '%s\n' "${TAGS_TO_COMPARE[@]}" | jq -R -s -c 'split("\n") | map(select(. != ""))' > "$TAG_FILE"

TAGS_TO_DOWNLOAD=("$TAG_TO_TEST" "${TAGS_TO_COMPARE[@]}")
echo ">> Downloading Mithril distribution binaries"
echo ">> Release to test: $TAG_TO_TEST"
echo ">> Releases to be tested against: ${TAGS_TO_COMPARE[*]}"
for TAG_NAME in "${TAGS_TO_DOWNLOAD[@]}"
do
echo ">>>> Retrieving artifacts for release ${TAG_NAME}"
ARCHIVE_DIRECTORY="./mithril-binaries/$TAG_NAME"
Expand Down
Loading