Skip to content

Why Astar/Shibuya gas price is so HIGH? #615

Why Astar/Shibuya gas price is so HIGH?

Why Astar/Shibuya gas price is so HIGH? #615

Workflow file for this run

name: Benchmarks
on:
issue_comment:
types: [created]
jobs:
check-permission:
if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/bench')
runs-on: ubuntu-latest
steps:
- name: Check permission
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const response = await github.rest.repos.getCollaboratorPermissionLevel({
owner: context.repo.owner,
repo: context.repo.repo,
username: context.actor
});
const actorPermissionLevel = response.data.permission;
console.log(actorPermissionLevel);
// <- lower higher ->
// ["none", "read", "write", "admin"]
if (!(actorPermissionLevel == "admin" || actorPermissionLevel == "write")) {
core.setFailed("Permission denied.");
}
benchmarks:
# run only when PR comments start with '/bench'.
if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/bench')
needs: check-permission
runs-on: [self-hosted, Linux, X64]
steps:
- name: Validate and set inputs
id: bench-input
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const command = `${{ github.event.comment.body }}`.split(" ");
console.log(command);
// command should be '/bench chain_name pallets'
if (command.length != 3) {
core.setFailed("Invalid input. It should be '/bench [chain_name] [pallets]'");
}
core.setOutput("chain", command[1]);
core.setOutput("pallets", command[2]);
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- name: Get branch and sha
id: get_branch_sha
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
result-encoding: string
script: |
const pull_request = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
})
core.setOutput("branch", pull_request.data.head.ref)
core.setOutput("sha", pull_request.data.head.sha)
- name: Post starting comment
uses: actions/github-script@v6
env:
MESSAGE: |
Benchmarks job is scheduled at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}.
Please wait for a while.
Branch: ${{ steps.get_branch_sha.outputs.branch }}
SHA: ${{ steps.get_branch_sha.outputs.sha }}
with:
github-token: ${{secrets.GITHUB_TOKEN}}
result-encoding: string
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: process.env.MESSAGE
})
- name: Checkout the source code
uses: actions/checkout@v3
with:
ref: ${{ steps.get_branch_sha.outputs.sha }}
submodules: true
- name: Install deps
run: sudo apt -y install protobuf-compiler
- name: Install & display rust toolchain
run: rustup show
- name: Check targets are installed correctly
run: rustup target list --installed
- name: Execute benchmarking
run: |
mkdir -p ./benchmark-results
chmod +x ./scripts/run_benchmarks.sh
./scripts/run_benchmarks.sh -o ./benchmark-results -c ${{ steps.bench-input.outputs.chain }} -p ${{ steps.bench-input.outputs.pallets }}
- uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: ./benchmark-results
- name: Post success comment
if: ${{ success() }}
uses: actions/github-script@v6
env:
MESSAGE: |
Benchmarks have been finished.
You can download artifacts if exists ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}.
with:
github-token: ${{secrets.GITHUB_TOKEN}}
result-encoding: string
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: process.env.MESSAGE
})
- name: Post failure comment
if: ${{ failure() }}
uses: actions/github-script@v6
env:
MESSAGE: |
Benchmark job failed.
Please check ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}.
with:
github-token: ${{secrets.GITHUB_TOKEN}}
result-encoding: string
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: process.env.MESSAGE
})