Skip to content

Commit

Permalink
Fix test client workflow
Browse files Browse the repository at this point in the history
Use new client command interface.
  • Loading branch information
jpraynaud committed Jun 8, 2023
1 parent b080f5d commit b984e15
Showing 1 changed file with 31 additions and 18 deletions.
49 changes: 31 additions & 18 deletions .github/workflows/test-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,29 @@ jobs:
working-directory: ./bin
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} --version

- name: List and get last snapshot digest
- name: Snapshot / list and get last digest
shell: bash
working-directory: ./bin
run: |
./mithril-client ${{ steps.prepare.outputs.debug_level }} list
echo "SNAPSHOT_DIGEST=$(./mithril-client list --json | jq -r '.[0].digest')" >> $GITHUB_ENV
./mithril-client ${{ steps.prepare.outputs.debug_level }} snapshot list
echo "SNAPSHOT_DIGEST=$(./mithril-client snapshot list --json | jq -r '.[0].digest')" >> $GITHUB_ENV
- name: Download Latest Snapshot
- name: Snapshot / download & restore latest
shell: bash
working-directory: ./bin
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} download $SNAPSHOT_DIGEST

- name: Restore Latest Snapshot
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 }} restore $SNAPSHOT_DIGEST
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} mithril-stake-distribution verify $MITHRIL_STAKE_DISTRIBUTION_HASH

test-docker:
strategy:
Expand Down Expand Up @@ -131,23 +138,29 @@ jobs:
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' -v ~:/app/data -u $(id -u) ghcr.io/input-output-hk/mithril-client:$MITHRIL_IMAGE_ID" >> $GITHUB_OUTPUT
mkdir -p ~/client
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 ~/client:/app/data -u $(id -u) 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: List and get last snapshot digest
- name: Snapshot / list and get last digest
shell: bash
run: |
${{ steps.command.outputs.mithril_client }} list
echo "SNAPSHOT_DIGEST=$(${{ steps.command.outputs.mithril_client }} list --json | jq -r '.[0].digest')" >> $GITHUB_ENV
${{ 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: Download Latest Snapshot
- name: Snapshot / download & restore latest
shell: bash
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} download $SNAPSHOT_DIGEST

# We use the `--disable-digests-cache` option because the client is not able to create the /home/appuser/.cache directory otherwise
- name: Restore Latest Snapshot
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} snapshot download $SNAPSHOT_DIGEST

- 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 }} restore --disable-digests-cache $SNAPSHOT_DIGEST
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} mithril-stake-distribution verify $MITHRIL_STAKE_DISTRIBUTION_HASH

0 comments on commit b984e15

Please sign in to comment.