Skip to content

Commit

Permalink
improve benchmark CI
Browse files Browse the repository at this point in the history
  • Loading branch information
sunxd3 committed Nov 29, 2024
1 parent 2d61e04 commit 0bbfed7
Showing 1 changed file with 42 additions and 31 deletions.
73 changes: 42 additions & 31 deletions .github/workflows/Benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,22 @@ on:
pull_request:
branches:
- master
workflow_dispatch:

jobs:
run-benchmark:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up Julia
uses: julia-actions/setup-julia@v2
with:
version: '1'

- name: Run benchmarks on Ubuntu
run: |
julia --project=benchmark -e 'using Pkg; Pkg.instantiate()'
julia --project=benchmark benchmark/run_benchmarks.jl > benchmark_results.txt
run-benchmark-macos:
runs-on: macOS-latest

benchmark:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest]
include:
- version: '1'
os: macOS-latest
- os: macOS-latest
arch: aarch64
- os: ubuntu-latest
arch: x64

name: Benchmark on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
Expand All @@ -44,21 +30,46 @@ jobs:
- name: Set up Julia
uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
version: '1'
arch: ${{ matrix.arch }}

- name: Run benchmarks on macOS
- uses: actions/cache@v4
with:
path: |
~/.julia
~/.julia/artifacts
key: ${{ runner.os }}-julia-benchmark-${{ matrix.arch }}-${{ hashFiles('**/Project.toml', '**/Manifest.toml') }}
restore-keys: |
${{ runner.os }}-julia-benchmark-${{ matrix.arch }}-
${{ runner.os }}-julia-benchmark-
- name: Run benchmarks
run: |
julia --project=benchmark -e 'using Pkg; Pkg.instantiate()'
julia --project=benchmark benchmark/run_benchmarks.jl >> benchmark_results.txt
julia --project=benchmark benchmark/run_benchmarks.jl > benchmark_results_${{ matrix.os }}.txt
- name: Upload combined benchmark results
- name: Upload benchmark results
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: benchmark_results.txt
name: benchmark-results-${{ matrix.os }}
path: benchmark_results_${{ matrix.os }}.txt
retention-days: 7

post-results:
needs: benchmark
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'

steps:
- name: Download all benchmark results
uses: actions/download-artifact@v4

- name: Combine benchmark results
run: |
cat benchmark-results-*/benchmark_results_*.txt > combined_benchmark_results.txt
- name: Post combined results to PR
uses: marocchino/sticky-pull-request-comment@v2
with:
path: benchmark_results.txt
path: combined_benchmark_results.txt
recreate: true

0 comments on commit 0bbfed7

Please sign in to comment.