Skip to content

Commit 459d644

Browse files
authored
Merge pull request #793 from input-output-hk/jpraynaud/791-update-test-client-workflow
Update `Mithril Client multi-platform test` workflow
2 parents 85fbf1c + d8e4880 commit 459d644

File tree

1 file changed

+63
-20
lines changed

1 file changed

+63
-20
lines changed

.github/workflows/test-client.yml

Lines changed: 63 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,34 @@ on:
1111
If not provided the last commit on the main branch will be used instead.
1212
required: false
1313
type: string
14+
docker_image_id:
15+
description: The selected Docker image id.
16+
required: true
17+
type: string
18+
default: latest
1419
network:
20+
description: The name of the selected Cardano network.
1521
required: true
1622
type: string
1723
default: preview
1824
aggregator_endpoint:
25+
description: The endpoint of the selected aggregator of the Mithril network.
1926
required: true
2027
type: string
2128
default: https://aggregator.pre-release-preview.api.mithril.network/aggregator
2229
genesis_verification_key:
23-
description: The genesis verification key, if empty the "TEST_ONLY_genesis.vkey" file at the project root will be used
30+
description: The genesis verification key location for the Mithril network.
2431
required: false
2532
type: string
33+
default: https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/pre-release-preview/genesis.vkey
2634
enable_debug:
2735
description: Enable debug output ("-vvv") for the mithril-client calls
2836
required: true
29-
type: bool
37+
type: boolean
3038
default: false
3139

3240
jobs:
33-
test:
41+
test-binaries:
3442
strategy:
3543
fail-fast: false
3644
matrix:
@@ -54,23 +62,9 @@ jobs:
5462
echo "debug_level=-vvv" >> $GITHUB_OUTPUT
5563
fi
5664
57-
if [[ -n "${{ inputs.network }}" ]]; then
58-
echo "NETWORK=${{ inputs.network }}" >> $GITHUB_ENV
59-
else
60-
echo "NETWORK=preview" >> $GITHUB_ENV
61-
fi
62-
63-
if [[ -n "${{ inputs.aggregator_endpoint }}" ]]; then
64-
echo "AGGREGATOR_ENDPOINT=${{ inputs.aggregator_endpoint }}" >> $GITHUB_ENV
65-
else
66-
echo "AGGREGATOR_ENDPOINT=https://aggregator.pre-release-preview.api.mithril.network/aggregator" >> $GITHUB_ENV
67-
fi
68-
69-
if [[ -n "${{ inputs.genesis_verification_key }}" ]]; then
70-
echo "GENESIS_VERIFICATION_KEY=${{ inputs.genesis_verification_key }}" >> $GITHUB_ENV
71-
else
72-
echo "GENESIS_VERIFICATION_KEY=$(cat TEST_ONLY_genesis.vkey)" >> $GITHUB_ENV
73-
fi
65+
echo "NETWORK=${{ inputs.network }}" >> $GITHUB_ENV
66+
echo "AGGREGATOR_ENDPOINT=${{ inputs.aggregator_endpoint }}" >> $GITHUB_ENV
67+
echo "GENESIS_VERIFICATION_KEY=$(curl -s ${{ inputs.genesis_verification_key }})" >> $GITHUB_ENV
7468
7569
- name: Checkout binary
7670
uses: dawidd6/action-download-artifact@v2
@@ -108,3 +102,52 @@ jobs:
108102
shell: bash
109103
working-directory: ./bin
110104
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} restore $SNAPSHOT_DIGEST
105+
106+
test-docker:
107+
strategy:
108+
fail-fast: false
109+
matrix:
110+
os: [ ubuntu-22.04 ]
111+
runs-on: ${{ matrix.os }}
112+
steps:
113+
- name: Setup Docker
114+
uses: docker-practice/actions-setup-docker@master
115+
timeout-minutes: 10
116+
117+
- name: Prepare environment variables
118+
id: prepare
119+
shell: bash
120+
run: |
121+
if [[ "${{ inputs.enable_debug }}" == "true" ]]; then
122+
echo "debug_level=-vvv" >> $GITHUB_OUTPUT
123+
fi
124+
125+
echo "MITHRIL_IMAGE_ID=${{ inputs.docker_image_id }}" >> $GITHUB_ENV
126+
echo "NETWORK=${{ inputs.network }}" >> $GITHUB_ENV
127+
echo "AGGREGATOR_ENDPOINT=${{ inputs.aggregator_endpoint }}" >> $GITHUB_ENV
128+
echo "GENESIS_VERIFICATION_KEY=$(curl -s ${{ inputs.genesis_verification_key }})" >> $GITHUB_ENV
129+
130+
- name: Prepare Mithril client command
131+
id: command
132+
shell: bash
133+
run: |
134+
echo "mithril_client=docker run --rm -e NETWORK=$NETWORK -e GENESIS_VERIFICATION_KEY=$GENESIS_VERIFICATION_KEY -e AGGREGATOR_ENDPOINT=$AGGREGATOR_ENDPOINT --name='mithril-client' -v ~:/app/data -u $(id -u) ghcr.io/input-output-hk/mithril-client:$MITHRIL_IMAGE_ID" >> $GITHUB_OUTPUT
135+
136+
- name: Show client version
137+
shell: bash
138+
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} --version
139+
140+
- name: List and get last snapshot digest
141+
shell: bash
142+
run: |
143+
${{ steps.command.outputs.mithril_client }} list
144+
echo "SNAPSHOT_DIGEST=$(${{ steps.command.outputs.mithril_client }} list --json | jq -r '.[0].digest')" >> $GITHUB_ENV
145+
146+
- name: Download Latest Snapshot
147+
shell: bash
148+
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} download $SNAPSHOT_DIGEST
149+
150+
# We use the `--disable-digests-cache` option because the client is not able to create the /home/appuser/.cache directory otherwise
151+
- name: Restore Latest Snapshot
152+
shell: bash
153+
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} restore --disable-digests-cache $SNAPSHOT_DIGEST

0 commit comments

Comments
 (0)