Skip to content

Commit fdf68f5

Browse files
authored
Merge pull request #2083 from input-output-hk/ensemble/2027/enhance-nightly-backward-compatibility-testing-workflow
CI: enhance nightly backward compatibility testing workflow
2 parents fcca57d + 1ad5f1d commit fdf68f5

File tree

1 file changed

+153
-14
lines changed

1 file changed

+153
-14
lines changed

.github/workflows/nightly-backward-compatibility.yml

Lines changed: 153 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
name: Nightly backward compatibility
22

33
on:
4+
# Important note about scheduled workflows:
5+
# Notifications for scheduled workflows are sent to the user who last modified the cron syntax in the workflow file.
46
schedule:
5-
- cron: "0 2 * * *"
6-
- cron: "0 14 * * *"
7+
- cron: "30 2 * * *"
78
workflow_dispatch:
89
inputs:
910
total-releases:
@@ -15,22 +16,50 @@ on:
1516
description: "Cardano node version used in e2e"
1617
required: true
1718
type: string
18-
default: "10.1.1"
19+
default: "10.1.2"
1920

2021
jobs:
22+
prepare-env-variables:
23+
runs-on: ubuntu-22.04
24+
outputs:
25+
total_releases: ${{ steps.set-env.outputs.total_releases }}
26+
cardano_node_version: ${{ steps.set-env.outputs.cardano_node_version }}
27+
steps:
28+
- name: Prepare env variables
29+
id: set-env
30+
shell: bash
31+
run: |
32+
if [[ "${{ github.event_name }}" == "schedule" ]]; then
33+
echo "total_releases=3" >> $GITHUB_OUTPUT
34+
echo 'cardano_node_version=["10.1.2"]' >> $GITHUB_OUTPUT
35+
else
36+
echo "total_releases=${{ inputs.total-releases }}" >> $GITHUB_OUTPUT
37+
echo "cardano_node_version=[\"${{ inputs.cardano-node-version }}\"]" >> $GITHUB_OUTPUT
38+
fi
39+
2140
prepare-binaries:
2241
runs-on: ubuntu-22.04
42+
needs: [prepare-env-variables]
2343
outputs:
2444
tags: ${{ steps.tags-test-lab.outputs.tags }}
2545
steps:
2646
- name: Checkout
2747
uses: actions/checkout@v4
2848

