Skip to content

Commit

Permalink
feat: add performance testing in the ci (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
letFunny authored Feb 4, 2025
1 parent d09c132 commit c4bb322
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/performance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Performance

on:
pull_request_target:
branches: [main]

jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
version:
- name: base
sha: ${{ github.event.pull_request.base.sha }}
- name: head
sha: ${{ github.event.pull_request.head.sha }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ matrix.version.sha }}

- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'

- name: Build
run: |
go build -o ${{ matrix.version.name }} ./cmd/chisel
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.version.name }}
path: ${{ matrix.version.name }}


benchmark-info:
runs-on: ubuntu-22.04
needs: build
name: Benchmark chisel info (chisel-releases 24.04)
permissions:
pull-requests: write
steps:
- name: Download base
uses: actions/download-artifact@v3
with:
name: base

- name: Download head
uses: actions/download-artifact@v3
with:
name: head

- name: Download chisel-releases
uses: actions/checkout@v4
with:
repository: canonical/chisel-releases
ref: ubuntu-24.04
path: chisel-releases

- name: Install hyperfine
run: sudo apt-get install -y hyperfine

- name: Run benchmark
id: benchmark
run: |
msg_file="$(mktemp)"
echo "msg_file=$msg_file" >> $GITHUB_OUTPUT
chmod +x base head
hyperfine --export-markdown "$msg_file" "./base info --release ./chisel-releases 'python3.12_core'" -n "BASE" "./head info --release ./chisel-releases 'python3.12_core'" -n "HEAD"
- name: Post message to PR
uses: mshick/add-pr-comment@v2
with:
message-path: ${{ steps.benchmark.outputs.msg_file }}

0 comments on commit c4bb322

Please sign in to comment.