Skip to content

Test against Python 3.12 in CI and update pre-commit versions #254

Test against Python 3.12 in CI and update pre-commit versions

Test against Python 3.12 in CI and update pre-commit versions #254

Workflow file for this run

name: Tests
on:
pull_request:
push:
branches: [ main ]
jobs:
test:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: true
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup mamba
uses: conda-incubator/setup-miniconda@v2
id: setup_mamba
continue-on-error: true
with:
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
python-version: ${{ matrix.python-version }}
channels: conda-forge,${{ contains(matrix.python-version, 'pypy') && 'defaults' || 'nodefaults' }}
channel-priority: ${{ contains(matrix.python-version, 'pypy') && 'flexible' || 'strict' }}
activate-environment: graphblas
auto-activate-base: false
- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
id: setup_conda
if: steps.setup_mamba.outcome == 'failure'
continue-on-error: false
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
channels: conda-forge,${{ contains(matrix.python-version, 'pypy') && 'defaults' || 'nodefaults' }}
channel-priority: ${{ contains(matrix.python-version, 'pypy') && 'flexible' || 'strict' }}
activate-environment: graphblas
auto-activate-base: false
- name: Install dependencies
run: |
$(command -v mamba || command -v conda) install python-suitesparse-graphblas scipy pandas donfig pyyaml numpy \
pytest-cov pytest-randomly pytest-mpl ${{ matrix.python-version != '3.12' && 'python-graphblas' || '' }}
if [[ ${{ matrix.python-version }} == "3.12" ]]; then
# TODO: install via conda once there are builds for 3.12
pip install --no-deps python-graphblas
fi
# matplotlib lxml pygraphviz pydot sympy # Extra networkx deps we don't need yet
pip install git+https://github.com/networkx/networkx.git@main --no-deps
pip install -e . --no-deps
- name: PyTest
run: |
python -c 'import sys, graphblas_algorithms; assert "networkx" not in sys.modules'
coverage run --branch -m pytest --color=yes -v --check-structure
coverage report
# NETWORKX_GRAPH_CONVERT=graphblas pytest --color=yes --pyargs networkx --cov --cov-append
./run_nx_tests.sh --color=yes --cov --cov-append
coverage report
coverage xml
- name: Coverage
uses: codecov/codecov-action@v3