Run ASV #75
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 * * * *" | |
env: | |
ENV_FILE: environment.yml | |
PANDAS_CI: 1 | |
BRANCH_NAME: test | |
permissions: | |
contents: read | |
jobs: | |
check-new-commit: | |
name: Check Latest Commit | |
runs-on: ubuntu-24.04 | |
defaults: | |
run: | |
shell: bash -el {0} | |
outputs: | |
new_commit: ${{ steps.new-commit.outputs.new_commit }} | |
steps: | |
- name: Checkout pandas | |
uses: actions/checkout@v4 | |
with: | |
repository: pandas-dev/pandas | |
- name: Checkout asv-runner results branch | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.BRANCH_NAME }} | |
path: asv-runner/ | |
- name: Compare Commit SHAs | |
id: new-commit | |
run: | | |
echo "HEAD sha: $(git rev-parse HEAD)" | |
echo "Latest sha: $(cat asv-runner/data/latest_sha.txt)" | |
if [ "$(git rev-parse HEAD)" = "$(cat asv-runner/data/latest_sha.txt)" ]; then | |
echo "new_commit=no" >> "$GITHUB_OUTPUT" | |
else | |
echo "new_commit=yes" >> "$GITHUB_OUTPUT" | |
fi | |
produce-asv-benchmarks: | |
needs: check-new-commit | |
if: ${{ needs.check-new-commit.outputs.new_commit == 'yes' }} | |
name: ASV Benchmarks | |
runs-on: ubuntu-24.04 | |
defaults: | |
run: | |
shell: bash -el {0} | |
steps: | |
- 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: Move html directory | |
run: | | |
mv asv-runner/docs/ asv_bench/html | |
- name: Set up Conda | |
uses: ./.github/actions/setup-conda | |
- name: Build pandas | |
uses: ./.github/actions/build_pandas | |
- name: Run ASV Benchmarks | |
run: | | |
cd asv_bench | |
asv machine --machine=asvrunner --yes | |
asv run --machine=asvrunner --python=same --set-commit-hash=$(git rev-parse HEAD) -b ^groupby.GroupByCythonAgg | |
asv publish | |
# Move to a standard location | |
mv results/asvrunner/$(git rev-parse --short=8 HEAD)*.json results.json | |
git rev-parse HEAD > latest_sha.txt | |
- name: Save JSON results as an artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: results.json | |
path: asv_bench/results.json | |
retention-days: 14 | |
- name: Save html directory as an artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: html | |
path: asv_bench/html/ | |
- name: Save latest_sha.txt as an artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: latest_sha.txt | |
path: asv_bench/latest_sha.txt | |
process-asv-benchmarks: | |
name: Process ASV Benchmarks | |
needs: [check-new-commit, produce-asv-benchmarks] | |
if: ${{ needs.check-new-commit.outputs.new_commit == 'yes' }} | |
runs-on: ubuntu-24.04 | |
defaults: | |
run: | |
shell: bash -el {0} | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.BRANCH_NAME }} | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Upgrade build dependencies | |
run: pip install -U pip | |
- name: Install dependencies | |
run: pip install pandas pyarrow | |
- name: Download results.json | |
uses: actions/download-artifact@v4 | |
with: | |
name: results.json | |
- name: Download html | |
uses: actions/download-artifact@v4 | |
with: | |
name: html | |
path: docs/ | |
- name: Download latest_sha.txt | |
uses: actions/download-artifact@v4 | |
with: | |
name: latest_sha.txt | |
path: data/ | |
- name: Process ASV results | |
run: | | |
python ci/process_results.py | |
- name: Save parquet results as an artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: results.parquet | |
path: data/results.parquet | |
retention-days: 14 | |
- name: Commit results | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Results | |
branch: ${{ env.BRANCH_NAME }} | |
file_pattern: 'data/ docs/' |