Skip to content

Implement packaging using pyproject.toml #97

Implement packaging using pyproject.toml

Implement packaging using pyproject.toml #97

Workflow file for this run

# This workflow builds the sdist on 3.8 and then installs that same sdist on
# clean envs from all python versions, then runs tests.
# We also try to replace numpy with oldest-supported-numpy as install-time
# dependency (install-time == installing from the sdist with the .c files
# present). I'm not sure this is the intended use for the package, but this is
# the only way I can find to test on an "old" version of numpy, instead of the
# latest available like the regular `numpy>=X` constraint would do.
name: Build sdist and test
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
use-oldest-numpy: [true, false]
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Force min dep
if: ${{ matrix.use-oldest-numpy}}
run: |
sed -i "s/numpy.*/oldest-supported-numpy/g" requirements.txt
cat requirements*.txt
- name: Build sdist
run: |
set -x
python -m pip install --upgrade pip
pip install build
pip freeze
python -m build .
- uses: actions/upload-artifact@v4
with:
name: the-sdist-${{ matrix.use-oldest-numpy }}
path: dist/scikit_surprise*
install-and-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
use-oldest-numpy : [true, false]
needs: build
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: the-sdist-${{ matrix.use-oldest-numpy}}
path: dist/
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install sdist
run: |
set -x
python -m pip install --upgrade pip
pip install "`ls dist/scikit_surprise*.tar.gz`[test]" -v
- name: Pip freeze
run: |
pip freeze
- name: Run unit tests
run: |
pytest -v