-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CORE-632] Add workflow to check sample_pregenesis is uptodate; sort …
…pregenesis file so ordering is deterministic (#652) (#656) * add workflow to check sample_pregenesis is uptodate * reuse protocol Dockerfile * nit * nit * update workflow trigger path (cherry picked from commit c17e215) Co-authored-by: Teddy Ding <[email protected]>
- Loading branch information
1 parent
a07e50c
commit 3643e0b
Showing
5 changed files
with
58 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Protocol Pregenesis | ||
|
||
on: # yamllint disable-line rule:truthy | ||
pull_request: | ||
paths: | ||
- protocol/** | ||
push: | ||
branches: | ||
- main | ||
- 'release/protocol/v0.[0-9]+.x' # e.g. release/protocol/v0.1.x | ||
- 'release/protocol/v[0-9]+.x' # e.g. release/protocol/v1.x | ||
paths: | ||
- protocol/** | ||
|
||
# Ensure only a single instance of this workflow is running, and cancel any that are in-progress | ||
# before this workflow instance starts | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
check-sample-pregenesis-up-to-date: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ./protocol | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Check Sample Pregenesis Up-to-date | ||
run: > | ||
make check-sample-pregenesis-up-to-date |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM dydxprotocol-base | ||
|
||
RUN apk add --no-cache bash dasel jq | ||
|
||
WORKDIR /workspace | ||
|
||
ENTRYPOINT ["sh", "/workspace/scripts/genesis/check_sample_pregenesis_uptodate.sh"] |
16 changes: 7 additions & 9 deletions
16
protocol/scripts/genesis/check_sample_pregenesis_uptodate.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
#!/bin/bash | ||
# This script checks `sample_pregenesis.json` is up to date with the result of running `prod_pregenesis.sh`. | ||
# Usage: % ./scripts/genesis/check_sample_pregenesis_uptodate.sh | ||
# Currently can only be run locally on macOS. | ||
# TODO(CORE-632): Make this script work on CI. | ||
echo "Building binary..." | ||
make build | ||
# Usage: make check-sample-pregenesis-up-to-date | ||
|
||
echo "Running prod_pregenesis.sh..." | ||
./scripts/genesis/prod_pregenesis.sh build/dydxprotocold | ||
./scripts/genesis/prod_pregenesis.sh dydxprotocold | ||
|
||
diff_output=$(diff "/tmp/prod-chain/.dydxprotocol/config/genesis.json" "./scripts/genesis/sample_pregenesis.json") | ||
echo "Diffing output against current sample_pregenesis.json..." | ||
diff_output=$(diff "/tmp/prod-chain/.dydxprotocol/config/sorted_genesis.json" "./scripts/genesis/sample_pregenesis.json") | ||
|
||
if [ -z "$diff_output" ]; then | ||
echo "./scripts/genesis/sample_pregenesis.json is up-to-date" | ||
else | ||
echo "./scripts/genesis/sample_pregenesis.json is not up-to-date" | ||
echo "./scripts/genesis/sample_pregenesis.json is not up-to-date. Run `make update-sample-pregenesis` to update." | ||
echo "$diff_output" | ||
exit 1 | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters