-
Notifications
You must be signed in to change notification settings - Fork 41
161 lines (140 loc) · 6.52 KB
/
test-client.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: Mithril Client multi-platform test
on:
workflow_dispatch:
inputs:
commit_sha:
description: |
SHA of the commit on which the mithril-client binary should be obtained, a "ci.yml" workflow must have run
on it else no binary would be available leading to the failure of this.
If not provided the last commit on the main branch will be used instead.
required: false
type: string
docker_image_id:
description: The selected Docker image id.
required: true
type: string
default: latest
network:
description: The name of the selected Cardano network.
required: true
type: string
default: preview
aggregator_endpoint:
description: The endpoint of the selected aggregator of the Mithril network.
required: true
type: string
default: https://aggregator.pre-release-preview.api.mithril.network/aggregator
genesis_verification_key:
description: The genesis verification key location for the Mithril network.
required: false
type: string
default: https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/pre-release-preview/genesis.vkey
enable_debug:
description: Enable debug output ("-vvv") for the mithril-client calls
required: true
type: boolean
default: false
jobs:
test-binaries:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-22.04, macos-12, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Prepare environment variables
id: prepare
shell: bash
run: |
if [[ -n "${{ inputs.commit_sha }}" ]]; then
echo "sha=${{ inputs.commit_sha }}" >> $GITHUB_OUTPUT
else
echo "branch=main" >> $GITHUB_OUTPUT
fi
if [[ "${{ inputs.enable_debug }}" == "true" ]]; then
echo "debug_level=-vvv" >> $GITHUB_OUTPUT
fi
echo "NETWORK=${{ inputs.network }}" >> $GITHUB_ENV
echo "AGGREGATOR_ENDPOINT=${{ inputs.aggregator_endpoint }}" >> $GITHUB_ENV
echo "GENESIS_VERIFICATION_KEY=$(curl -s ${{ inputs.genesis_verification_key }})" >> $GITHUB_ENV
- name: Checkout binary
uses: dawidd6/action-download-artifact@v2
with:
name: mithril-distribution-${{ runner.os }}-${{ runner.arch }}
path: ./bin
commit: ${{ steps.prepare.outputs.sha }}
branch: ${{ steps.prepare.outputs.branch }}
workflow: ci.yml
workflow_conclusion: success
- name: Set permissions
shell: bash
working-directory: ./bin
run: chmod +x ./mithril-client
- name: Show client version
shell: bash
working-directory: ./bin
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} --version
- name: Snapshot / list and get last digest
shell: bash
working-directory: ./bin
run: |
./mithril-client ${{ steps.prepare.outputs.debug_level }} snapshot list
echo "SNAPSHOT_DIGEST=$(./mithril-client snapshot list --json | jq -r '.[0].digest')" >> $GITHUB_ENV
- name: Snapshot / download & restore latest
shell: bash
working-directory: ./bin
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} snapshot download $SNAPSHOT_DIGEST
- name: Mithril Stake Distribution / list and get last hash
shell: bash
working-directory: ./bin
run: |
./mithril-client ${{ steps.prepare.outputs.debug_level }} mithril-stake-distribution list
echo "MITHRIL_STAKE_DISTRIBUTION_HASH=$(./mithril-client mithril-stake-distribution list --json | jq -r '.[0].hash')" >> $GITHUB_ENV
- name: Mithril Stake Distribution / download & restore latest
shell: bash
working-directory: ./bin
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} mithril-stake-distribution download $MITHRIL_STAKE_DISTRIBUTION_HASH
test-docker:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-22.04 ]
runs-on: ${{ matrix.os }}
steps:
- name: Prepare environment variables
id: prepare
shell: bash
run: |
if [[ "${{ inputs.enable_debug }}" == "true" ]]; then
echo "debug_level=-vvv" >> $GITHUB_OUTPUT
fi
echo "MITHRIL_IMAGE_ID=${{ inputs.docker_image_id }}" >> $GITHUB_ENV
echo "NETWORK=${{ inputs.network }}" >> $GITHUB_ENV
echo "AGGREGATOR_ENDPOINT=${{ inputs.aggregator_endpoint }}" >> $GITHUB_ENV
echo "GENESIS_VERIFICATION_KEY=$(curl -s ${{ inputs.genesis_verification_key }})" >> $GITHUB_ENV
- name: Prepare Mithril client command
id: command
shell: bash
run: |
echo "mithril_client=docker run --rm -e NETWORK=$NETWORK -e GENESIS_VERIFICATION_KEY=$GENESIS_VERIFICATION_KEY -e AGGREGATOR_ENDPOINT=$AGGREGATOR_ENDPOINT --name='mithril-client' ghcr.io/input-output-hk/mithril-client:$MITHRIL_IMAGE_ID" >> $GITHUB_OUTPUT
- name: Show client version
shell: bash
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} --version
- name: Snapshot / list and get last digest
shell: bash
run: |
${{ steps.command.outputs.mithril_client }} snapshot list
echo "SNAPSHOT_DIGEST=$(${{ steps.command.outputs.mithril_client }} snapshot list --json | jq -r '.[0].digest')" >> $GITHUB_ENV
- name: Snapshot / download & restore latest
shell: bash
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} snapshot download $SNAPSHOT_DIGEST --download-dir /app
- name: Mithril Stake Distribution / list and get last hash
shell: bash
run: |
${{ steps.command.outputs.mithril_client }} mithril-stake-distribution list
echo "MITHRIL_STAKE_DISTRIBUTION_HASH=$(${{ steps.command.outputs.mithril_client }} mithril-stake-distribution list --json | jq -r '.[0].hash')" >> $GITHUB_ENV
- name: Mithril Stake Distribution / download & restore latest
shell: bash
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} mithril-stake-distribution download $MITHRIL_STAKE_DISTRIBUTION_HASH --download-dir /app