Skip to content

ci: add nightly backward compatibility testing with e2e tests #2063

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 3 commits into from
Oct 30, 2024
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
92 changes: 92 additions & 0 deletions .github/workflows/nightly-backward-compatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Nightly backward compatibility

on:
schedule:
- cron: "0 2 * * *"
- cron: "0 14 * * *"
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: "9.2.1"

jobs:
prepare-binaries:
runs-on: ubuntu-22.04
outputs:
tags: ${{ steps.tags-test-lab.outputs.tags }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download releases artifacts binaries
run: |
./.github/workflows/scripts/download-distribution-binaries.sh ${{ inputs.total-releases }

- name: Build e2e
run: |
cargo build --release --bin mithril-end-to-end
cp ./target/release/mithril-end-to-end ./mithril-binaries/unstable

- name: Upload Mithril binaries
uses: actions/upload-artifact@v4
with:
name: mithril-binaries
path: ./mithril-binaries

- name: Prepare test lab tags
id: tags-test-lab
run: |
TAGS=$(cat ./mithril-binaries/tags.json)
echo "Test Lab Tags: $TAGS"
echo "tags=$TAGS" >> $GITHUB_OUTPUT

e2e:
runs-on: ubuntu-22.04
needs: [prepare-binaries]
strategy:
fail-fast: false
matrix:
tag: ${{ fromJSON(needs.prepare-binaries.outputs.tags) }}
node:
[mithril-aggregator, mithril-client, mithril-signer, mithril-relay]
cardano_node_version: ${{ inputs.cardano-node-version }}
run_id: ["#1"]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download binaries
uses: actions/download-artifact@v4
with:
name: mithril-binaries
path: ./mithril-binaries

- name: Prepare binaries
run: |
mkdir -p mithril-binaries/e2e
cp ./mithril-binaries/unstable/* ./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
run: |
./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 }}
22 changes: 22 additions & 0 deletions .github/workflows/scripts/download-distribution-binaries.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#! /bin/bash

set -e

TOTAL_RELEASES=$1
ASSETS_DIRECTORY="./mithril-binaries"
TAG_FILE=$ASSETS_DIRECTORY/tags.json

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

TAG_NAMES=$(cat $TAG_FILE | jq -r '.[]' | tr '\n' ' ')
for TAG_NAME in unstable $TAG_NAMES
do
echo ">>>> Retrieving artifacts for release ${TAG_NAME}"
ARCHIVE_DIRECTORY="./mithril-binaries/$TAG_NAME"
mkdir -p $ARCHIVE_DIRECTORY
gh release download --repo input-output-hk/mithril $TAG_NAME -O mithril-archive --pattern "mithril-$TAG_NAME*-linux-x64.tar.gz"
tar xzf mithril-archive -C $ARCHIVE_DIRECTORY mithril-aggregator mithril-signer mithril-client mithril-relay
rm mithril-archive
done