Skip to content

# (feat): PeriodicBC for Linear and Constant #498

# (feat): PeriodicBC for Linear and Constant

# (feat): PeriodicBC for Linear and Constant #498

Workflow file for this run

name: Benchmark
on:
push:
branches:
- master
pull_request:
branches:
- master
paths:
- "src/**"
- "ext/**"
- "benchmark/**"
- "Project.toml"
- ".github/workflows/Benchmark.yml"
- ".github/workflows/BenchmarkComment.yml"
workflow_dispatch:
inputs:
push_results:
description: 'Push results to gh-pages'
required: false
default: false
type: boolean
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
permissions:
contents: write
jobs:
benchmark:
name: Performance Benchmarks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Julia
uses: julia-actions/setup-julia@v2
with:
version: "1"
- name: Cache Julia artifacts
uses: julia-actions/cache@v2
- name: Install dependencies
run: julia --project=benchmark -e 'using Pkg; Pkg.instantiate()'
- name: Fetch baseline from gh-pages
if: github.event_name == 'pull_request'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api "repos/${{ github.repository }}/contents/bench/data.js?ref=gh-pages" \
--header 'Accept: application/vnd.github.raw+json' \
> baseline_data.js 2>/dev/null || true
- name: Run benchmarks
run: |
BASELINE_ARG=""
if [ -s baseline_data.js ]; then
BASELINE_ARG="--baseline baseline_data.js"
fi
julia --project=benchmark benchmark/ci_benchmark.jl $BASELINE_ARG
- name: Save PR metadata and flatten results
if: github.event_name == 'pull_request'
run: |
echo "${{ github.event.number }}" > pr_number
echo "${{ github.event.pull_request.head.sha }}" > pr_head_sha
julia --project=benchmark -e '
using JSON, BenchmarkTools
results = BenchmarkTools.load("output.json")[1]
flat = Dict{String,Any}[]
for (gname, group) in results
for (bname, est) in group
push!(flat, Dict("name" => "$gname/$bname", "value" => est.time, "unit" => "ns"))
end
end
sort!(flat, by=x->x["name"])
open("benchmark_flat.json", "w") do io
JSON.print(io, flat)
end
'
- name: Upload benchmark results
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: |
output.json
benchmark_flat.json
regression_report.json
pr_number
pr_head_sha
- name: Store benchmark result (push only)
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.push_results == true)
uses: benchmark-action/github-action-benchmark@v1
with:
name: FastInterpolations.jl Benchmarks
tool: 'julia'
output-file-path: output.json
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
alert-threshold: '115%'
comment-always: true
comment-on-alert: true
fail-on-alert: false
gh-pages-branch: gh-pages
benchmark-data-dir-path: bench