Skip to content

Bump actions/checkout from 5 to 6 #36

Bump actions/checkout from 5 to 6

Bump actions/checkout from 5 to 6 #36

name: Try Runtime (PR)
on:
pull_request:
types: [labeled, synchronize, reopened]
permissions:
contents: read
pull-requests: write
concurrency:
group: pr-${{ github.event.pull_request.number }}-try-runtime
cancel-in-progress: true
env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
jobs:
try-runtime:
if: contains(github.event.pull_request.labels.*.name, 'try-runtime')
runs-on: ubuntu-latest
strategy:
matrix:
runtime:
- name: darwinia-runtime
uri: wss://rpc.darwinia.network
- name: crab-runtime
uri: ws://g1.crab2.darwinia.network:9944
steps:
- name: Checkout PR code (unprivileged)
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
- name: Resolve flags from labels
id: flags
run: |
labels='${{ toJson(github.event.pull_request.labels.*.name) }}'
echo "$labels" > labels.txt
spec=false
idemp=false
grep -q 'try-runtime:skip-spec-check' labels.txt && spec=true
grep -q 'try-runtime:skip-idempotency' labels.txt && idemp=true
echo "disable_spec=$spec" >> "$GITHUB_OUTPUT"
echo "disable_idemp=$idemp" >> "$GITHUB_OUTPUT"
- name: Try-Runtime
id: tr
uses: hack-ink/polkadot-runtime-releaser/action/[email protected]
with:
runtime: ${{ matrix.runtime.name }}
features: try-runtime
toolchain-ver: 1.82.0
try-runtime-ver: 0.8.0
disable-spec-version-check: ${{ steps.flags.outputs.disable_spec }}
disable-idempotency-checks: ${{ steps.flags.outputs.disable_idemp }}
uri: ${{ matrix.runtime.uri }}
- name: Collect summary
if: always()
run: |
mkdir -p out
{
echo "### Try Runtime Result"
echo "- PR: #${{ github.event.pull_request.number }}"
echo "- Commit: \`${{ github.event.pull_request.head.sha }}\`"
echo "- Runtime: \`${{ matrix.runtime.name }}\`"
echo "- URI: \`${{ matrix.runtime.uri }}\`"
echo "- Disable spec-version check: \`${{ steps.flags.outputs.disable_spec }}\`"
echo "- Disable idempotency checks: \`${{ steps.flags.outputs.disable_idemp }}\`"
echo "- Conclusion: **${{ job.status }}**"
} > "out/summary-${{ matrix.runtime.name }}.md"
- name: Upload artifacts (fallback for forks)
if: always()
uses: actions/upload-artifact@v4
with:
name: try-runtime-${{ github.event.pull_request.number }}
path: out/
- name: Post comment to PR
if: always()
uses: actions/github-script@v8
with:
script: |
const fs = require('fs');
const files = fs.readdirSync('out').filter(f => f.endsWith('.md'));
let body = `### 🧪 Try Runtime Results (conclusion: **${{ job.status }}**)\n\n`;
for (const f of files) {
body += `<details><summary>${f}</summary>\n\n` + fs.readFileSync(`out/${f}`, 'utf8') + `\n\n</details>\n`;
}
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ${{ github.event.pull_request.number }},
body
});
- name: Remove trigger labels
if: always()
uses: actions-ecosystem/action-remove-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
number: ${{ github.event.pull_request.number }}
labels: |
try-runtime
try-runtime:skip-spec-check
try-runtime:skip-idempotency