2949
- name: Download releases artifacts binaries
50+
env:
51+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
shell: bash
3053
run: |
31-
./.github/workflows/scripts/download-distribution-binaries.sh ${{ inputs.total-releases }
54+
./.github/workflows/scripts/download-distribution-binaries.sh ${{ needs.prepare-env-variables.outputs.total_releases }}
55+
56+
- name: Install stable toolchain
57+
uses: dtolnay/rust-toolchain@master
58+
with:
59+
toolchain: stable
3260

3361
- name: Build e2e
62+
shell: bash
3463
run: |
3564
cargo build --release --bin mithril-end-to-end
3665
cp ./target/release/mithril-end-to-end ./mithril-binaries/unstable
@@ -43,21 +72,21 @@ jobs:
4372

4473
- name: Prepare test lab tags
4574
id: tags-test-lab
75+
shell: bash
4676
run: |
47-
TAGS=$(cat ./mithril-binaries/tags.json)
77+
TAGS=$(jq -c '.' ./mithril-binaries/tags.json)
4878
echo "Test Lab Tags: $TAGS"
4979
echo "tags=$TAGS" >> $GITHUB_OUTPUT
5080
5181
e2e:
5282
runs-on: ubuntu-22.04
53-
needs: [prepare-binaries]
83+
needs: [prepare-env-variables, prepare-binaries]
5484
strategy:
5585
fail-fast: false
5686
matrix:
5787
tag: ${{ fromJSON(needs.prepare-binaries.outputs.tags) }}
58-
node:
59-
[mithril-aggregator, mithril-client, mithril-signer, mithril-relay]
60-
cardano_node_version: ${{ inputs.cardano-node-version }}
88+
node: [mithril-aggregator, mithril-client, mithril-signer]
89+
cardano_node_version: ${{ fromJSON(needs.prepare-env-variables.outputs.cardano_node_version) }}
6190
run_id: ["#1"]
6291

6392
steps:
@@ -71,6 +100,7 @@ jobs:
71100
path: ./mithril-binaries
72101

73102
- name: Prepare binaries
103+
shell: bash
74104
run: |
75105
mkdir -p mithril-binaries/e2e
76106
cp ./mithril-binaries/unstable/* ./mithril-binaries/e2e
@@ -84,9 +114,118 @@ jobs:
84114
mkdir artifacts
85115
86116
- name: Run E2E tests
117+
shell: bash
87118
run: |
88-
./mithril-binaries/e2e/mithril-end-to-end -vvv \\
89-
--bin-directory ./mithril-binaries/e2e \\
90-
--work-directory=./artifacts \\
91-
--devnet-scripts-directory=./mithril-test-lab/mithril-devnet \\
92-
--cardano-node-version ${{ matrix.cardano_node_version }}
119+
./mithril-binaries/e2e/mithril-end-to-end -vvv \
120+
--bin-directory ./mithril-binaries/e2e \
121+
--work-directory=./artifacts \
122+
--devnet-scripts-directory=./mithril-test-lab/mithril-devnet \
123+
--cardano-node-version ${{ matrix.cardano_node_version }} \
124+
--cardano-slot-length 0.25 \
125+
--cardano-epoch-length 45.0 \
126+
&& echo "SUCCESS=true" >> $GITHUB_ENV \
127+
|| (echo "SUCCESS=false" >> $GITHUB_ENV && exit 1)
128+
129+
- name: Define the JSON file name for the test result
130+
shell: bash
131+
if: success() || failure()
132+
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
133+
134+
- name: Write test result JSON
135+
if: success() || failure()
136+
shell: bash
137+
run: |
138+
AGGREGATOR_TAG="unstable"
139+
SIGNER_TAG="unstable"
140+
CLIENT_TAG="unstable"
141+
142+
case "$NODE" in
143+
mithril-aggregator)
144+
AGGREGATOR_TAG="${{ matrix.tag }}"
145+
;;
146+
mithril-signer)
147+
SIGNER_TAG="${{ matrix.tag }}"
148+
;;
149+
mithril-client)
150+
CLIENT_TAG="${{ matrix.tag }}"
151+
;;
152+
esac
153+
154+
jq -n --arg TAG "${{ matrix.tag }}" \
155+
--arg NODE "${{ matrix.node }}" \
156+
--arg CARDANO_NODE "${{ matrix.cardano_node_version }}" \
157+
--arg AGGREGATOR "$AGGREGATOR_TAG" \
158+
--arg SIGNER "$SIGNER_TAG" \
159+
--arg CLIENT "$CLIENT_TAG" \
160+
--argjson SUCCESS "${{ env.SUCCESS }}" \
161+
'{tag: $TAG, node: $NODE, mithril_signer: $SIGNER, mithril_aggregator: $AGGREGATOR, mithril_client: $CLIENT, cardano_node_version: $CARDANO_NODE, success: $SUCCESS}' \
162+
> ./${{ env.RESULT_FILE_NAME }}.json
163+
164+
- name: Upload test result JSON
165+
if: success() || failure()
166+
uses: actions/upload-artifact@v4
167+
with:
168+
name: ${{ env.RESULT_FILE_NAME }}
169+
path: ./${{ env.RESULT_FILE_NAME }}.json
170+
171+
- name: Upload E2E Tests Artifacts
172+
if: ${{ failure() }}
173+
uses: actions/upload-artifact@v4
174+
with:
175+
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 }}
176+
path: |
177+
./artifacts/*
178+
# including node.sock makes the upload fails so exclude them:
179+
!./artifacts/**/node.sock
180+
# exclude cardano tools, saving ~50mb of data:
181+
!./artifacts/devnet/cardano-cli
182+
!./artifacts/devnet/cardano-node
183+
if-no-files-found: error
184+
185+
summarize-test-results:
186+
runs-on: ubuntu-22.04
187+
needs: [e2e]
188+
if: success() || failure()
189+
190+
steps:
191+
- name: Download all test result artifacts
192+
uses: actions/download-artifact@v4
193+
with:
194+
path: ./test-results
195+
pattern: e2e-test-result*
196+
merge-multiple: true
197+
198+
- name: Concatenate JSON result files into summary.json
199+
shell: bash
200+
run: |
201+
jq -s '.' ./test-results/e2e-test-result-*.json > ./test-results/summary.json
202+
203+
- name: Add distributions backward compatibility summary
204+
shell: bash
205+
run: |
206+
CHECK_MARK=":heavy_check_mark:"
207+
CROSS_MARK=":no_entry:"
208+
209+
echo "## Distributions backward compatibility" >> $GITHUB_STEP_SUMMARY
210+
echo "" >> $GITHUB_STEP_SUMMARY
211+
212+
echo "This is the compatibility report of previous distributions nodes with the current unstable nodes." >> $GITHUB_STEP_SUMMARY
213+
echo "" >> $GITHUB_STEP_SUMMARY
214+
215+
echo "| Compatibility | mithril-signer | mithril-aggregator | mithril-client |" >> $GITHUB_STEP_SUMMARY
216+
echo "| --- | :---: | :---: | :---: |" >> $GITHUB_STEP_SUMMARY
217+
218+
# Transform summary.json into Markdown table rows
219+
jq -r --arg CHECK_MARK "$CHECK_MARK" --arg CROSS_MARK "$CROSS_MARK" \
220+
'group_by(.tag) |
221+
sort_by(.[0].tag | tonumber) | reverse |
222+
.[] |
223+
{
224+
tag: .[0].tag,
225+
signer: (map(select(.node == "mithril-signer") | if .success then $CHECK_MARK else $CROSS_MARK end) | join("")),
226+
aggregator: (map(select(.node == "mithril-aggregator") | if .success then $CHECK_MARK else $CROSS_MARK end) | join("")),
227+
client: (map(select(.node == "mithril-client") | if .success then $CHECK_MARK else $CROSS_MARK end) | join(""))
228+
} |
229+
"| `\(.tag)` | \(.signer) | \(.aggregator) | \(.client) |"' "./test-results/summary.json" >> $GITHUB_STEP_SUMMARY
230+
231+
cat "$GITHUB_STEP_SUMMARY"

0 commit comments

Comments
 (0)