Repository navigation
173 lines (169 loc) · 6.59 KB
/
Copy pathtest.yml
File metadata and controls
173 lines (169 loc) · 6.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: Tests
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
jobs:
test:
name: pytest (${{ matrix.os }}, py${{ matrix.python-version }}, nx${{ matrix.networkx-version }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
# One failing cell should not cancel the others.
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.11", "3.12", "3.13", "3.14", "3.15"]
# The NetworkX floor (3.6, at its last patch) and the newest release.
networkx-version: ["3.6.1", "latest"]
exclude:
# NetworkX 3.7 requires Python 3.12, so "latest" would be 3.6.1 again.
- python-version: "3.11"
networkx-version: "latest"
include:
# Additional architectures, at one Python version to limit the cost.
- os: macos-15-intel
python-version: "3.13"
networkx-version: "3.6.1"
- os: ubuntu-24.04-arm
python-version: "3.13"
networkx-version: "3.6.1"
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0
- name: Setup mamba
uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0
id: setup_mamba
continue-on-error: true
with:
miniforge-variant: Miniforge3
miniforge-version: latest
use-mamba: true
python-version: ${{ matrix.python-version }}
channels: conda-forge
channel-priority: strict
activate-environment: graphblas
- name: Setup conda
uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0
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
channel-priority: strict
activate-environment: graphblas
- name: Install dependencies
run: |
if [ "${{ matrix.networkx-version }}" = "latest" ]; then
nx=networkx
else
nx=networkx=${{ matrix.networkx-version }}
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
# matplotlib lxml pygraphviz pydot sympy # Extra networkx deps we don't need yet
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
coverage report
coverage xml
# act, which runs these workflows locally, sets ACT; GitHub does not.
- name: Coverage
if: ${{ !env.ACT }}
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
networkx:
# 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
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
networkx-version: ["3.6.1", "latest"]
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0
- name: Setup mamba
uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0
id: setup_mamba
continue-on-error: true
with:
miniforge-variant: Miniforge3
miniforge-version: latest
use-mamba: true
python-version: "3.13"
channels: conda-forge
channel-priority: strict
activate-environment: graphblas
- name: Setup conda
uses: conda-incubator/setup-miniconda@be893c923ea9cf1cf7cd510fbdde27c7e18cbdcb # v4.1.0
if: steps.setup_mamba.outcome == 'failure'
continue-on-error: false
with:
auto-update-conda: true
python-version: "3.13"
channels: conda-forge
channel-priority: strict
activate-environment: graphblas
- name: Install dependencies
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"
pip install -e . --no-deps
- name: NetworkX test suite
id: nx_suite
# Advisory: the step may fail, the job passes, the counts are in the step summary.
continue-on-error: true
run: |
# The runner adds no pipefail to a custom shell, and `tee` would set the step's status.
set -o pipefail
./run_nx_tests.sh --color=yes -n auto -q --cov --cov-report=xml | tee nx-suite.log
- name: Publish the suite result
if: always()
env:
SUITE_OUTCOME: ${{ steps.nx_suite.outcome }}
run: |
# The step summary and annotations do not render color escapes.
summary=$(tail -n 1 nx-suite.log 2>/dev/null | sed 's/\x1b\[[0-9;]*m//g')
summary=${summary:-"the suite produced no output"}
{
echo "### NetworkX suite through this backend, on networkx ${{ matrix.networkx-version }}"
echo
echo '```'
echo "$summary"
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
if [ "$SUITE_OUTCOME" != "success" ]; then
echo "::warning::NetworkX suite did not pass on networkx ${{ matrix.networkx-version }}: $summary"
fi
- name: Coverage
if: ${{ !env.ACT }}
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
token: ${{ secrets.CODECOV_TOKEN }}