runtimes: add template mainnet runtime #140
Workflow file for this run
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
# Triggered via !ci-benchmark tag | |
name: Update runtime benchmarks | |
on: | |
pull_request: | |
types: [labeled, unlabeled, opened, reopened, synchronize] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
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: 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] | |
if: ${{ contains(github.event.pull_request.labels.*.name,'!ci-benchmark') }} | |
strategy: | |
fail-fast: false | |
matrix: | |
chain: [mainnet, testnet] | |
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 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: | |
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') }} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} | |
submodules: recursive | |
- name: Download mainnet weights | |
uses: actions/download-artifact@v4 | |
with: | |
path: runtimes/mainnet/weights | |
pattern: weights-mainnet-* | |
merge-multiple: true | |
- name: Download testnet weights | |
uses: actions/download-artifact@v4 | |
with: | |
path: runtimes/testnet/weights | |
pattern: weights-testnet-* | |
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 |