Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 38 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,17 @@ on:
permissions:
contents: read

# Cancel superseded runs of a PR; never cancel runs on main.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
test:
name: pytest (${{ matrix.os }}, py${{ matrix.python-version }}, nx${{ matrix.networkx-version }})
runs-on: ${{ matrix.os }}
# A hang would otherwise hold the runner for GitHub's default of 6 hours.
timeout-minutes: 90
defaults:
run:
shell: bash -l {0}
Expand Down Expand Up @@ -44,6 +51,9 @@ jobs:
- name: Setup mamba
uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0
id: setup_mamba
# Setup takes up to about 16 minutes (Windows), but a hung one (macOS, 2026-12-02) held the
# job for 6 hours. Time out, then fall back to conda.
timeout-minutes: 30
continue-on-error: true
with:
miniforge-variant: Miniforge3
Expand All @@ -56,7 +66,10 @@ jobs:
- name: Setup conda
uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0
id: setup_conda
# A step stopped by its timeout reports outcome failure, and continue-on-error keeps the
# job going (checked in a probe run, 2026-12-03), so this fallback runs after a hang too.
if: steps.setup_mamba.outcome == 'failure'
timeout-minutes: 30
continue-on-error: false
with:
auto-update-conda: true
Expand All @@ -65,6 +78,7 @@ jobs:
channel-priority: strict
activate-environment: graphblas
- name: Install dependencies
timeout-minutes: 15
run: |
if [ "${{ matrix.networkx-version }}" = "latest" ]; then
nx=networkx
Expand All @@ -73,12 +87,19 @@ jobs:
fi
# conda, not mamba: on Windows the action's bash wrapper for mamba runs `cmd.exe /C`,
# which Git Bash rewrites to `cmd.exe C:/`, so the install silently does nothing.
conda install python-suitesparse-graphblas scipy pandas donfig pyyaml numpy python-graphblas \
pytest-cov pytest-randomly pytest-xdist "$nx" rich setuptools
for attempt in 1 2 3; do
conda install python-suitesparse-graphblas scipy pandas donfig pyyaml numpy python-graphblas \
pytest-cov pytest-randomly pytest-xdist "$nx" rich setuptools && break
[ "$attempt" = 3 ] && exit 1
echo "conda install failed (attempt $attempt); retrying" >&2; sleep $((attempt * 30))
done
# matplotlib lxml pygraphviz pydot sympy # Extra networkx deps we don't need yet
pip install -e . --no-deps
- name: pytest
timeout-minutes: 30
run: |
# The custom shell has no -e, so a failing pytest would otherwise hide behind `coverage xml`.
set -e
python -c 'import sys, graphblas_algorithms; assert "networkx" not in sys.modules'
coverage run --branch -m pytest --color=yes -v
coverage report
Expand All @@ -94,6 +115,7 @@ jobs:
# Linux and Python 3.13 only: the suite is slow and tests the dispatch layer, not the platform.
name: NetworkX suite through the backend (nx${{ matrix.networkx-version }})
runs-on: ubuntu-latest
timeout-minutes: 120
defaults:
run:
shell: bash -l {0}
Expand All @@ -110,6 +132,9 @@ jobs:
- name: Setup mamba
uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0
id: setup_mamba
# Setup takes up to about 16 minutes (Windows), but a hung one (macOS, 2026-12-02) held the
# job for 6 hours. Time out, then fall back to conda.
timeout-minutes: 30
continue-on-error: true
with:
miniforge-variant: Miniforge3
Expand All @@ -121,7 +146,10 @@ jobs:
activate-environment: graphblas
- name: Setup conda
uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0
# A step stopped by its timeout reports outcome failure, and continue-on-error keeps the
# job going (checked in a probe run, 2026-12-03), so this fallback runs after a hang too.
if: steps.setup_mamba.outcome == 'failure'
timeout-minutes: 30
continue-on-error: false
with:
auto-update-conda: true
Expand All @@ -130,17 +158,23 @@ jobs:
channel-priority: strict
activate-environment: graphblas
- name: Install dependencies
timeout-minutes: 15
run: |
if [ "${{ matrix.networkx-version }}" = "latest" ]; then
nx=networkx
else
nx=networkx=${{ matrix.networkx-version }}
fi
# pytest-mpl brings matplotlib, which NetworkX's drawing tests need.
conda install python-suitesparse-graphblas scipy pandas donfig pyyaml numpy python-graphblas \
pytest-cov pytest-randomly pytest-mpl pytest-xdist "$nx"
for attempt in 1 2 3; do
conda install python-suitesparse-graphblas scipy pandas donfig pyyaml numpy python-graphblas \
pytest-cov pytest-randomly pytest-mpl pytest-xdist "$nx" && break
[ "$attempt" = 3 ] && exit 1
echo "conda install failed (attempt $attempt); retrying" >&2; sleep $((attempt * 30))
done
pip install -e . --no-deps
- name: NetworkX test suite
timeout-minutes: 60
id: nx_suite
# Advisory: the step may fail, the job passes, the counts are in the step summary.
continue-on-error: true
Expand Down
Loading