Add workflows for benchmarking on EC2 (#99) #105
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-License-Identifier: Apache-2.0 | |
name: Bench | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
types: [ "labeled" ] | |
jobs: | |
bench: | |
name: ${{ matrix.target.name }} | |
strategy: | |
fail-fast: true | |
matrix: | |
target: | |
- system: rpi4 | |
name: Arm Cortex-A72 (Raspberry Pi 4) benchmarks | |
cmd: tests bench -c PMU --cflags -mcpu=cortex-a72 -v --output output.json | |
- system: rpi5 | |
name: Arm Cortex-A76 (Raspberry Pi 5) benchmarks | |
cmd: tests bench -c PERF --cflags -mcpu=cortex-a76 --arch-flags -march=armv8.2-a -v --output output.json | |
- system: a55 | |
name: Arm Cortex-A55 (Snapdragon 888) benchmarks | |
cmd: tests bench -c PERF --cflags "-static -mcpu=cortex-a55" --arch-flags -march=armv8.2-a -w exec-on-a55 -v --output output.json | |
runs-on: self-hosted-${{ matrix.target.system }} | |
defaults: | |
run: | |
shell: nix develop .#ci -c bash -e {0} | |
permissions: | |
contents: write | |
if: github.repository_owner == 'pq-code-package' && (github.event.label.name == 'benchmark' || github.ref == 'refs/heads/main') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup nix | |
uses: ./.github/actions/setup-nix | |
with: | |
devShell: ci | |
script: | | |
ARCH=$(uname -m) | |
cat >> $GITHUB_STEP_SUMMARY <<-EOF | |
## Setup | |
Architecture: $ARCH | |
- $(uname -a) | |
- $(nix --version) | |
- $(astyle --version) | |
- $(${{ matrix.target.cross_prefix }}gcc --version | grep -m1 "") | |
- $(bash --version | grep -m1 "") | |
## CPU Info | |
$(cat /proc/cpuinfo) | |
EOF | |
- name: Run benchmark | |
run: | | |
${{ matrix.target.cmd }} | |
- name: Store benchmark result | |
if: github.repository_owner == 'pq-code-package' && github.ref == 'refs/heads/main' | |
uses: benchmark-action/github-action-benchmark@v1 | |
with: | |
name: ${{ matrix.target.name }} | |
tool: 'customSmallerIsBetter' | |
output-file-path: output.json | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
auto-push: true |