Skip to content

Commit f9a9d21

Browse files
committed
Try adding a simple CI script for GithubActions.
Also, let's require Cython when building (for now). This is probably safest for now (i.e., less error prone). Someday, somebody may want to be able to install from source w/o Cython using only .c files.
1 parent 5d4b0cc commit f9a9d21

File tree

5 files changed

+50
-3
lines changed

5 files changed

+50
-3
lines changed

.github/workflows/test.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: python-suitesparse-graphblas
2+
3+
on:
4+
push:
5+
branches: [ $default-branch ]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
15+
python-version: [3.7, 3.8, 3.9]
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v2
19+
- name: Conda
20+
uses: conda-incubator/setup-miniconda@v2
21+
with:
22+
auto-update-conda: true
23+
python-version: ${{ matrix.python-version }}
24+
channels: conda-forge
25+
- name: Build
26+
run: |
27+
conda info
28+
conda list
29+
conda install -c conda-forge cffi cython numpy graphblas pytest coverage black flake8 # TODO: environment.yml
30+
python setup.py build_ext --inplace
31+
python setup.py develop
32+
- name: Test
33+
env:
34+
CYTHON_COVERAGE: true
35+
run: |
36+
coverage run --branch -m pytest
37+
- name: Lint
38+
run: |
39+
black *py suitesparse_graphblas --check --diff
40+
flake8 *py suitesparse_graphblas

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools", "wheel", "numpy>=1.15"]
2+
requires = ["setuptools", "wheel", "numpy>=1.15", "cython"]
33

44
[tool.black]
55
line-length = 100

setup.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@
2525
define_macros.append(("CYTHON_TRACE_NOGIL", "1"))
2626
else:
2727
suffix = ".c"
28+
# Make sure all required .c files are here
29+
pyx_files = glob("suitesparse_graphblas/**.pyx", recursive=True)
30+
c_files = glob("suitesparse_graphblas/**.c", recursive=True)
31+
missing = {x[:-4] for x in pyx_files} - {x[:-2] for x in c_files}
32+
if missing:
33+
missing_c = sorted(x + ".c" for x in missing)
34+
raise RuntimeError("Cython required when missing C files: " + ", ".join(missing_c))
2835

2936
include_dirs = [np.get_include(), os.path.join(sys.prefix, "include")]
3037
ext_modules = [

suitesparse_graphblas/create_headers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333

3434
def sort_key(string):
35-
""" e.g., sort 'INT8' before 'INT16'"""
35+
"""e.g., sort 'INT8' before 'INT16'"""
3636
return string.replace("8", "08")
3737

3838

suitesparse_graphblas/tests/test_package.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from suitesparse_graphblas import lib, ffi
1+
from suitesparse_graphblas import lib, ffi # noqa
22

33

44
def test_matrix_existence():

0 commit comments

Comments
 (0)