Skip to content

Preflight workflow test #150

Preflight workflow test

Preflight workflow test #150

name: Subsystem Benchmarks
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
set-image:
# GitHub Actions allows using 'env' in a container context.
# However, env variables don't work for forks: https://github.com/orgs/community/discussions/44322
# This workaround sets the container image for each job using 'set-image' job output.
runs-on: ubuntu-latest
outputs:
IMAGE: ${{ steps.set_image.outputs.IMAGE }}
steps:
- name: Checkout
uses: actions/checkout@v4
- id: set_image
run: cat .github/env >> $GITHUB_OUTPUT
build:
timeout-minutes: 80
needs: [set-image]
runs-on: arc-runners-polkadot-sdk-benchmark
container:
image: ${{ needs.set-image.outputs.IMAGE }}
strategy:
fail-fast: false
matrix:
features: [
{
name: "polkadot-availability-recovery",
bench: "availability-recovery-regression-bench",
},
# {
# name: "polkadot-availability-distribution",
# bench: "availability-distribution-regression-bench",
# },
# {
# name: "polkadot-node-core-approval-voting",
# bench: "approval-voting-regression-bench",
# },
{
name: "polkadot-statement-distribution",
bench: "statement-distribution-regression-bench",
},
]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check Rust
run: |
rustup show
rustup +nightly show
- name: Run Benchmarks
id: run-benchmarks
run: |
forklift cargo bench -p ${{ matrix.features.name }} --bench ${{ matrix.features.bench }} --features subsystem-benchmarks || echo "Benchmarks failed"
ls -lsa ./charts
- name: Upload artifacts
uses: actions/upload-artifact@v4.3.6
with:
name: ${{matrix.features.bench}}
path: ./charts
publish-benchmarks:
timeout-minutes: 60
needs: [build]
if: github.ref == 'refs/heads/master'
environment: subsystem-benchmarks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: gh-pages
fetch-depth: 0
- run: git checkout master --
- name: Download artifacts
uses: actions/download-artifact@v4.1.8
with:
path: ./charts
- name: Setup git & copy artifacts
run: |
# Fixes "detected dubious ownership" error in the ci
git config --global --add safe.directory '*'
ls -lsR ./charts
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.POLKADOTSDK_GHPAGES_APP_ID }}
private-key: ${{ secrets.POLKADOTSDK_GHPAGES_APP_KEY }}
- name: Generate ${{ env.BENCH }}
env:
BENCH: availability-recovery-regression-bench
uses: benchmark-action/github-action-benchmark@v1
with:
tool: "customSmallerIsBetter"
name: ${{ env.BENCH }}
output-file-path: ./charts/${{ env.BENCH }}/${{ env.BENCH }}.json
benchmark-data-dir-path: ./bench/${{ env.BENCH }}
github-token: ${{ steps.app-token.outputs.token }}
auto-push: true
- name: Generate ${{ env.BENCH }}
env:
BENCH: statement-distribution-regression-bench
uses: benchmark-action/github-action-benchmark@v1
with:
tool: "customSmallerIsBetter"
name: ${{ env.BENCH }}
output-file-path: ./charts/${{ env.BENCH }}/${{ env.BENCH }}.json
benchmark-data-dir-path: ./bench/${{ env.BENCH }}
github-token: ${{ steps.app-token.outputs.token }}
auto-push: true
- run: |
ls -lsaR ./bench
ls -lsaR ./charts
git status
git diff
# - name: Push changes
# run: |
# git config --global user.email "action@github.com"
# git config --global user.name "GitHub Action"
# git remote remove origin
# git remote add origin https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/${{ github.repository }}
# git status
# git diff
# git add ./bench
# git commit -m "Update subsystem benchmarks"
# git push --set-upstream origin gh-pages