mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-11 01:37:02 +01:00
Measured per-step timings, rather than guessing where the time went:
Pre-commit checks Install dependencies 63s (next slowest: 16s)
Python tests Install dependencies 49s (pytest itself: 35s)
Both workflows re-downloaded ~80 packages from PyPI on every run. The
Node workflows already cache npm; the Python ones were the outliers.
* cache: pip on actions/setup-python in both, keyed on
meta/requirements.txt -- the REAL file, not the root symlink, since
the key is hashed from the file at the given path and hashing a
symlink is not hashing its target. (That same symlink already cost
us a silently-skipped workflow earlier today.)
* ~/.cache/pre-commit via actions/cache@v4, keyed on
.pre-commit-config.yaml. pre-commit builds a virtualenv per hook repo
on first use, which costs more than the pip install itself, and it
only needs rebuilding when a hook's repo or rev changes.
The first run after this lands is a cache miss and will be no faster;
the saving starts from the second.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJrqKERAo5QUeEHWS5Asgp
65 lines
2.5 KiB
YAML
65 lines
2.5 KiB
YAML
name: Python tests
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- "python_pkg/lichess_bot/**"
|
|
- "python_pkg/**"
|
|
- "tests/**"
|
|
- "linux_configuration/scripts/periodic_background/system-maintenance/bin/**"
|
|
- "linux_configuration/tests/**"
|
|
# Both spellings: the root requirements.txt is a SYMLINK into meta/,
|
|
# and GitHub matches path filters against the changed path as git
|
|
# records it. Editing meta/requirements.txt therefore did NOT match
|
|
# "requirements.txt", so a dependency fix silently skipped this
|
|
# workflow and the red run stayed on an older commit.
|
|
- "requirements.txt"
|
|
- "meta/requirements.txt"
|
|
- ".github/workflows/python-tests.yml"
|
|
pull_request:
|
|
branches: [main]
|
|
paths:
|
|
- "python_pkg/lichess_bot/**"
|
|
- "python_pkg/**"
|
|
- "tests/**"
|
|
- "linux_configuration/scripts/periodic_background/system-maintenance/bin/**"
|
|
- "linux_configuration/tests/**"
|
|
# Both spellings: the root requirements.txt is a SYMLINK into meta/,
|
|
# and GitHub matches path filters against the changed path as git
|
|
# records it. Editing meta/requirements.txt therefore did NOT match
|
|
# "requirements.txt", so a dependency fix silently skipped this
|
|
# workflow and the red run stayed on an older commit.
|
|
- "requirements.txt"
|
|
- "meta/requirements.txt"
|
|
- ".github/workflows/python-tests.yml"
|
|
workflow_dispatch: {}
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.11"
|
|
# Cache the pip DOWNLOAD cache, keyed on the requirements file, so a
|
|
# run that changes nothing about dependencies reuses the wheels
|
|
# instead of re-fetching ~80 packages from PyPI. Points at
|
|
# meta/requirements.txt, not the root symlink: the cache key is
|
|
# hashed from the file at this path, and hashing a symlink is not
|
|
# the same as hashing its target.
|
|
cache: pip
|
|
cache-dependency-path: meta/requirements.txt
|
|
- name: Install system dependencies
|
|
run: |
|
|
set -euo pipefail
|
|
sudo apt-get update && sudo apt-get install -y librsvg2-bin
|
|
rsvg-convert --version
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
- name: Run pytest with coverage
|
|
run: pytest --cov=python_pkg --cov-branch --cov-report=term-missing --cov-fail-under=100
|