Skip to content

Commit

Permalink
Create subsystem-benchmarks.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
mordamax committed Aug 9, 2024
1 parent 12539e7 commit b261ff0
Showing 1 changed file with 87 additions and 0 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/subsystem-benchmarks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# The actions takes json file as input and runs github-action-benchmark for it.

on:
push:
branches:
- master
pull_request:
types: [ opened, synchronize, reopened, closed, labeled ]
merge_group:

permissions:
contents: read
pull-requests: write

env:
ARTIFACTS_NAME: subsystem-benchmarks_${{ github.sha }}

jobs:
build:
# TODO: remove once migration is complete or this workflow is fully stable
# if: contains(github.event.label.name, 'GHA-migration')
runs-on: ubuntu-latest
container:
image: paritytech/ci-unified:latest
env:
BENCH_DIR: ./charts/bench/${{ matrix.features.bench }}
BENCH_FILE: ${{ matrix.features.bench }}.json
strategy:
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: Run Benchmarks
continue-on-error: true
run: |
cargo bench -p ${{ matrix.features.name }} --bench ${{ matrix.features.bench }} --features subsystem-benchmarks
mkdir -p $BENCH_DIR || echo "Directory exists"
cp charts/$BENCH_FILE $BENCH_DIR
- name: Convert benchmark result to GH Pages
uses: benchmark-action/github-action-benchmark@v1
with:
tool: "customSmallerIsBetter"
name: ${{ env.BENCH_DIR }}
output-file-path: ${{ env.BENCH_FILE }}
benchmark-data-dir-path: ${{ env.BENCH_DIR }}
github-token: ${{ github.token }}
comment-on-alert: ${{ github.event_name == 'pull_request' }} # will comment on PRs if regression is detected
auto-push: false # will be pushed to artifacts and then pushed on publish step

- name: Upload artifacts
if: ${{ github.ref == 'refs/heads/master' }}
uses: actions/[email protected]
with:
name: ${{ env.ARTIFACTS_NAME }}
path: ./charts

publish:
# TODO: unblock once the gitlab publish is removed
# TODO: when enabled: cleanup publish-subsystem-benchmarks.yml workflow
if: false
runs-on: ubuntu-latest
needs: build
environment: subsystem-benchmarks
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download artifacts
uses: actions/[email protected]
with:
${{ env.ARTIFACTS_NAME }}

- 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: push

0 comments on commit b261ff0

Please sign in to comment.