Skip to content

Commit a776b3d

Browse files
authored
Merge pull request #2658 from input-output-hk/dlachaume/2093/enhance-backward-compatibility-workflow
ci: add support for testing a specific release in `Backward compatibility` workflow
2 parents f36d00f + c98bde1 commit a776b3d

File tree

2 files changed

+46
-11
lines changed

2 files changed

+46
-11
lines changed

.github/workflows/backward-compatibility.yml

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ on:
1818
required: true
1919
type: string
2020
default: "CardanoTransactions,CardanoStakeDistribution,CardanoDatabase,CardanoImmutableFilesFull"
21+
release-to-test:
22+
description: "Release to test against the latest published releases"
23+
required: true
24+
type: string
25+
default: "unstable"
26+
e2e-release:
27+
description: "Release used to build the end-to-end binary"
28+
required: true
29+
type: string
30+
default: "unstable"
2131
workflow_call:
2232
inputs:
2333
total-releases:
@@ -29,6 +39,12 @@ on:
2939
signed-entity-types:
3040
type: string
3141
default: "CardanoTransactions,CardanoStakeDistribution,CardanoDatabase,CardanoImmutableFilesFull"
42+
release-to-test:
43+
type: string
44+
default: "unstable"
45+
e2e-release:
46+
type: string
47+
default: "unstable"
3248

3349
jobs:
3450
prepare-env-variables:
@@ -49,13 +65,16 @@ jobs:
4965
steps:
5066
- name: Checkout
5167
uses: actions/checkout@v4
68+
with:
69+
fetch-depth: 0
70+
fetch-tags: true
5271

5372
- name: Download releases artifacts binaries
5473
env:
5574
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5675
shell: bash
5776
run: |
58-
./.github/workflows/scripts/download-distribution-binaries.sh ${{ inputs.total-releases }}
77+
./.github/workflows/scripts/download-distribution-binaries.sh ${{ inputs.total-releases }} ${{ inputs.release-to-test }}
5978
6079
- name: Install stable toolchain
6180
uses: dtolnay/rust-toolchain@master
@@ -65,8 +84,10 @@ jobs:
6584
- name: Build e2e
6685
shell: bash
6786
run: |
87+
git checkout ${{ inputs.e2e-release }}
6888
cargo build --release --bin mithril-end-to-end
69-
cp ./target/release/mithril-end-to-end ./mithril-binaries/unstable
89+
mkdir -p ./mithril-binaries/e2e-${{ inputs.e2e-release }}
90+
cp ./target/release/mithril-end-to-end ./mithril-binaries/e2e-${{ inputs.e2e-release }}
7091
7192
- name: Upload Mithril binaries
7293
uses: actions/upload-artifact@v4
@@ -107,7 +128,8 @@ jobs:
107128
shell: bash
108129
run: |
109130
mkdir -p mithril-binaries/e2e
110-
cp ./mithril-binaries/unstable/* ./mithril-binaries/e2e
131+
cp ./mithril-binaries/e2e-${{ inputs.e2e-release }}/* ./mithril-binaries/e2e
132+
cp ./mithril-binaries/${{ inputs.release-to-test }}/* ./mithril-binaries/e2e
111133
cp --remove-destination ./mithril-binaries/${{ matrix.tag }}/${{ matrix.node }} ./mithril-binaries/e2e/
112134
113135
chmod +x ./mithril-binaries/e2e/mithril-aggregator
@@ -151,9 +173,9 @@ jobs:
151173
if: success() || failure()
152174
shell: bash
153175
run: |
154-
AGGREGATOR_TAG="unstable"
155-
SIGNER_TAG="unstable"
156-
CLIENT_TAG="unstable"
176+
AGGREGATOR_TAG="${{ inputs.release-to-test }}"
177+
SIGNER_TAG="${{ inputs.release-to-test }}"
178+
CLIENT_TAG="${{ inputs.release-to-test }}"
157179
158180
case "$NODE" in
159181
mithril-aggregator)
@@ -224,7 +246,7 @@ jobs:
224246
echo "## Distributions backward compatibility" >> $GITHUB_STEP_SUMMARY
225247
echo "" >> $GITHUB_STEP_SUMMARY
226248
227-
echo "This is the compatibility report of previous distributions nodes with the current unstable nodes." >> $GITHUB_STEP_SUMMARY
249+
echo "This is the compatibility report of the latest distributions against **'${{ inputs.release-to-test }}'**." >> $GITHUB_STEP_SUMMARY
228250
echo "" >> $GITHUB_STEP_SUMMARY
229251
230252
echo "**Signed entity types**: ${{ inputs.signed-entity-types }}" >> $GITHUB_STEP_SUMMARY

.github/workflows/scripts/download-distribution-binaries.sh

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,28 @@
33
set -e
44

55
TOTAL_RELEASES=$1
6+
TAG_TO_TEST=$2
67
ASSETS_DIRECTORY="./mithril-binaries"
78
TAG_FILE=$ASSETS_DIRECTORY/tags.json
9+
TAGS_TO_COMPARE=()
810

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

13-
TAG_NAMES=$(cat $TAG_FILE | jq -r '.[]' | tr '\n' ' ')
14-
for TAG_NAME in unstable $TAG_NAMES
14+
for TAG in $LATEST_TAGS; do
15+
if [[ "$TAG" == "$TAG_TO_TEST" ]]; then
16+
continue
17+
fi
18+
TAGS_TO_COMPARE+=("$TAG")
19+
done
20+
21+
printf '%s\n' "${TAGS_TO_COMPARE[@]}" | jq -R -s -c 'split("\n") | map(select(. != ""))' > "$TAG_FILE"
22+
23+
TAGS_TO_DOWNLOAD=("$TAG_TO_TEST" "${TAGS_TO_COMPARE[@]}")
24+
echo ">> Downloading Mithril distribution binaries"
25+
echo ">> Release to test: $TAG_TO_TEST"
26+
echo ">> Releases to be tested against: ${TAGS_TO_COMPARE[*]}"
27+
for TAG_NAME in "${TAGS_TO_DOWNLOAD[@]}"
1528
do
1629
echo ">>>> Retrieving artifacts for release ${TAG_NAME}"
1730
ARCHIVE_DIRECTORY="./mithril-binaries/$TAG_NAME"

0 commit comments

Comments
 (0)