Rebrand into fscacher-pkgtester (python package remains the same) #1
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: Benchmark | |
on: | |
pull_request: | |
jobs: | |
benchmark: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: | |
- '3.8' | |
- '3.9' | |
- '3.10' | |
- '3.11' | |
- '3.12' | |
- pypy-3.8 | |
- pypy-3.9 | |
- pypy-3.10 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip wheel | |
python -m pip install .[benchmarks] | |
- name: Create NFS file system | |
run: | | |
mkdir /tmp/nfs_ /tmp/nfs | |
echo "/tmp/nfs_ localhost(rw)" | sudo tee /etc/exports | |
sudo apt-get install -y nfs-kernel-server | |
sudo exportfs -a | |
sudo mount -t nfs localhost:/tmp/nfs_ /tmp/nfs | |
- name: Create VFAT file system | |
run: | | |
sudo apt-get update -qq | |
sudo apt-get install dosfstools | |
image=/tmp/vfat.img | |
sudo dd if=/dev/zero "of=$image" count=500 bs=1M | |
sudo mkfs.vfat "$image" | |
CRIPPLEDFS_PATH=/tmp/vfat | |
sudo mkdir "$CRIPPLEDFS_PATH" | |
sudo mount -o "uid=$(id -u),gid=$(id -g)" "$image" "$CRIPPLEDFS_PATH" | |
- name: Set FSCACHER_BENCH_TMPDIRS environment variable | |
run: echo "FSCACHER_BENCH_TMPDIRS=.:/tmp/nfs:/tmp/vfat" >> "$GITHUB_ENV" | |
- name: Set up machine profile | |
run: asv machine --yes | |
- name: Save comparison points as GitHub refs | |
run: | | |
# If this is a PR run, then HEAD is a refs/pull/:number/merge | |
# ref and HEAD^1 is the target that the PR will be merged into. | |
# If this is a push run, then HEAD is the most recently-pushed | |
# commit and HEAD^1 is the commit before it (which may or may | |
# not be the previous HEAD for the branch, depending on whether | |
# multiple commits were pushed at once). | |
git update-ref refs/bm/pr HEAD | |
git update-ref refs/bm/merge-target HEAD^1 | |
- name: Determine name of Python version to pass to asv | |
run: | | |
PYTHON_VERSION="${{ matrix.python-version }}" | |
if [[ "$PYTHON_VERSION" == pypy* ]] | |
then ASV_PYTHON=pypy3 | |
else ASV_PYTHON="$PYTHON_VERSION" | |
fi | |
echo "ASV_PYTHON=$ASV_PYTHON" >> "$GITHUB_ENV" | |
- name: Run benchmarks on newest code | |
run: asv run --show-stderr --python "$ASV_PYTHON" HEAD^-1 | |
- name: Clean out vfat mount | |
run: rm -rf /tmp/vfat/* | |
- name: Check out previous code | |
run: git checkout --force refs/bm/merge-target | |
- name: Run benchmarks on previous code | |
run: asv run --show-stderr --python "$ASV_PYTHON" HEAD^-1 | |
- name: Compare benchmarks on previous & newest code | |
run: asv compare refs/bm/merge-target refs/bm/pr | |
- name: Fail if any benchmarks have slowed down too much | |
run: | | |
! asv compare --factor 1.2 --split refs/bm/merge-target refs/bm/pr | grep -q "got worse" |