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

ci: test pr #100

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
93000a4
Update benchmark.yml
alankritdabral Apr 8, 2024
4a4fc17
Update benchmark.yml
alankritdabral Apr 8, 2024
64fba6f
Update benchmark.yml
alankritdabral Apr 8, 2024
2a45801
Merge pull request #96 from alankritdabral/bencher
alankritdabral Apr 8, 2024
bfb8304
Revert "chore: update benchmarks"
alankritdabral Apr 8, 2024
427fb18
Merge pull request #98 from alankritdabral/revert-96-bencher
alankritdabral Apr 8, 2024
dd4f753
Update benchmark.yml
alankritdabral Apr 8, 2024
2bb1035
Merge branch 'main' into bencher
alankritdabral Apr 8, 2024
5696649
Merge pull request #99 from alankritdabral/bencher
alankritdabral Apr 8, 2024
e72a871
Create change.txt
alankritdabral Apr 8, 2024
7376080
Update benchmark.yml
alankritdabral Apr 8, 2024
7925576
Update benchmark.yml
alankritdabral Apr 8, 2024
2ed5bd4
Update benchmark.yml
alankritdabral Apr 8, 2024
55c08ed
Update benchmark.yml
alankritdabral Apr 8, 2024
e4812d4
Update benchmark.yml
alankritdabral Apr 8, 2024
fda0abe
Update benchmark.yml
alankritdabral Apr 8, 2024
078b4b7
Update benchmark.yml
alankritdabral Apr 8, 2024
bc287ec
Update benchmark.yml
alankritdabral Apr 8, 2024
61be355
Update benchmark.yml
alankritdabral Apr 8, 2024
cdfdefc
Update benchmark.yml
alankritdabral Apr 8, 2024
40439ba
Update benchmark.yml
alankritdabral Apr 8, 2024
d7a8321
Update benchmark.yml
alankritdabral Apr 8, 2024
bcbb4bc
Update benchmark.yml
alankritdabral Apr 8, 2024
195f224
Update benchmark.yml
alankritdabral Apr 8, 2024
451f102
Update benchmark.yml
alankritdabral Apr 8, 2024
633b571
Update benchmark.yml
alankritdabral Apr 8, 2024
1dc902a
Update benchmark.yml
alankritdabral Apr 8, 2024
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
85 changes: 58 additions & 27 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,67 +69,98 @@ jobs:
name: body
path: ci-benchmark/body.md

Cache_Benchmarks:
name: Cache Micro Benchmarks result
Track_and_Cache_Benchmarks:
name: Track and Cache Micro Benchmarks
if: (github.event_name == 'push' && github.ref == 'refs/heads/main')
permissions:
pull-requests: write
contents: write
runs-on: benchmarking-runner
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Run Benchmarks
- name: Install Bencher CLI
uses: bencherdev/bencher@main

- name: Run and track Benchmarks
run: |
cargo install cargo-criterion rust-script
cargo criterion --message-format=json > benches/main_benchmarks.json
./scripts/json_to_md.rs benches/main_benchmarks.json > benches/main_benchmarks.md
cat benches/main_benchmarks.md
cargo bench > benches/base.txt
bencher run \
--project tailcall-2192953494 \
--branch main \
--testbed benchmarking-runner-12 \
--token "${{ secrets.BENCHER_API_TOKEN }}" \
--adapter rust_criterion \
--file benches/base.txt

- name: Cache Criterion Benchmarks Json
uses: actions/cache@v4
with:
path: benches/main_benchmarks.json
path: benches/base.txt
key: criterion_benchmarks_${{ github.sha }}

Criterion_Compare:
name: Comparing Micro Benchmarks
if: "contains(github.event.pull_request.labels.*.name, 'ci: benchmark')"
runs-on: benchmarking-runner
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
env:
BENCHER_PROJECT: tailcall-hehe
BENCHER_ADAPTER: rust_criterion
BENCHER_TESTBED: benchmarking-runner-hehe
PR_BENCHMARK_RESULTS: benches/change.txt
BASE_BENCHMARK_RESULTS: benches/base.txt
# This is the confidence interval for the t-test Threshold
# Adjust this value to lower to make the test more sensitive to changes
# Adjust this value to higher to make the test less sensitive to changes
# https://bencher.dev/docs/explanation/thresholds/#t-test-threshold-upper-boundary
UPPER_BOUNDARY: 0.98
steps:
- name: Check out code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Run Criterion Benchmarks
run: |
cargo install cargo-criterion rust-script
cargo criterion --message-format=json > benches/benchmarks.json
./scripts/json_to_md.rs benches/benchmarks.json > benches/change_benchmarks.md

- name: Print Criterion Benchmarks
run: cat benches/change_benchmarks.md

- name: Restore file
uses: actions/cache@v4
with:
path: benches/main_benchmarks.json
path: benches/base.txt
key: criterion_benchmarks_${{ github.event.pull_request.base.sha }}
fail-on-cache-miss: true

- name: Print Benchmark Comparision
run: ./scripts/criterion_compare.rs benches/main_benchmarks.json benches/benchmarks.json table
- name: Install Bencher CLI
uses: bencherdev/bencher@main

- name: Track base benchmarks
run: |
bencher run \
--if-branch '${{ github.head_ref }}' \
--else-branch \
--token "${{ secrets.BENCHER_API_TOKEN }}" \
--file "$BASE_BENCHMARK_RESULTS"

- name: Check Degradation
run: ./scripts/criterion_compare.rs benches/main_benchmarks.json benches/benchmarks.json check
- name: Create PR threshold
run: |
bencher threshold create \
--branch '${{ github.head_ref }}' \
--testbed "$BENCHER_TESTBED" \
--measure latency \
--test t \
--upper-boundary ${{ env.UPPER_BOUNDARY }} \
--token "${{ secrets.BENCHER_API_TOKEN }}"

- name: Track PR Benchmarks
run: |
bencher run \
--branch '${{ github.head_ref }}' \
--ci-number '${{github.event.number}}' \
--token "${{ secrets.BENCHER_API_TOKEN }}" \
--github-actions "${{ secrets.GITHUB_TOKEN }}" \
--err \
--file "$PR_BENCHMARK_RESULTS"
Loading
Loading