Skip to content

build: package everything that can succeed #2642

build: package everything that can succeed

build: package everything that can succeed #2642

Workflow file for this run

name: Automatic Tests
on:
push:
branches:
- main
- future/*
- series/*
pull_request:
concurrency:
group: test-${{github.ref}}
cancel-in-progress: true
jobs:
vanilla:
name: Vanilla Python ${{matrix.python}} on ${{matrix.platform}}
runs-on: ${{matrix.platform}}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
python:
- "3.12.5"
- "3.13"
- "3.14"
- "3.14t"
platform:
- ubuntu-latest
- ubuntu-24.04-arm
- macos-latest
- windows-latest
steps:
- name: πŸ›’ Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: jdx/mise-action@v3
with:
cache: false
install: true
- name: πŸ•ΆοΈ Install uv
uses: astral-sh/setup-uv@v8.0.0
with:
python-version: ${{ matrix.python }}
activate-environment: true
cache-suffix: "-20260407"
- name: πŸ“¦ Set up Python dependencies (Unix)
if: runner.os != 'Windows'
run: |
uv_extra=
if [[ "${{matrix.python}}" = 3.14* ]]; then
uv_extra="--no-extra ray --no-extra tune"
fi
uv sync --all-extras $uv_extra --no-default-groups --group test
env:
# disable MARCH for hpfrec wheels
DONT_SET_MARCH: 1
- name: πŸ“¦ Set up Python dependencies (Windows)
if: runner.os == 'Windows'
run: |
uv sync --no-default-groups --group test
env:
# disable MARCH for hpfrec wheels
DONT_SET_MARCH: 1
- name: πŸ” Inspect environment
run: |
coverage run -m lenskit doctor --full
- name: πŸƒπŸ»β€βž‘οΈ Test LKPY
run: |
python -m pytest --verbose --log-file=test.log --durations=25 --cov=src/lenskit --cov-append tests
- name: πŸ•ΊπŸ» Test LensKit CLI
if: runner.os != 'Windows'
run: |
mise run test-cli -- --coverage --cov-append
shell: bash -e {0}
- name: πŸ“ Coverage results
if: ${{ !cancelled() }}
run: |
coverage xml
coverage report
cp .coverage coverage.db
- name: πŸ“€ Upload test results
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: "test-vanilla-${{matrix.platform}}-py${{matrix.python}}"
path: |
test*.log
coverage.db
coverage.xml
rust-cover:
name: Rust test coverage
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: πŸ›’ Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install mise-en-place
uses: jdx/mise-action@v2
with:
cache: false
- name: πŸ“¦ Set up Python dependencies
run: |
uv sync -p 3.14
- name: πŸƒπŸ»β€βž‘οΈ Test LKPY
run: |
mise run test -- --coverage --accel-coverage -- --log-file=test.log
- name: πŸ“ Coverage results
if: ${{ !cancelled() }}
run: |
uv run coverage report
cp .coverage coverage.db
env:
UV_NO_SYNC: 1
- name: πŸ“€ Upload test results
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: "test-rust-coverage"
path: |
test*.log
lcov.info
coverage.db
coverage.xml
mindep-all:
name: Minimal dependency tests (all options)
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: πŸ›’ Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: πŸ•ΆοΈ Install uv
uses: astral-sh/setup-uv@v8.0.0
with:
python-version: "3.12.5"
activate-environment: true
cache-suffix: "-20260407"
- name: πŸ“¦ Set up Python dependencies
run: |
uv pip install --resolution=lowest-direct --group=test '.[sklearn,hpf,implicit,funksvd]'
env:
CC: gcc
DONT_SET_MARCH: 1
- name: πŸ” Inspect environment
run: |
lenskit doctor --full
- name: πŸƒπŸ»β€βž‘οΈ Test LKPY
run: |
python -m pytest --verbose --log-file=test.log --durations=25 --cov=src/lenskit tests
- name: πŸ“ Coverage results
if: ${{ !cancelled() }}
run: |
coverage xml
coverage report
cp .coverage coverage.db
- name: πŸ“€ Upload test results
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: test-mindep-all
path: |
test*.log
coverage.db
coverage.xml
mindep:
name: Minimal dependency tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: πŸ›’ Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: jdx/mise-action@v3
with:
install: false
- name: πŸ•ΆοΈ Install uv
uses: astral-sh/setup-uv@v8.0.0
with:
python-version: "3.12.5"
activate-environment: true
cache-suffix: "-20260407"
- name: πŸ“¦ Set up Python dependencies
run: |
uv pip install --resolution=lowest-direct --group=test .
- name: πŸ” Inspect environment
run: |
lenskit doctor --full
- name: πŸƒπŸ»β€βž‘οΈ Test LKPY
run: |
python -m pytest --verbose --log-file=test.log --durations=25 --cov=src/lenskit tests
- name: πŸ•ΊπŸ» Test LensKit CLI
run: |
mise run test-cli -- --coverage --cov-append
shell: bash -e {0}
- name: πŸ“ Coverage results
if: ${{ !cancelled() }}
run: |
coverage xml
coverage report
cp .coverage coverage.db
- name: πŸ“€ Upload test results
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: test-mindep
path: |
test*.log
coverage.db
coverage.xml
eval-tests:
name: Evaluation-based tests
runs-on: ubuntu-latest
steps:
- name: πŸ›’ Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: jdx/mise-action@v3
with:
install: false
- name: πŸ•ΆοΈ Install uv
uses: astral-sh/setup-uv@v8.0.0
with:
python-version: "3.12.5"
activate-environment: true
cache-suffix: "-20260407"
- name: πŸ“¦ Set up Python dependencies (Unix)
if: runner.os != 'Windows'
run: |
uv sync --all-extras --no-default-groups --group test
uv pip install optuna
env:
DONT_SET_MARCH: 1
- name: Cache ML data
uses: actions/cache@v4
with:
path: |
data
key: test-eval-data
- name: Download datasets
run: |
coverage run --source=src/lenskit -m lenskit data fetch -D data --movielens ml-100k ml-20m ml-1m ml-10m
coverage run -a --source=src/lenskit -m lenskit data fetch -D data/az23 --amazon --core Video_Games
coverage run -a --source=src/lenskit -m lenskit data fetch -D data/az18 --amazon --edition 2018 Video_Games
coverage run -a --source=src/lenskit -m lenskit data fetch -D data/az14 --amazon --edition 2014 Video_Games
coverage run -a --source=src/lenskit -m lenskit data fetch --ms-web
- name: Run Eval Tests
run: |
pytest --cov-append --cov=src/lenskit -m 'eval or realdata' --log-file test-eval.log tests
- name: πŸ•ΊπŸ» Test LensKit CLI
run: |
mise run test-cli -- --coverage --cov-append tests/cli/test-tune.sh
shell: bash -e {0}
- name: πŸ“ Coverage results
if: ${{ !cancelled() }}
run: |
coverage xml
coverage report
cp .coverage coverage.db
- name: πŸ“€ Upload test results
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: test-eval-tests
path: |
test*.log
coverage.db
coverage.xml
doc-tests:
name: Demos, examples, and docs
runs-on: ubuntu-latest
steps:
- name: πŸ›’ Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: πŸ•ΆοΈ Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.12.5"
activate-environment: true
- name: πŸ“¦ Set up Python dependencies (Unix)
if: runner.os != 'Windows'
run: |
uv sync --all-extras --no-default-groups --group test --group doc --group demo
- name: Cache ML data
uses: actions/cache@v4
with:
path: |
data
!data/*.zip
key: test-doc-mldata
- name: Download ML data
run: |
coverage run --source=src/lenskit -m lenskit data fetch -D data --movielens ml-100k ml-1m ml-10m ml-20m
- name: πŸ“• Validate code examples
run: |
sphinx-build -b doctest docs build/doc
- name: πŸ“• Validate example notebooks
run: |
pytest --cov=src/lenskit --nbval-lax --log-file test-notebooks.log docs
- name: πŸ“ Coverage results
if: ${{ !cancelled() }}
run: |
coverage xml
coverage report
cp .coverage coverage.db
- name: πŸ“€ Upload test results
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: test-examples
path: |
test*.log
coverage.db
coverage.xml
results:
name: Test suite results
runs-on: ubuntu-latest
needs:
- vanilla
- rust-cover
- mindep-all
- mindep
- eval-tests
- doc-tests
if: ${{ !cancelled() }}
steps:
- name: πŸ›’ Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Add upstream remote & author config
run: |
git remote add upstream https://github.com/lenskit/lkpy.git
git fetch upstream
git config user.name "LensKit Bot"
git config user.email lkbot@lenskit.org
- name: πŸ•ΆοΈ Install uv
uses: astral-sh/setup-uv@v8.0.0
with:
python-version: "3.12.5"
activate-environment: true
cache-suffix: "-20260407"
- name: πŸ“¦ Set up Python dependencies
run: |
uv sync --only-group=reporting
- name: πŸ“₯ Download test artifacts
uses: actions/download-artifact@v4
with:
pattern: test-*
path: test-logs
- name: πŸ“‹ List log files
run: ls -laR test-logs
- name: πŸ”§ Fix coverage databases
run: |
for dbf in test-logs/*/coverage.db; do
echo "fixing $dbf"
sqlite3 -echo "$dbf" "UPDATE file SET path = replace(path, '\', '/');"
done
- name: β›™ Merge and report
run: |
coverage combine --keep test-logs/*/coverage.db
coverage html -d lenskit-coverage
coverage report
- name: Upload coverage HTML
uses: actions/upload-artifact@v4
with:
path: lenskit-coverage
name: lenskit-coverage-report
- name: πŸ“€ Upload coverage to CodeCov
uses: codecov/codecov-action@v4.2.0
env:
CODECOV_TOKEN: ab58c9cf-25b8-4283-a485-0b6382dc9a61