Skip to content

GHA pipeline rewrite for ease and speed #7

GHA pipeline rewrite for ease and speed

GHA pipeline rewrite for ease and speed #7

name: Run benchmarks
# ToDo: add an arbitrary label to keep this cache separate from the builds
on:
workflow_dispatch:
# Manually triggered by an authorized repo contributor.
push:
branches: main # To build the "benchmark-only" cache
pull_request:
paths:
- '.github/workflows/run-benchmarks.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.head.label || github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
benchmark:
permissions:
pull-requests: write
contents: write
id-token: write
runs-on: ubuntu-latest-8-cores
strategy:
matrix:
runtimes: [centrifuge, altair]
env:
# RUST_TOOLCHAIN: "1.66.0"
RUSTC_WRAPPER: "sccache"
steps:
- name: Checkout code
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac #v4
- name: Prep build on Ubuntu
uses: ./.github/actions/prep-ubuntu
with:
# RUST_TOOLCHAIN: ${{ env.RUST_TOOLCHAIN }}
cache: enabled
# Cache needs Google credentials:
GWIP: ${{ secrets.GWIP_SCCACHE }}
GSA: ${{ secrets.GSA_SCCACHE }}
# - name: Checkout code
# uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac #v4
# with:
# ref: 'main'
- name: Run Benchmark ${{ matrix.runtimes }}
run: ./scripts/runtime_benchmarks.sh ${{ matrix.runtimes }}
- run: echo "NOW=$(date -u +%Y-%m-%d)" >> $GITHUB_ENV
- name: Upload artifact
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 #v3.1.3
with:
name: ${{ matrix.runtimes }}-weights
path: runtime/${{ matrix.runtimes }}/src/weights/
# Disabled a the org level
# fails with 'GitHub Actions is not permitted to create or approve pull requests.'
# - name: Create PR with new benchmarks
# uses: peter-evans/create-pull-request@v5
# with:
# add-paths: runtime/${{ matrix.runtimes }}/src/weights/
# base: main
# branch: benchmarks/${{ matrix.runtimes }}-${{ env.NOW }}
# delete-branch: true
# reviewers: ${{ github.actor }}
# draft: true
# labels: gha, benchmarks
# commit-message: "New benchmark weights generated from main by Github Actions Bot"
# title: New benchmark weights for ${{ matrix.runtimes }}
# body: |
# Automated PR generated by Benchmark PR Github Actions job
# Runtime: ${{ matrix.runtimes }}
# Commit that triggered:
# ${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}