77 # Enable Run Workflow button in GitHub UI
88 workflow_dispatch :
99
10+ push :
11+ branches : [ main ]
12+
13+ pull_request :
14+
1015concurrency :
1116 group : ${{ github.workflow }}-${{ github.ref }}
1217 cancel-in-progress : true
@@ -34,55 +39,47 @@ jobs:
3439 build_wheels :
3540 name : Wheels - ${{ matrix.cibw_archs }} - ${{ matrix.os }}
3641 runs-on : ${{ matrix.os }}
42+ env :
43+ # graphblas version to use if another one is not provided
44+ default-graphblas-version : " 8.2.0"
45+
3746 strategy :
3847 fail-fast : false
3948 matrix :
40- # Loosely based on scikit-learn's config:
41- # https://github.com/scikit-learn/scikit-learn/blob/main/.github/workflows/wheels.yml
4249 include :
4350 - os : windows-latest
44- python-version : " 3.8"
45- platform_id : win_amd64
46- cibw_archs : " auto"
51+ cibw_archs : " auto64"
4752
48- # Linux 64 bit manylinux2014
53+ # Linux x86
4954 - os : ubuntu-latest
50- python-version : " 3.8"
51- platform_id : manylinux_x86_64
52- manylinux_image : manylinux2014
53- cibw_archs : " native"
55+ cibw_archs : " x86_64"
56+ # skip musllinux
57+ cibw_skip : " *musl*"
5458
55- # Linux 64 bit manylinux2014 for aarch64
59+ # Linux aarch64
5660 # Separate runner because this requires emulation (only x86 runners are available) and is very slow.
5761 - os : ubuntu-latest
58- python-version : " 3.8"
59- platform_id : manylinux_x86_64
60- manylinux_image : manylinux2014
6162 cibw_archs : " aarch64"
63+ # numpy wheels not available for aarch64 PyPy or musllinux
64+ cibw_skip : " pp* *musl*"
6265
6366 # macOS x86
6467 - os : macos-latest
65- python-version : " 3.8"
66- platform_id : macosx_x86_64
6768 cibw_archs : " x86_64"
6869
69- # Use x86 macOS runner to build ARM .
70+ # macOS Apple Silicon cross-compiled on x86 macOS runner .
7071 # GitHub does not offer Apple Silicon yet (only for self-hosted).
7172 # See https://github.com/github/roadmap/issues/528
7273 - os : macos-latest
73- python-version : " 3.8"
74- platform_id : macosx_x86_64
7574 cibw_archs : " arm64"
75+ # Skip macOS ARM tests on Intel runner.
76+ cibw_test_skip : " *-macosx_arm64"
7677
7778 steps :
7879 - uses : actions/checkout@v4
7980 with :
8081 fetch-depth : 0
8182
82- - uses : actions/setup-python@v4
83- with :
84- python-version : ${{ matrix.python-version }}
85-
8683 # aarch64 Linux builds are cross-compiled on x86 runners using emulation
8784 # see https://cibuildwheel.readthedocs.io/en/stable/faq/#emulation
8885 - name : Setup QEMU (for aarch64)
9895 run : |
9996 echo "SUITESPARSE_FAST_BUILD=1" >> $GITHUB_ENV
10097
98+ - name : Setup for testing
99+ if : github.event_name == 'push' || github.event_name == 'pull_request'
100+ # Ask suitesparse.sh to compile in the fastest way possible and provide a GB version to build
101+ run : |
102+ echo "SUITESPARSE_FASTEST_BUILD=1" >> $GITHUB_ENV
103+ echo "GB_VERSION_REF=refs/tags/${{ env.default-graphblas-version }}.0" >> $GITHUB_ENV
104+ shell : bash
105+
106+ - name : Setup GraphBLAS version from git tag
107+ if : ${{ startsWith(github.ref, 'refs/tags/') }}
108+ # If this is a tagged ref, like a release, then use the tag for the graphblas version
109+ run : echo "GB_VERSION_REF=${{ github.ref }}" >> $GITHUB_ENV
110+ shell : bash
111+
101112 - name : Install tools (macOS)
102113 if : contains(matrix.os, 'macos')
103114 # Install coreutils which includes `nproc` used by `make -j` in suitesparse.sh
@@ -112,18 +123,20 @@ jobs:
112123 sh add_arm_to_libomp_dylib.sh
113124 fi
114125
115- - name : Build Wheels
126+ 127+ with :
128+ output-dir : wheelhouse
116129 env :
117130 # very verbose
118131 CIBW_BUILD_VERBOSITY : 3
119132
120133 # Build SuiteSparse
121- CIBW_BEFORE_ALL : bash suitesparse.sh ${{ github.ref }}
134+ CIBW_BEFORE_ALL : bash suitesparse.sh ${{ env.GB_VERSION_REF }}
122135
123136 # Install FFI dev library, needed for Python 3.12
124137 CIBW_BEFORE_BUILD_LINUX : yum install -y libffi-devel
125138
126- CIBW_ENVIRONMENT_LINUX : SUITESPARSE_FAST_BUILD=${{ env.SUITESPARSE_FAST_BUILD }}
139+ CIBW_ENVIRONMENT_PASS_LINUX : SUITESPARSE_FAST_BUILD SUITESPARSE_FASTEST_BUILD
127140
128141 # CMAKE_GNUtoMS=ON asks suitesparse.sh to build libraries in MSVC style on Windows.
129142 CIBW_ENVIRONMENT_WINDOWS : CMAKE_GNUtoMS=ON GRAPHBLAS_PREFIX="C:/GraphBLAS"
@@ -138,11 +151,8 @@ jobs:
138151 # Architectures to build specified in matrix
139152 CIBW_ARCHS : ${{ matrix.cibw_archs }}
140153
141- # No 32-bit builds
142- # no musllinux
143- # no PyPy aarch64 (only due to build speed, numpy does not ship aarch64 pypy wheels)
144154 # as of writing numpy does not support pypy 3.10
145- CIBW_SKIP : " *-win32 *_i686 *musl* pp*aarch64 pp310*"
155+ CIBW_SKIP : " ${{ matrix.cibw_skip }} pp310*"
146156
147157 # Use delvewheel on Windows.
148158 # This copies graphblas.dll into the wheel. "repair" in cibuildwheel parlance includes copying any shared
@@ -159,14 +169,7 @@ jobs:
159169 # run tests
160170 CIBW_TEST_COMMAND : " pytest --pyargs suitesparse_graphblas -s -k test_print_jit_config && pytest -v --pyargs suitesparse_graphblas"
161171
162- # GitHub Actions macOS Intel runner cannot run ARM tests. Uncomment to silence warning.
163- CIBW_TEST_SKIP : " *-macosx_arm64"
164-
165- run : |
166- python -m pip install --upgrade pip
167- python -m pip install cibuildwheel
168- python -m cibuildwheel --output-dir wheelhouse .
169- shell : bash
172+ CIBW_TEST_SKIP : ${{ matrix.cibw_test_skip }}
170173
171174 - uses : actions/upload-artifact@v3
172175 id : uploadAttempt1
@@ -189,8 +192,8 @@ jobs:
189192 name : Upload to PyPI
190193 needs : [build_wheels, build_sdist]
191194 runs-on : ubuntu-latest
192- if : github.repository == 'GraphBLAS/python-suitesparse-graphblas'
193- # if: github.event_name == 'release' && github.event.action == 'published'
195+ # only upload releases to PyPI
196+ if : github.repository == 'GraphBLAS/python-suitesparse-graphblas' && github.event_name == 'release' && github.event.action == 'published'
194197
195198 steps :
196199 - uses : actions/setup-python@v4
@@ -212,4 +215,4 @@ jobs:
212215
213216 # Test PyPI:
214217 # password: ${{ secrets.TEST_PYPI_API_TOKEN }}
215- # repository_url : https://test.pypi.org/legacy/
218+ # repository-url : https://test.pypi.org/legacy/
0 commit comments