Skip to content
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

runtimes: add template mainnet runtime #1012

Merged
merged 16 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/merge-docker-chronicle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,3 @@ jobs:
build_args: |
VCS_REF=${{ needs.set-tags.outputs.commit_hash8 }}
PROFILE=${{ matrix.profile }}


1 change: 0 additions & 1 deletion .github/workflows/merge-docker-tester.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,3 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: docker.io
push: 'true'

2 changes: 1 addition & 1 deletion .github/workflows/merge-pages-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- 'node/**'
- 'pallets/**'
- 'primitives/**'
- 'runtime/**'
- 'runtimes/**'
- 'tc-subxt/**'
- 'tss/**'
- 'rust-toolchain.toml'
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/merge-srtool-runtime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,17 @@ jobs:
matrix:
include:
# Name denotes the artifact name in the workflow run
- name: mainnet
chain: mainnet
features: default
- name: staging
chain: mainnet
features: development
- name: testnet
chain: timechain
chain: testnet
features: default
- name: development
chain: timechain
chain: testnet
features: development
steps:
- name: Fetch latest code
Expand All @@ -47,7 +53,7 @@ jobs:
image: analoglabs/srtool
tag: 1.75.0
chain: ${{ matrix.chain }}
runtime_dir: "runtime"
runtime_dir: runtimes/${{ matrix.chain }}
- name: Srtool summary
run: |
echo '${{ steps.srtool_build.outputs.json }}' | jq . > timechain-srtool-digest.json
Expand Down
79 changes: 69 additions & 10 deletions .github/workflows/pr-optional-benchmarks.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,85 @@
# Triggered via !ci-benchmark tag
name: Update runtime benchmarks
name: Update runtime weights
on:
pull_request:
types: [labeled, unlabeled, opened, reopened, synchronize]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
update-benchmarks:
build-benchmark:
runs-on: [self-hosted, benchmark]
if: ${{ contains(github.event.pull_request.labels.*.name,'!ci-benchmark') }}
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
submodules: recursive
- name: Run benchmarking script
run: ./scripts/benchmarking.sh
- name: Commit updated weights
uses: EndBug/add-and-commit@v9
- name: Build runtime benchmarks
uses: ./.github/actions/cargo-command
with:
package: timechain-node
feature: runtime-benchmarks
- name: Upload runtime benchmarks
uses: actions/upload-artifact@v4
with:
name: runtime-benchmarks
if-no-files-found: error
path: target/release/timechain-node
run-benchmark:
needs: [build-benchmark]
runs-on: [self-hosted, benchmark]
continue-on-error: true
strategy:
fail-fast: false
matrix:
chain: [staging, development]
pallet: [elections, members, networks, shards, tasks, timegraph]
steps:
- name: Download runtime benchmarks
uses: actions/download-artifact@v4
with:
name: runtime-benchmarks
- name: Prepare runtime benchmarks
run: chmod +x timechain-node && mkdir -p weights
- name: Run runtime benchmarks
run: ./timechain-node benchmark pallet --chain ${{ matrix.chain }} --pallet pallet_${{ matrix.pallet }} --extrinsic '*' --output ./weights/${{ matrix.pallet }}.rs
- name: Upload weights
uses: actions/upload-artifact@v4
with:
add: './runtime/src/weights'
default_author: github_actions
author_name: Github Actions
message: 'Add generated weights'
name: weights-${{ matrix.chain }}-${{ matrix.pallet }}
if-no-files-found: error
path: weights/${{ matrix.pallet }}.rs
update-weights:
needs: [run-benchmark]
runs-on: [self-hosted, benchmark]
if: ${{ contains(github.event.pull_request.labels.*.name,'!ci-benchmark') && always() }}
continue-on-error: true
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
submodules: recursive
- name: Download mainnet weights
uses: actions/download-artifact@v4
continue-on-error: true
with:
path: runtimes/mainnet/src/weights
pattern: weights-staging-*
merge-multiple: true
- name: Download testnet weights
uses: actions/download-artifact@v4
continue-on-error: true
with:
path: runtimes/testnet/src/weights
pattern: weights-development-*
merge-multiple: true
- name: Commit updated weights
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.email "[email protected]"
git config user.name "Weights Update Bot"
git commit -am "runtimes: update pallet weights"
git push
2 changes: 1 addition & 1 deletion .github/workflows/pr-test-cargo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- 'node/**'
- 'pallets/**'
- 'primitives/**'
- 'runtime/**'
- 'runtimes/**'
- 'tc-subxt/**'
- 'tester/**'
- 'tss/**'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-test-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- 'node/**'
- 'pallets/**'
- 'primitives/**'
- 'runtime/**'
- 'runtimes/**'
- 'tc-subxt/**'
- 'tss/**'
- 'rust-toolchain.toml'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-test-rustfmt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- 'node/**'
- 'pallets/**'
- 'primitives/**'
- 'runtime/**'
- 'runtimes/**'
- 'tc-subxt/**'
- 'tester/**'
- 'tss/**'
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/pr-test-try_runtime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- '.github/workflows/pr-test-try_runtime.yaml'
- 'pallets/**'
- 'primitives/**'
- 'runtime/**'
- 'runtimes/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'rust-toolchain.toml'
Expand All @@ -16,6 +16,10 @@ concurrency:
jobs:
try-runtime:
runs-on: [self-hosted, general]
strategy:
fail-fast: false
matrix:
chain: [testnet]
steps:
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y librocksdb-dev
Expand All @@ -25,12 +29,12 @@ jobs:
uses: actions/checkout@v4
with:
submodules: recursive
- name: Build testnet runtime
- name: Build ${{ matrix.chain }} runtime
uses: ./.github/actions/cargo-command
with:
package: timechain-runtime
package: ${{ matrix.chain }}-runtime
feature: try-runtime
- name: Download current snapshot
run: curl -LO https://github.com/Analog-Labs/nomination-candidates/releases/download/v0.0.0/testnet.v118.snap
run: curl -LO https://github.com/Analog-Labs/nomination-candidates/releases/download/v0.0.0/${{ matrix.chain }}.v121.snap
- name: Run try-runtime test
run: try-runtime --runtime target/release/wbuild/timechain-runtime/timechain_runtime.wasm on-runtime-upgrade --checks all --disable-idempotency-checks snap --path testnet.v118.snap
run: try-runtime --runtime target/release/wbuild/${{ matrix.chain }}-runtime/${{ matrix.chain }}_runtime.wasm on-runtime-upgrade --checks all --disable-spec-version-check --disable-idempotency-checks snap --path ${{ matrix.chain }}.v121.snap
50 changes: 37 additions & 13 deletions .github/workflows/pr-update-metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- '.github/workflows/pr-update-metadata.yaml'
- 'pallets/**'
- 'primitives/**'
- 'runtime/**'
- 'runtimes/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'rust-toolchain.toml'
Expand All @@ -20,12 +20,18 @@ jobs:
fail-fast: false
matrix:
include:
- package: timechain-runtime
- package: mainnet-runtime
feature: default
crate: timechain_runtime
- package: timechain-runtime
crate: mainnet_runtime
- package: mainnet-runtime
feature: development
crate: timechain_runtime
crate: mainnet_runtime
- package: testnet-runtime
feature: default
crate: testnet_runtime
- package: testnet-runtime
feature: development
crate: testnet_runtime
steps:
- name: Checkout sources
uses: actions/checkout@v4
Expand Down Expand Up @@ -59,24 +65,42 @@ jobs:
with:
ref: ${{ github.head_ref }}
submodules: recursive
- name: Download Mainnet Metadata
id: download-mainnet-default
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: mainnet-runtime.default.scale
- name: Update Mainnet Metadata
if: steps.download-mainnet-default.outcome == 'success'
run: mv mainnet_runtime.metadata.scale config/subxt/mainnet.default.scale
- name: Download Staging Metadata
id: download-mainnet-development
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: mainnet-runtime.development.scale
- name: Update Staging Metadata
if: steps.download-mainnet-development.outcome == 'success'
run: mv mainnet_runtime.metadata.scale config/subxt/mainnet.development.scale
- name: Download Testnet Metadata
id: download-testnet-default-metadata
id: download-testnet-default
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: timechain-runtime.default.scale
name: testnet-runtime.default.scale
- name: Update Testnet Metadata
if: steps.download-testnet-default-metadata.outcome == 'success'
run: mv timechain_runtime.metadata.scale config/subxt/testnet.default.scale
if: steps.download-testnet-default.outcome == 'success'
run: mv testnet_runtime.metadata.scale config/subxt/testnet.default.scale
- name: Download Development Metadata
id: download-testnet-development-metadata
id: download-testnet-development
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: timechain-runtime.development.scale
name: testnet-runtime.development.scale
- name: Update Development Metadata
if: steps.download-testnet-development-metadata.outcome == 'success'
run: mv timechain_runtime.metadata.scale config/subxt/testnet.development.scale
if: steps.download-testnet-development.outcome == 'success'
run: mv testnet_runtime.metadata.scale config/subxt/testnet.development.scale
- name: Commit any changes to the metadata
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
Loading
Loading