Benchmark Pallets #50
This file contains hidden or 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
| name: Benchmark Pallets | |
| on: | |
| push: | |
| branches: [master] | |
| paths: | |
| - 'polkadot-docs/parachains/customize-runtime/pallet-development/benchmark-pallet/**' | |
| - '!polkadot-docs/parachains/customize-runtime/pallet-development/benchmark-pallet/README.md' | |
| - 'versions.yml' | |
| pull_request: | |
| paths: | |
| - 'polkadot-docs/parachains/customize-runtime/pallet-development/benchmark-pallet/**' | |
| - '!polkadot-docs/parachains/customize-runtime/pallet-development/benchmark-pallet/README.md' | |
| - 'versions.yml' | |
| workflow_dispatch: | |
| jobs: | |
| guard: | |
| if: github.repository == 'polkadot-developers/polkadot-cookbook' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should-run: ${{ steps.check.outputs.should-run }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - id: check | |
| uses: ./.github/actions/check-version-keys | |
| with: | |
| event-name: ${{ github.event_name }} | |
| base-sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }} | |
| head-sha: ${{ github.sha }} | |
| test: | |
| needs: guard | |
| if: needs.guard.outputs.should-run == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Load versions | |
| id: versions | |
| run: | | |
| echo "TEMPLATE_VERSION=$(yq '.parachain_template.version' versions.yml)" >> $GITHUB_OUTPUT | |
| - name: Setup Rust | |
| run: | | |
| cd polkadot-docs/parachains/customize-runtime/pallet-development/benchmark-pallet | |
| rustup show | |
| - name: Add wasm target and rust-src | |
| run: | | |
| rustup target add wasm32-unknown-unknown | |
| rustup component add rust-src | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Cache Cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Install system dependencies | |
| run: sudo apt-get update && sudo apt-get install -y protobuf-compiler | |
| - name: Cache parachain template build | |
| uses: actions/cache@v4 | |
| id: cache-parachain-template | |
| with: | |
| path: polkadot-docs/parachains/customize-runtime/pallet-development/benchmark-pallet/.test-workspace/parachain-template | |
| key: ${{ runner.os }}-parachain-template-${{ steps.versions.outputs.TEMPLATE_VERSION }}-${{ hashFiles('polkadot-docs/parachains/customize-runtime/pallet-development/benchmark-pallet/rust-toolchain.toml') }} | |
| - name: Clean cached template for fresh test | |
| if: steps.cache-parachain-template.outputs.cache-hit == 'true' | |
| run: | | |
| cd polkadot-docs/parachains/customize-runtime/pallet-development/benchmark-pallet/.test-workspace/parachain-template | |
| git checkout -- . | |
| git clean -fd -e target/ | |
| - name: Install npm dependencies | |
| run: | | |
| cd polkadot-docs/parachains/customize-runtime/pallet-development/benchmark-pallet | |
| npm ci | |
| - name: Run tests | |
| run: | | |
| cd polkadot-docs/parachains/customize-runtime/pallet-development/benchmark-pallet | |
| npm test | |
| timeout-minutes: 45 | |
| post-test: | |
| needs: [guard, test] | |
| if: github.repository == 'polkadot-developers/polkadot-cookbook' && needs.guard.outputs.should-run == 'true' && always() && github.ref == 'refs/heads/master' | |
| uses: ./.github/workflows/post-cleanup.yml | |
| with: | |
| test_result: ${{ needs.test.result }} | |
| readme_path: 'polkadot-docs/parachains/customize-runtime/pallet-development/benchmark-pallet/README.md' | |
| workflow_name: 'Benchmark Pallet' | |
| permissions: | |
| contents: read | |
| issues: write |