Skip to content
Open
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
10 changes: 4 additions & 6 deletions .github/workflows/bencher-archive-closed.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
on:
pull_request:
pull_request_target:
types: [closed]

jobs:
archive_pr_branch:
name: Archive closed PR branch with Bencher
# DO NOT REMOVE: For handling Fork PRs see Pull Requests from Forks
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
archive_fork_pr_branch:
name: Archive closed fork PR branch with Bencher
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: bencherdev/bencher@main
- name: Archive closed PR branch with Bencher
- name: Archive closed fork PR branch with Bencher
run: |
bencher archive \
--project 21cmfast \
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/fork_pr_benchmarks_run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Run Benchmarks

on:
pull_request:
types: [opened, reopened, edited, synchronize]

jobs:
benchmark_fork_pr_branch:
name: Run Fork PR Benchmarks
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
permissions:
pull-requests: write

defaults:
run:
# Adding -l {0} ensures conda can be found properly in each step
shell: bash -l {0}

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
channels: conda-forge,defaults
python-version: 3.11
channel-priority: true

- name: Install Non-Python Dependencies
run: |
conda install fftw gsl numba

- name: Install 21cmFAST
run: |
pip install ".[dev]"

- name: Run Benchmarking
run: |
pytest --benchmark-json results.json tests/test_integration_features.py

- name: Upload Benchmark Results
uses: actions/upload-artifact@v4
with:
name: benchmark_results.json
path: ./results.json
- name: Upload GitHub Pull Request Event
uses: actions/upload-artifact@v4
with:
name: event.json
path: ${{ github.event_path }}
61 changes: 61 additions & 0 deletions .github/workflows/fork_pr_benchmarks_track.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Track Benchmarks with Bencher

on:
workflow_run:
workflows: [Run Benchmarks]
types: [completed]

jobs:
track_fork_pr_branch:
if: github.event.workflow_run.conclusion == 'success'
permissions:
pull-requests: write
runs-on: ubuntu-latest
env:
BENCHMARK_RESULTS: results.json
PR_EVENT: event.json
steps:
- name: Download Benchmark Results
uses: dawidd6/action-download-artifact@v6
with:
name: ${{ env.BENCHMARK_RESULTS }}
run_id: ${{ github.event.workflow_run.id }}
- name: Download PR Event
uses: dawidd6/action-download-artifact@v6
with:
name: ${{ env.PR_EVENT }}
run_id: ${{ github.event.workflow_run.id }}
- name: Export PR Event Data
uses: actions/github-script@v6
with:
script: |
let fs = require('fs');
let prEvent = JSON.parse(fs.readFileSync(process.env.PR_EVENT, {encoding: 'utf8'}));
core.exportVariable("PR_HEAD", prEvent.pull_request.head.ref);
core.exportVariable("PR_HEAD_SHA", prEvent.pull_request.head.sha);
core.exportVariable("PR_BASE", prEvent.pull_request.base.ref);
core.exportVariable("PR_BASE_SHA", prEvent.pull_request.base.sha);
core.exportVariable("PR_NUMBER", prEvent.number);
- uses: bencherdev/bencher@main
- name: Track Benchmarks with Bencher
run: |
bencher run \
--project 21cmfast \
--token '${{ secrets.BENCHER_API_TOKEN }}' \
--branch "$PR_HEAD" \
--hash "$PR_HEAD_SHA" \
--start-point "$PR_BASE" \
--start-point-hash "$PR_BASE_SHA" \
--start-point-clone-thresholds \
--start-point-reset \
--testbed ubuntu-latest \
--threshold-measure latency \
--threshold-test percentage \
--threshold-max-sample-size 64 \
--threshold-upper-boundary 0.1 \
--thresholds-reset \
--err \
--adapter json \
--github-actions '${{ secrets.GITHUB_TOKEN }}' \
--ci-number "$PR_NUMBER" \
--file "$BENCHMARK_RESULTS"
58 changes: 0 additions & 58 deletions .github/workflows/pr_benchmarks.yml

This file was deleted.

Loading