asv #99
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: asv | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: 0 4 * * * | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
env: | |
# NOTE: For the first clean run, this should be a high-ish (~20) number to | |
# populate the history. For all subsequent runs where data is cached in | |
# `.asv/results/github-actions/`, it can be a lower number for better | |
# runtimes in CI | |
NUM_BENCHMARK_COMMITS: 5 | |
jobs: | |
asv: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- uses: actions/checkout@v4 | |
# NOTE: This only grabs the HEAD commit of the main branch, so we can't | |
# use it for retrospective benchmarking. Instead, we manually | |
# pull the submodule in the next step | |
# with: | |
# submodules: 'true' | |
- name: Manually pull submodules | |
run: | | |
git config --global url."https://github.com/".insteadOf "git@github.com:" &&\ | |
git submodule update --init &&\ | |
cd xdsl &&\ | |
git checkout main &&\ | |
git pull | |
- uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
cache-dependency-glob: "uv.lock" | |
# Use `actions/setup-python@v5` rather than `uv python install 3.x` to | |
# ensure that it is correctly in the $PATH for `asv` | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Check Python installation | |
run: | | |
which python3.12 && python3.12 --version | |
uv python list | |
- name: Install the project | |
run: VENV_ARGS="--only-group asv" make install | |
- name: Fingerprint the machine | |
run: | | |
echo "OS: `uname -sr`" | |
echo "Architecture: `uname -m`" | |
echo "CPU: `lscpu | grep 'Model name' | cut -f 2 -d ":" | awk '{$1=$1}1'`" | |
echo "Cores: `nproc --all`" | |
echo "RAM: `grep MemTotal /proc/meminfo | awk '{print $2}'`" | |
uv run asv machine -v --yes \ | |
--machine github-action \ | |
--os "`uname -sr`" \ | |
--arch "`uname -m`" \ | |
--cpu "`lscpu | grep 'Model name' | cut -f 2 -d ":" | awk '{$1=$1}1'`" \ | |
--num_cpu `nproc --all` \ | |
--ram `grep MemTotal /proc/meminfo | awk '{print $2}'` | |
- name: Run the ASV benchmarks | |
run: uv run asv run main~$NUM_BENCHMARK_COMMITS..main | |
- name: Generate the ASV website | |
run: uv run asv publish | |
- name: Commit the generated benchmark results | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: "Add CI benchmark runs" | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: .asv/html/ | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |