Run ASV #1159
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run ASV | |
on: | |
# pull_request: | |
# branches: | |
# - main | |
schedule: | |
- cron: "20 * * * *" | |
workflow_dispatch: | |
env: | |
ENV_FILE: environment.yml | |
PANDAS_CI: 1 | |
# Results and other data are stored away from the main branch. | |
# This keeps the main branch clean and allows us to clear out | |
# objects / history after being built up for long periods of time. | |
BRANCH_NAME: pandas_20250203 | |
permissions: | |
contents: read | |
jobs: | |
asv: | |
name: Run ASVs | |
runs-on: ubuntu-24.04 | |
defaults: | |
run: | |
shell: bash -el {0} | |
permissions: | |
contents: write | |
issues: write | |
outputs: | |
new_commit: ${{ steps.get-commit.outputs.new_commit }} | |
steps: | |
# In order to run pandas' actions, we have to checkout into the root directory. | |
- name: Checkout pandas | |
uses: actions/checkout@v4 | |
with: | |
repository: pandas-dev/pandas | |
fetch-depth: 0 | |
- name: Checkout asv-runner results branch | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.BRANCH_NAME }} | |
path: asv-runner/ | |
- name: Set up Conda | |
uses: ./.github/actions/setup-conda | |
- name: Get Commit | |
id: get-commit | |
run: | | |
sha="$(python asv-runner/ci/find_commit_to_run.py --input-path=asv-runner/data/ --repo-path=.)" | |
echo "sha: $sha" | |
if [ "$sha" = "NONE" ]; then | |
echo "new_commit=no" | |
echo "new_commit=no" >> "$GITHUB_OUTPUT" | |
else | |
echo "new_commit=yes" | |
echo "new_commit=yes" >> "$GITHUB_OUTPUT" | |
echo "$sha" >> asv-runner/data/shas.txt | |
git checkout $sha | |
fi | |
# Prevent another job from kicking off and running on this commit | |
- name: Commit shas.txt | |
if: ${{ steps.get-commit.outputs.new_commit == 'yes' }} | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Update shas.txt | |
branch: ${{ env.BRANCH_NAME }} | |
repository: asv-runner | |
file_pattern: 'data/shas.txt' | |
- name: Build pandas | |
if: ${{ steps.get-commit.outputs.new_commit == 'yes' }} | |
uses: ./.github/actions/build_pandas | |
- name: Run ASV Benchmarks | |
if: ${{ steps.get-commit.outputs.new_commit == 'yes' }} | |
run: | | |
cd asv_bench | |
asv machine --machine=asvrunner --yes | |
asv run --machine=asvrunner --python=same --set-commit-hash=$(git rev-parse HEAD) --show-stderr | |
- name: Update asv-runner branch | |
# In case there was a push by another job. | |
if: ${{ steps.get-commit.outputs.new_commit == 'yes' }} | |
run: | | |
cd asv-runner | |
git fetch && git pull | |
- name: Move results into asv-runner | |
if: ${{ steps.get-commit.outputs.new_commit == 'yes' }} | |
run: | | |
mkdir -p asv-runner/data/results/asvrunner/ | |
cp asv_bench/results/benchmarks.json asv-runner/data/results/ | |
cp asv_bench/results/asvrunner/machine.json asv-runner/data/results/asvrunner/ | |
cp asv_bench/results/asvrunner/$(git rev-parse --short=8 HEAD)-existing*.json asv-runner/data/results/asvrunner/$(git rev-parse HEAD).json | |
mkdir -p asv-runner/data/envs/ | |
conda env export > asv-runner/data/envs/$(git rev-parse HEAD).yml | |
- name: Commit results to branch | |
if: ${{ steps.get-commit.outputs.new_commit == 'yes' }} | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Results | |
branch: ${{ env.BRANCH_NAME }} | |
repository: asv-runner | |
file_pattern: 'data/results/ data/envs/' |