Debian Codegraph @

.github/workflows/publish.yml

raw
1 name: publish
2
3 on:
4 release:
5 types: [published]
6
7 jobs:
8 sdist:
9 runs-on: ubuntu-latest
10 permissions:
11 contents: write
12 steps:
13 - uses: actions/checkout@v4
14 - uses: astral-sh/setup-uv@v5
15 - name: Set version from release tag
16 run: uv version --frozen "${GITHUB_REF_NAME#v}"
17 - uses: actions/setup-python@v5
18 with:
19 python-version: '3.12'
20 - run: pip install build
21 - run: python -m build --sdist
22 - uses: actions/upload-artifact@v4
23 with:
24 name: sdist
25 path: dist/*.tar.gz
26 - name: Upload to GitHub Release
27 uses: softprops/action-gh-release@v2
28 with:
29 files: dist/*.tar.gz
30
31 wheels-linux-x86_64:
32 runs-on: ubuntu-latest
33 container: quay.io/pypa/manylinux_2_34_x86_64
34 permissions:
35 contents: write
36 strategy:
37 fail-fast: false
38 matrix:
39 python: [cp310-cp310, cp311-cp311, cp312-cp312, cp313-cp313, cp314-cp314, cp314-cp314t]
40 steps:
41 - uses: actions/checkout@v4
42 - name: Set version from release tag
43 run: uv version --frozen "${GITHUB_REF_NAME#v}"
44 - name: Build wheel
45 run: |
46 /opt/python/${{ matrix.python }}/bin/pip install -U setuptools wheel
47 /opt/python/${{ matrix.python }}/bin/pip wheel . --no-build-isolation --no-deps -w /tmp/raw/
48 auditwheel repair /tmp/raw/caio-*.whl -w dist/ && rm /tmp/raw/caio-*.whl
49 - uses: actions/upload-artifact@v4
50 with:
51 name: wheel-linux-x86_64-${{ matrix.python }}
52 path: dist/*.whl
53 - name: Upload to GitHub Release
54 uses: softprops/action-gh-release@v2
55 with:
56 files: dist/*.whl
57
58 wheels-linux-aarch64:
59 runs-on: ubuntu-24.04-arm
60 container: quay.io/pypa/manylinux_2_34_aarch64
61 permissions:
62 contents: write
63 strategy:
64 fail-fast: false
65 matrix:
66 python: [cp310-cp310, cp311-cp311, cp312-cp312, cp313-cp313, cp314-cp314, cp314-cp314t]
67 steps:
68 - uses: actions/checkout@v4
69 - name: Set version from release tag
70 run: uv version --frozen "${GITHUB_REF_NAME#v}"
71 - name: Build wheel
72 run: |
73 /opt/python/${{ matrix.python }}/bin/pip install -U setuptools wheel
74 /opt/python/${{ matrix.python }}/bin/pip wheel . --no-build-isolation --no-deps -w /tmp/raw/
75 auditwheel repair /tmp/raw/caio-*.whl -w dist/ && rm /tmp/raw/caio-*.whl
76 - uses: actions/upload-artifact@v4
77 with:
78 name: wheel-linux-aarch64-${{ matrix.python }}
79 path: dist/*.whl
80 - name: Upload to GitHub Release
81 uses: softprops/action-gh-release@v2
82 with:
83 files: dist/*.whl
84
85 wheels-musllinux-x86_64:
86 runs-on: ubuntu-latest
87 container: quay.io/pypa/musllinux_1_2_x86_64
88 permissions:
89 contents: write
90 strategy:
91 fail-fast: false
92 matrix:
93 python: [cp310-cp310, cp311-cp311, cp312-cp312, cp313-cp313, cp314-cp314, cp314-cp314t]
94 steps:
95 - uses: actions/checkout@v4
96 - name: Set version from release tag
97 run: uv version --frozen "${GITHUB_REF_NAME#v}"
98 - name: Build wheel
99 run: |
100 /opt/python/${{ matrix.python }}/bin/pip install -U setuptools wheel
101 /opt/python/${{ matrix.python }}/bin/pip wheel . --no-build-isolation --no-deps -w /tmp/raw/
102 auditwheel repair /tmp/raw/caio-*.whl -w dist/ && rm /tmp/raw/caio-*.whl
103 - uses: actions/upload-artifact@v4
104 with:
105 name: wheel-musllinux-x86_64-${{ matrix.python }}
106 path: dist/*.whl
107 - name: Upload to GitHub Release
108 uses: softprops/action-gh-release@v2
109 with:
110 files: dist/*.whl
111
112 wheels-musllinux-aarch64:
113 # Deliberately NOT run inside `container:` (unlike every other wheels-*
114 # job) - GitHub Actions cannot run JavaScript-based actions (checkout,
115 # upload-artifact, the gh-release upload) inside an Alpine container on
116 # an ARM64 runner ("JavaScript Actions in Alpine containers are only
117 # supported on x64 Linux runners" - a known GitHub Actions limitation,
118 # architecture-specific, which is why wheels-musllinux-x86_64 doesn't
119 # need this workaround). Instead: checkout/upload/release run directly
120 # on the plain Ubuntu ARM64 host, and only the actual musl-linked build
121 # step below runs inside the musllinux container, invoked explicitly via
122 # `docker run` against the checked-out workspace bind-mounted in - the
123 # GitHub-hosted ARM64 runner image ships Docker already (proven by every
124 # other container:-based job on this same runner type relying on it).
125 runs-on: ubuntu-24.04-arm
126 permissions:
127 contents: write
128 strategy:
129 fail-fast: false
130 matrix:
131 python: [cp310-cp310, cp311-cp311, cp312-cp312, cp313-cp313, cp314-cp314, cp314-cp314t]
132 steps:
133 - uses: actions/checkout@v4
134 - uses: astral-sh/setup-uv@v5
135 - name: Set version from release tag
136 run: uv version --frozen "${GITHUB_REF_NAME#v}"
137 - name: Build wheel
138 run: |
139 docker run --rm -v "${{ github.workspace }}:/work" -w /work \
140 quay.io/pypa/musllinux_1_2_aarch64 bash -c '
141 /opt/python/${{ matrix.python }}/bin/pip install -U setuptools wheel &&
142 /opt/python/${{ matrix.python }}/bin/pip wheel . --no-build-isolation --no-deps -w /tmp/raw/ &&
143 auditwheel repair /tmp/raw/caio-*.whl -w dist/ &&
144 rm /tmp/raw/caio-*.whl
145 '
146 - uses: actions/upload-artifact@v4
147 with:
148 name: wheel-musllinux-aarch64-${{ matrix.python }}
149 path: dist/*.whl
150 - name: Upload to GitHub Release
151 uses: softprops/action-gh-release@v2
152 with:
153 files: dist/*.whl
154
155 wheels-macos:
156 runs-on: macos-latest
157 permissions:
158 contents: write
159 strategy:
160 fail-fast: false
161 matrix:
162 python: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.13t", "3.14t"]
163 steps:
164 - uses: actions/checkout@v4
165 - uses: astral-sh/setup-uv@v5
166 with:
167 python-version: "${{ matrix.python }}"
168 - name: Set version from release tag
169 run: uv version --frozen "${GITHUB_REF_NAME#v}"
170 - run: uv build --wheel
171 - uses: actions/upload-artifact@v4
172 with:
173 name: wheel-macos-${{ matrix.python }}
174 path: dist/*.whl
175 - name: Upload to GitHub Release
176 uses: softprops/action-gh-release@v2
177 with:
178 files: dist/*.whl
179
180 wheels-windows:
181 runs-on: windows-latest
182 permissions:
183 contents: write
184 steps:
185 - uses: actions/checkout@v4
186 - uses: astral-sh/setup-uv@v5
187 - name: Set version from release tag
188 run: uv version --frozen "${GITHUB_REF_NAME#v}"
189 shell: bash
190 - uses: actions/setup-python@v5
191 with:
192 python-version: "3.12"
193 - run: pip install build
194 - run: python -m build --wheel
195 - uses: actions/upload-artifact@v4
196 with:
197 name: wheel-windows
198 path: dist/*.whl
199 - name: Upload to GitHub Release
200 uses: softprops/action-gh-release@v2
201 with:
202 files: dist/*.whl
203
204 pypi:
205 needs: [sdist, wheels-linux-x86_64, wheels-linux-aarch64, wheels-musllinux-x86_64, wheels-musllinux-aarch64, wheels-macos, wheels-windows]
206 runs-on: ubuntu-latest
207 environment: pypi
208 permissions:
209 id-token: write
210 steps:
211 - uses: actions/download-artifact@v4
212 with:
213 pattern: 'wheel-*'
214 path: dist
215 merge-multiple: true
216 - uses: actions/download-artifact@v4
217 with:
218 name: sdist
219 path: dist
220 - name: Publish to PyPI
221 uses: pypa/gh-action-pypi-publish@release/v1
222 with:
223 packages-dir: dist
224 skip-existing: true