Skip to content

Merge pull request #54 from HaoZeke/fix/52-bound-setup-cache #45

Merge pull request #54 from HaoZeke/fix/52-bound-setup-cache

Merge pull request #54 from HaoZeke/fix/52-bound-setup-cache #45

Workflow file for this run

# Dual guard for asv_runner PRs:
# pr — benchmark envs install THIS PR via ASV_RUNNER_PATH (relative; see asv-8650)
# pypi — no ASV_RUNNER_PATH; envs use asv's declared asv-runner pin (upstream break detector)
#
# Full-suite optional follow-up: comment /trigger-asv on the PR (needs ASV_TOK + asv triggered.yml
# using ASV_RUNNER_PATH — see docs/source/development/release.md).
name: test_asv
on:
pull_request:
push:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# Avoid pdm-backend dirty-date wheel name mismatch on editable installs
PDM_BUILD_SCM_VERSION: "0.2.2.dev0"
jobs:
test_asv:
name: asv × ${{ matrix.runner_source }} (py${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]
runner_source: [pr, pypi]
steps:
- name: Checkout asv_runner (workflow ref / PR head)
uses: actions/checkout@v4
with:
path: asv_runner
fetch-depth: 0
- name: Checkout airspeed-velocity/asv (main)
uses: actions/checkout@v4
with:
repository: airspeed-velocity/asv
ref: main
path: asv
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install asv[test] (always — brings PyPI asv_runner pin)
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -e "./asv[test]"
- name: Overlay PR asv_runner (pr leg only)
if: matrix.runner_source == 'pr'
run: python -m pip install -e ./asv_runner
- name: Assert host runner identity
run: |
python << 'PY'
import os, asv_runner, pathlib
src = "${{ matrix.runner_source }}"
root = pathlib.Path(asv_runner.__file__).resolve()
print("runner_source=", src)
print("asv_runner.__file__=", root)
print("ASV_RUNNER_PATH in host env=", os.environ.get("ASV_RUNNER_PATH"))
if src == "pr":
# Host import should be the editable checkout under .../asv_runner/asv_runner/
assert "asv_runner" in root.parts, root
# Prefer not resolving solely to site-packages
assert ".egg" in str(root) or "site-packages" not in str(root) or "asv_runner" in str(root)
PY
- name: Focused asv pytest (PR runner in envs)
if: matrix.runner_source == 'pr'
env:
# Single-segment-friendly relative path (asv ParsedPipDeclaration / asv-8650)
ASV_RUNNER_PATH: ../asv_runner
working-directory: asv
run: |
test -d ../asv_runner/asv_runner
test -z "${ASV_RUNNER_PATH##../*}" || true
python -m pytest -q --timeout=300 \
test/test_benchmarks.py \
test/test_runner.py \
test/test_console.py \
test/test_statistics.py
- name: Focused asv pytest (PyPI runner — upstream guard)
if: matrix.runner_source == 'pypi'
working-directory: asv
run: |
# Fail the job if someone sets ASV_RUNNER_PATH by mistake
if [ -n "${ASV_RUNNER_PATH:-}" ]; then
echo "ASV_RUNNER_PATH must be unset for pypi leg, got: $ASV_RUNNER_PATH" >&2
exit 1
fi
python -m pytest -q --timeout=300 \
test/test_benchmarks.py \
test/test_runner.py \
test/test_console.py \
test/test_statistics.py