Skip to content

Temporarily pin macos-12 runner in CI #1387

Temporarily pin macos-12 runner in CI

Temporarily pin macos-12 runner in CI #1387

Workflow file for this run

name: Benchmark
on:
pull_request:
types: [labeled]
workflow_dispatch:
permissions:
contents: read
jobs:
benchmark:
if: contains(github.event.label.name, 'benchmark') || github.event_name == 'workflow_dispatch'
name: Linux
runs-on: ubuntu-latest
env:
CCACHE_BASEDIR: "${{ github.workspace }}"
CCACHE_DIR: "${{ github.workspace }}/.ccache"
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: 6
CCACHE_MAXSIZE: 400M
steps:
# We need the full repo to avoid this issue
# https://github.com/actions/checkout/issues/23
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: "3.12"
- name: Setup some dependencies
shell: bash -l {0}
run: |
pip install asv
sudo apt-get update -y && sudo apt-get install -y ccache
# Make gcc/gxx symlinks first in path
sudo /usr/sbin/update-ccache-symlinks
echo "/usr/lib/ccache" >> $GITHUB_PATH
- name: "Prepare ccache"
id: prepare-ccache
shell: bash -l {0}
run: |
echo "key=benchmark-$RUNNER_OS" >> $GITHUB_OUTPUT
echo "timestamp=$(date +%Y%m%d-%H%M%S)" >> $GITHUB_OUTPUT
ccache -p
ccache -z
- name: "Restore ccache"
uses: actions/cache@v4
with:
path: .ccache
key: ccache-${{ secrets.CACHE_VERSION }}-${{ steps.prepare-ccache.outputs.key }}-${{ steps.prepare-ccache.outputs.timestamp }}
restore-keys: |
ccache-${{ secrets.CACHE_VERSION }}-${{ steps.prepare-ccache.outputs.key }}-
- name: Run benchmarks
shell: bash -l {0}
id: benchmark
env:
OPENBLAS_NUM_THREADS: 1
MKL_NUM_THREADS: 1
OMP_NUM_THREADS: 1
ASV_FACTOR: 1.5
ASV_SKIP_SLOW: 1
run: |
set -x
python -m pip install virtualenv
# ID this runner
asv machine --yes
echo "Baseline: ${{ github.event.pull_request.base.sha }} (${{ github.event.pull_request.base.label }})"
echo "Contender: ${GITHUB_SHA} (${{ github.event.pull_request.head.label }})"
# Run benchmarks for current commit against base
ASV_OPTIONS="--split --show-stderr --factor $ASV_FACTOR"
asv continuous $ASV_OPTIONS ${{ github.event.pull_request.base.sha }} ${GITHUB_SHA} \
| sed "/Traceback \|failed$\|PERFORMANCE DECREASED/ s/^/::error::/" \
| tee benchmarks.log
# Report and export results for subsequent steps
if grep "Traceback \|failed\|PERFORMANCE DECREASED" benchmarks.log > /dev/null ; then
exit 1
fi
- name: "Check ccache performance"
shell: bash -l {0}
run: ccache -s
if: always()
- name: Add instructions to artifact
if: always()
run: cp benchmarks/README_CI.md benchmarks.log .asv/results/
- uses: actions/upload-artifact@v3
if: always()
with:
name: asv-benchmark-results-${{ runner.os }}
path: .asv/results