Skip to content

Commit da81d57

Browse files
committed
Copy the CI pipeline from faery
1 parent ed947a3 commit da81d57

File tree

2 files changed

+58
-11
lines changed

2 files changed

+58
-11
lines changed

.github/workflows/build_wheels.yml

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,29 @@ on:
88
- published
99

1010
env:
11-
CIBW_ARCHS_MACOS: x86_64 arm64
11+
CIBW_SKIP: cp36-* cp37-* cp38-* pp* *i686 *win32
12+
13+
# cibuildhweel macOS configuration
14+
CIBW_ARCHS_MACOS: native
15+
16+
# cibuildhweel linux configuration
1217
CIBW_ARCHS_LINUX: x86_64
18+
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
19+
CIBW_MUSLLINUX_X86_64_IMAGE: musllinux_1_2
1320
CIBW_BEFORE_ALL_LINUX: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain=stable --profile=minimal -y
1421
CIBW_ENVIRONMENT_LINUX: 'PATH="$HOME/.cargo/bin:$PATH"'
15-
CIBW_SKIP: cp36-* cp37-* pp* *i686
22+
23+
# cibuildhweel Windows configuration
24+
CIBW_ARCHS_WINDOWS: AMD64
1625

1726
jobs:
1827
build_wheels:
1928
name: Build wheels on ${{ matrix.os }}
2029
runs-on: ${{ matrix.os }}
2130
strategy:
2231
matrix:
23-
os: [ubuntu-latest, macos-latest, windows-latest]
32+
# macos-13 is an Intel runner, macos-latest is an ARM runner
33+
os: [macos-13, macos-latest, ubuntu-latest, windows-latest]
2434
steps:
2535
- uses: actions/checkout@v4
2636
- uses: dtolnay/rust-toolchain@stable
@@ -39,24 +49,37 @@ jobs:
3949
with:
4050
name: wheelhouse-${{ matrix.os }}
4151
path: ./wheelhouse/*.whl
42-
import_library:
43-
name: Import library on ${{ matrix.os }} with Python ${{ matrix.python }}
52+
test_library:
53+
name: Test library on ${{ matrix.os }} with Python ${{ matrix.python }} and numpy ${{ matrix.numpy }}
4454
runs-on: ${{ matrix.os }}
4555
needs: [build_wheels]
4656
strategy:
4757
matrix:
58+
numpy: ["==1.26.4", ">=2"]
4859
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
49-
os: [ubuntu-latest, macos-latest, windows-latest]
60+
# macos-13 is an Intel runner, macos-latest is an ARM runner
61+
os: [macos-13, macos-latest, ubuntu-latest, windows-latest]
62+
exclude:
63+
# this configuration yields 'Windows fatal exception: access violation'
64+
# this may get fixed in a maintenance upgrade of 1.26.x (x > 4)
65+
- numpy: ==1.26.4
66+
os: windows-latest
67+
python: 3.13
5068
steps:
5169
- uses: actions/setup-python@v5
5270
with:
5371
python-version: ${{ matrix.python }}
72+
- uses: actions/checkout@v4
5473
- uses: actions/download-artifact@v4
5574
with:
56-
name: wheelhouse-${{ matrix.os }}
75+
name: ${{ matrix.os }}
5776
path: wheelhouse
58-
- run: python -m pip install --find-links wheelhouse aedat
59-
- run: python -c 'import aedat'
77+
- run: python -m pip install toml
78+
- run: python -m pip install 'numpy${{ matrix.numpy }}'
79+
- run: python .github/workflows/install_dependencies.py
80+
- run: ls wheelhouse
81+
- run: python -m pip install --no-index --find-links wheelhouse aedat
82+
- run: python -m pytest tests/
6083
build_sdist:
6184
name: Build source distribution
6285
runs-on: ubuntu-latest
@@ -70,13 +93,13 @@ jobs:
7093
upload_pypi:
7194
name: Upload wheels and sidst to PyPI
7295
runs-on: ubuntu-latest
73-
needs: [build_wheels, import_library, build_sdist]
96+
needs: [build_wheels, test_library, build_sdist]
7497
if: github.event_name == 'release' && github.event.action == 'published'
7598
steps:
7699
- uses: actions/download-artifact@v4
77100
with:
78101
path: wheelhouse
79-
pattern: wheelhouse-*
102+
pattern: "*"
80103
merge-multiple: true
81104
- uses: actions/download-artifact@v4
82105
with:
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import pathlib
2+
import subprocess
3+
import sys
4+
5+
import toml
6+
7+
dirname = pathlib.Path(__file__).resolve().parent
8+
9+
print(f"load {dirname.parent.parent / 'pyproject.toml'}")
10+
with open(dirname.parent.parent / "pyproject.toml") as pyproject_file:
11+
pyproject = toml.load(pyproject_file)
12+
13+
dependencies = []
14+
if "project" in pyproject:
15+
project = pyproject["project"]
16+
if "dependencies" in project:
17+
dependencies += project["dependencies"]
18+
if "optional-dependencies" in project:
19+
optional_dependencies = project["optional-dependencies"]
20+
if "tests" in optional_dependencies:
21+
dependencies += optional_dependencies["tests"]
22+
23+
if len(dependencies) > 0:
24+
subprocess.run([sys.executable, "-m", "pip", "install"] + dependencies, check=True)

0 commit comments

Comments
 (0)