-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (86 loc) · 3.01 KB
/
release.yml
File metadata and controls
104 lines (86 loc) · 3.01 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
name: Release
on:
push:
tags: ["v*"]
pull_request:
paths-ignore:
- "docs/**"
- "**.md"
workflow_dispatch:
jobs:
build_wheels:
name: Wheel (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-latest]
steps:
- uses: actions/checkout@v4
# Install uv for faster dependency installation (required on macOS, bundled in manylinux)
- uses: astral-sh/setup-uv@v4
# Build wheels using cibuildwheel
# ENV variables control the build (architectures, python versions)
- name: Build wheels
uses: pypa/cibuildwheel@v2.21.3
env:
# Build for Python 3.11+
CIBW_BUILD: "cp311-* cp312-* cp313-*"
# Skip PyPy, musllinux, and 32-bit Linux
CIBW_SKIP: "pp* *-musllinux_* *-manylinux_i686"
# Use uv for faster dependency installation (10-100x faster than pip)
CIBW_BUILD_FRONTEND: "build[uv]"
# macOS: Build Universal2 wheels on arm64 runner (macos-latest)
CIBW_ARCHS_MACOS: "universal2"
CIBW_TEST_COMMAND: 'python -c "import netgraph_core; print(netgraph_core.__version__)"'
CIBW_BEFORE_ALL_LINUX: "yum install -y libatomic || (apt-get update && apt-get install -y libatomic1) || apk add libatomic"
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build SDist
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
test_wheels_centos_stream_9:
name: Test wheels (CentOS Stream 9)
needs: [build_wheels]
runs-on: ubuntu-latest
container: quay.io/centos/centos:stream9
steps:
- name: Install Python
run: dnf install -y python3.11 python3.11-pip
- uses: actions/download-artifact@v4
with:
pattern: cibw-wheels-ubuntu-*
path: wheelhouse
merge-multiple: true
- name: Install and test wheel
run: |
python3.11 -m pip install --upgrade pip
python3.11 -m pip install netgraph-core --find-links wheelhouse/
python3.11 -c "import netgraph_core; print('CentOS Stream 9:', netgraph_core.__version__)"
publish_pypi:
name: Publish to PyPI
needs: [build_wheels, build_sdist, test_wheels_centos_stream_9]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write # Required for Trusted Publishing (OIDC)
# Only publish on tag pushes
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1