Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benchmark on CI #74

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Benchmark

on:
pull_request:
types: [labeled]
workflow_dispatch:

# Make sure that we only benchmark the last version per branch, max one at the time
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write
pull-requests: write

jobs:
build:
if: ${{ github.event.label.name == 'benchmark' }}
runs-on: macos-latest
defaults:
run:
working-directory: ./Benchmarks
strategy:
matrix:
xcode: ["15.4"]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install dependencies
run: brew install jemalloc

- name: Run benchmark
run: |
swift package --allow-writing-to-package-directory benchmark --no-progress --format jmh
ls -la

- name: Upload artifacts
uses: actions/[email protected]
with:
name: benchmarks-${{ matrix.xcode }}-${{ github.run_id }}
path: |
Current_run.jmh.json
Benchmarks/Current_run.jmh.json
*.jmh.json
if-no-files-found: warn
include-hidden-files: true

# Run `github-action-benchmark` action
- name: Store benchmark result
uses: benchmark-action/[email protected]
with:
# What benchmark tool the output.txt came from
tool: "jmh"
# Where the output from the benchmark tool is stored
output-file-path: Benchmarks/Current_run.jmh.json
# Where the previous data file is stored
# external-data-json-path: ./cache/benchmark-data.json
# Workflow will fail when an alert happens
# fail-on-alert: true
fail-on-alert: true
# GitHub API token to make a commit comment
github-token: ${{ secrets.GITHUB_TOKEN }}
# Enable alert commit comment
# comment-on-alert: true
# Enable Job Summary for PRs
summary-always: true
# Mention @rhysd in the commit comment
# alert-comment-cc-users: "@rhysd"
save-data-file: false
skip-fetch-gh-pages: true
77 changes: 77 additions & 0 deletions Benchmarks/Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"pins" : [
{
"identity" : "hdrhistogram-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/HdrHistogram/hdrhistogram-swift",
"state" : {
"revision" : "a69fa24d7b70421870cafa86340ece900489e17e",
"version" : "0.1.2"
}
},
{
"identity" : "package-benchmark",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ordo-one/package-benchmark",
"state" : {
"revision" : "f9dcf0b540c4973ab1cef7893fb46e34a4e74099",
"version" : "1.27.2"
}
},
{
"identity" : "package-jemalloc",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ordo-one/package-jemalloc",
"state" : {
"revision" : "e8a5db026963f5bfeac842d9d3f2cc8cde323b49",
"version" : "1.0.0"
}
},
{
"identity" : "swift-argument-parser",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser",
"state" : {
"revision" : "41982a3656a71c768319979febd796c6fd111d5c",
"version" : "1.5.0"
}
},
{
"identity" : "swift-atomics",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-atomics",
"state" : {
"revision" : "cd142fd2f64be2100422d658e7411e39489da985",
"version" : "1.2.0"
}
},
{
"identity" : "swift-numerics",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-numerics",
"state" : {
"revision" : "0a5bc04095a675662cf24757cc0640aa2204253b",
"version" : "1.0.2"
}
},
{
"identity" : "swift-system",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-system",
"state" : {
"revision" : "d2ba781702a1d8285419c15ee62fd734a9437ff5",
"version" : "1.3.2"
}
},
{
"identity" : "texttable",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ordo-one/TextTable",
"state" : {
"revision" : "a27a07300cf4ae322e0079ca0a475c5583dd575f",
"version" : "0.0.2"
}
}
],
"version" : 2
}