-
Notifications
You must be signed in to change notification settings - Fork 78
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
Update chain specs periodically through the CI #939
Merged
Merged
Changes from 21 commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
688bccd
Update chain specs periodically through the CI
tomaka 576e809
Upload as artifact instead
tomaka 00c9ed8
More work
tomaka a9fff36
Run it when pushing
tomaka cd05aed
Don't put quotes around chain ID
tomaka bd27275
Fix paths
tomaka 769ed74
Don't fail-fast
tomaka 0296d0f
Fix jq call
tomaka b4c909e
Try create a PR
tomaka 82bbd5a
More tweaks
tomaka 51f11e7
Tweak
tomaka c62d73c
Forgot to checkout
tomaka 42c6850
Don't upload everything lol
tomaka 6a8fdee
Change branch name
tomaka 6c728b6
Tweaks
tomaka bb6e248
Flag to cp
tomaka 1432427
Comment
tomaka a4c7b96
Fix cp
tomaka ffc97f4
Do the extension separately
tomaka 99a0373
Tweak PR body
tomaka 91254ab
Small comment
tomaka b63faa5
Update checkpoints in chain specifications (#946)
github-actions[bot] 17d29f0
Empty commit to retrigger the PR
tomaka 858ac5c
Use main branch
tomaka 28b1829
Checkout main branch
tomaka 70b2404
Retrigger workflow
tomaka 970b6d2
Retrigger workflow
tomaka 0ce5777
Use different token
tomaka da8479b
Merge branch 'main' into tka-update-chain-specs-ci
tomaka 9a45661
Retrigger action
tomaka 0b9dac5
Try this
tomaka c2cec75
Retrigger action
tomaka f3c34c8
Try generate token on the fly
tomaka 84da0bb
Try passing nothing
tomaka 6d63b5c
Retrigger action
tomaka 186805d
Restore the secrets
tomaka 3343dcd
Pin version
tomaka 24ed8b5
Revert "Pin version"
tomaka f3a147b
Retrigger action
tomaka 7b5ee6f
Retrigger action
tomaka 6de0b75
Retrigger action
tomaka 7072bc8
Retrigger action
tomaka e91d2ff
Retrigger action
tomaka a660d5a
Retrigger action
tomaka 773e444
Retrigger action
tomaka b8f6bd5
Retrigger action
tomaka ccff4d0
Use GH_TOKEN 🤷
tomaka e9587ba
Adjust PR body
tomaka 62a2c6e
Remove testing code
tomaka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,82 @@ | ||
name: chain-specs-periodic-update | ||
|
||
on: | ||
push: | ||
branches: [ tka-update-chain-specs-ci ] # TODO: remove before merging, I'm just testing | ||
schedule: | ||
- cron: '0 8 * * *' # every day at 8am | ||
|
||
|
||
jobs: | ||
download-spec: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
# This starts one parallel job for each of these addresses. | ||
rpc-node-address: [ | ||
"wss://rpc.polkadot.io", | ||
"wss://kusama-rpc.polkadot.io", | ||
"wss://westend-rpc.polkadot.io", | ||
"wss://rococo-rpc.polkadot.io" | ||
] | ||
fail-fast: false # Don't automatically cancel the jobs of the other RPC nodes if one fails | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
path: repo | ||
- run: | | ||
curl -L -O https://github.com/vi/websocat/releases/download/v1.9.0/websocat_linux64 | ||
chmod +x websocat_linux64 | ||
- run: | | ||
echo '{"id":1,"jsonrpc":"2.0","method":"sync_state_genSyncSpec","params":[true]}' | | ||
./websocat_linux64 -n1 -B 99999999 ${{ matrix.rpc-node-address }} | | ||
jq .result > chain_spec.json | ||
- id: get-chain-id # Reads the `id` field in the newly-downloaded chain spec | ||
run: echo "::set-output name=id::`jq -r .id ./chain_spec.json`" | ||
- run: | # Overwrite the `lightSyncState` field of the existing chain spec with the value of spec that's been downloaded. | ||
tmp=$(mktemp) | ||
output=./repo/packages/connect/src/connector/specs/${{ steps.get-chain-id.outputs.id }}.json | ||
jq --slurpfile downloaded ./chain_spec.json '.lightSyncState = $downloaded[0].lightSyncState' "$output" > "$tmp" | ||
mv "$tmp" "$output" | ||
- run: | # Do the same as the previous step, but for the chain spec of the extension. This is done separately in case the spec is not the same with the one in `connect` | ||
tmp=$(mktemp) | ||
output=./repo/projects/extension/public/assets/${{ steps.get-chain-id.outputs.id }}.json | ||
jq --slurpfile downloaded ./chain_spec.json '.lightSyncState = $downloaded[0].lightSyncState' "$output" > "$tmp" | ||
mv "$tmp" "$output" | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: chain-spec-${{ steps.get-chain-id.outputs.id }} | ||
# Note that passing `repo/**` maintains paths under `repo`. This is a bit of magic by the upload-artifact action. | ||
path: | | ||
repo/**/${{ steps.get-chain-id.outputs.id }}.json | ||
|
||
create-pr: | ||
runs-on: ubuntu-latest | ||
if: ${{ always() }} # Run this job even if one of the steps of download-spec has failed | ||
needs: download-spec | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
path: repo | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
# Since we're not passing a name, this automatically downloads *all* artifacts | ||
# Unfortunately, this creates intermediary directories. | ||
path: . | ||
- run: cp -r ./chain-spec-*/* ./repo | ||
- uses: peter-evans/create-pull-request@v4 | ||
with: | ||
path: repo | ||
branch: automatic-checkpoints-update | ||
title: Update checkpoints in chain specifications | ||
# Note that the `download-spec` job above fails if the downloaded specification doesn't | ||
# correspond to an existing file. It is therefore impossible that the pull request | ||
# accidentally adds new specifications. | ||
body: > | ||
This pull request has been automatically generated by downloading chain | ||
specifications from various JSON-RPC endpoints and extracting their checkpoints. | ||
commit-message: Update checkpoints in chain specifications | ||
delete-branch: true |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When approved, I'll remove this line before merging. It's there just so that I can test if it work.