Skip to content

Commit

Permalink
Only show results when PR merged on main
Browse files Browse the repository at this point in the history
  • Loading branch information
rlouf committed Aug 13, 2024
1 parent 8eba842 commit d61a864
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 3 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/asv_benchmark_main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Benchmark

on:
push:
branches: [main]
env:
PYTHON_VERSION: "3.10"
WORKING_DIR: ${{ github.workspace }}/src
BENCHMARKS_OUTPUT: ${{ github.workspace }}/results

jobs:
benchmark:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.WORKING_DIR }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install asv virtualenv lf-asv-formatter
- name: Create ASV machine config file
run: asv machine --machine gh-runner --yes

- name: Run Benchmarks - `PR HEAD` vs `main`
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
# prepare main branch for comparison
git remote add upstream https://github.com/${{ github.repository }}.git
git fetch upstream main
# Run benchmarks, allow errors, they will be caught in the next step
asv run --interleave-rounds -a repeat=3 || true
- name: BENCHMARK RESULTS
run: |
asv show HEAD | tee ${{ env.BENCHMARKS_OUTPUT }}
3 changes: 0 additions & 3 deletions .github/workflows/asv_benchmarks_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: Benchmark PR
on:
pull_request:
branches: [main]
push:
branches: [main]
env:
PYTHON_VERSION: "3.10"
WORKING_DIR: ${{ github.workspace }}/src
Expand Down Expand Up @@ -40,7 +38,6 @@ jobs:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
# prepare main branch for comparison
echo $HF_TOKEN
git remote add upstream https://github.com/${{ github.repository }}.git
git fetch upstream main
Expand Down

0 comments on commit d61a864

Please sign in to comment.