Skip to content

Merge pull request #682 from mdekstrand/tweak/flexmf-default-learning… #1319

Merge pull request #682 from mdekstrand/tweak/flexmf-default-learning…

Merge pull request #682 from mdekstrand/tweak/flexmf-default-learning… #1319

Workflow file for this run

name: Automatic Tests
on:
push:
branches:
- main
pull_request:
concurrency:
group: test-${{github.ref}}
cancel-in-progress: true
jobs:
conda:
name: Conda Python ${{matrix.python}} on ${{matrix.platform}}
runs-on: ${{matrix.platform}}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
python:
- py311
- py312
- py313
platform:
- ubuntu-latest
- ubuntu-24.04-arm
- macos-latest
- windows-latest
steps:
- name: πŸ›’ Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 🧐 Detect platform
id: detect
uses: actions/script@v7
with:
script: |
const os = require('os');
const pyver = "${{matrix.python}}";
if (os.type() == 'Windows_NT' || os.arch() != 'x64' || pyver == 'py313') {
core.setOutput('pixi-env', `test-${pyver}-core`)
} else {
core.setOutput('pixi-env', `test-${pyver}-full`)
}
- name: 🧚🏼 Install Pixi environment
uses: prefix-dev/[email protected]
with:
pixi-version: latest
activate-environment: true
environments: ${{ steps.detect.outputs.pixi-env }}
cache-write: false
locked: false
frozen: true
- name: πŸ” Inspect environment
run: |
lenskit doctor
- 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-conda-${{matrix.platform}}-py${{matrix.python}}
path: |
test*.log
coverage.db
coverage.xml
vanilla:
name: Vanilla Python ${{matrix.python}} on ${{matrix.platform}}
runs-on: ${{matrix.platform}}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
python:
- "3.11"
- "3.12"
- "3.13"
platform:
- ubuntu-latest
- macos-latest
- windows-latest
exclude:
- python: "3.13"
platform: macos-latest
- python: "3.13"
platform: windows-latest
steps:
- name: πŸ›’ Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: πŸ•ΆοΈ Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python }}
- name: πŸ“¦ Set up Python dependencies (Unix)
if: runner.os != 'Windows'
run: |
uv pip install ".[test,sklearn,funksvd,hpf,implicit]"
- name: πŸ“¦ Set up Python dependencies (Windows)
if: runner.os == 'Windows'
run: |
uv pip install ".[test]"
- name: πŸ” Inspect environment
run: |
lenskit doctor
- 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-vanilla-${{matrix.platform}}-py${{matrix.python}}"
path: |
test*.log
coverage.db
coverage.xml
nojit:
name: Non-JIT test coverage
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: "πŸ›’ Checkout"
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: prefix-dev/[email protected]
with:
pixi-version: latest
activate-environment: true
environments: test-py311-funksvd
cache-write: false
locked: false
frozen: true
- name: πŸ” Inspect environment
run: |
lenskit doctor
- name: πŸƒπŸ»β€βž‘οΈ Test LKPY
run: |
python -m pytest --verbose --log-file=test.log --durations=25 -m 'not slow' --cov=src/lenskit tests
env:
NUMBA_DISABLE_JIT: 1
PYTORCH_JIT: 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-nojit
path: |
test*.log
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@v5
with:
python-version: "3.11"
- name: πŸ“¦ Set up Python dependencies
run: |
uv pip install --resolution=lowest-direct ".[test,sklearn,funksvd,hpf,implicit]"
- name: πŸ” Inspect environment
run: |
lenskit doctor
- 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
- name: πŸ•ΆοΈ Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: "3.11"
- name: πŸ“¦ Set up Python dependencies
run: |
uv pip install ".[test]" --resolution=lowest-direct
- name: πŸ” Inspect environment
run: |
lenskit doctor
- 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
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: prefix-dev/[email protected]
with:
pixi-version: latest
activate-environment: true
environments: test-py311-full
cache-write: false
locked: false
frozen: true
- name: Cache ML data
uses: actions/cache@v4
with:
path: |
data
!data/*.zip
key: test-eval-mldata
- name: Download ML data
run: |
coverage run --source=src/lenskit -m lenskit data fetch -D data --movielens ml-100k ml-20m ml-1m ml-10m
- name: Run Eval Tests
run: |
pytest --cov-append --cov=src/lenskit -m 'eval or realdata' --log-file test-eval.log 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-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
- uses: prefix-dev/[email protected]
with:
pixi-version: latest
activate-environment: true
environments: test-examples
cache-write: false
locked: false
frozen: true
- 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:
- conda
- vanilla
- nojit
- 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 [email protected]
- uses: prefix-dev/[email protected]
with:
pixi-version: latest
activate-environment: true
environments: report
locked: false
frozen: true
- 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 xml
coverage html -d lenskit-coverage
coverage report --format=markdown >coverage.md
- name: Analyze diff coverage
if: github.event_name == 'pull_request'
run: |
diff-cover --json-report diff-cover.json --markdown-report diff-cover.md \
coverage.xml |tee diff-cover.txt
- name: πŸ“€ Upload coverage to CodeCov
uses: codecov/[email protected]
env:
CODECOV_TOKEN: ab58c9cf-25b8-4283-a485-0b6382dc9a61