Skip to content

Commit 9bcc325

Browse files
authored
PyPI release workflow test (#97)
* Add toml cibuild linux section * Add cibw corrections * Testing cibw workflow * New attempt to build * New attempt cibuild * Add option to include pyci package data * Fix option to include pyci package data * Fix option to include pyci package data * Fix errors in build workflow * Add actions to publish wheels * Add fix to actions to publish wheels * Add fix to actions to publish wheels * Simplify matrix (temporal) for speed and add fixes to pypi workflow * Simplify matrix (temporal) for speed and add fixes to pypi workflow * Add fixes to pypi workflow * Add fixes to pypi workflow * Add matrix elements for other wheels * Remove duplicated statements in pyproject.toml
1 parent fa8e533 commit 9bcc325

File tree

3 files changed

+32
-86
lines changed

3 files changed

+32
-86
lines changed

.github/workflows/build_wheels.yml

Lines changed: 6 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -157,27 +157,12 @@ jobs:
157157
mv ./wheelhouse/*.whl $(find ./wheelhouse -type f -name '*.whl' | sed 's/13_0/14_0/')
158158
fi
159159
160-
# - name: Test the build wheels
161-
# run: |
162-
# # Install the built wheels
163-
# pip install pytest
164-
# pip install ./wheelhouse/*.whl
165-
# # Test the installed wheels
166-
# pytest project/pyci
167-
168160
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
169161
with:
170-
path: ./wheelhouse/*.whl
162+
path: wheelhouse
171163
name: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}
172164
${{ matrix.buildplat[2] }} ${{ matrix.buildplat[3] }}
173165
${{ matrix.buildplat[4] }}
174-
175-
176-
177-
# TODO: Test the build wheels
178-
# - name: Test the build wheels
179-
180-
# TODO: Upload the build wheels to the release
181166

182167
publish-to-pypi:
183168
name: Publish Python distribution to PyPI
@@ -193,79 +178,14 @@ jobs:
193178
id-token: write
194179

195180
steps:
196-
- name: Download all the dists
197-
uses: actions/download-artifact@v4
198-
with:
199-
name: python-package-distributions
200-
path: ./wheelhouse/*.whl
201-
- name: Publish distribution to PyPI
202-
uses: pypa/gh-action-pypi-publish@release/v1
203-
env:
204-
TWINE_USERNAME: "__token__"
205-
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
206-
207-
github-release:
208-
name: Sign the Python distribution with Sigstore and upload them to GitHub Release
209-
needs:
210-
- publish-to-pypi
211-
runs-on: ubuntu-latest
212-
213-
permissions:
214-
contents: write
215-
id-token: write
216-
217-
steps:
218-
- name: Download all the dists
181+
- name: Download wheels
219182
uses: actions/download-artifact@v4
220183
with:
221-
name: python-package-distributions
222-
path: ./wheelhouse
223-
- name: Sign the dists with Sigstore
224-
uses: sigstore/[email protected]
225-
with:
226-
inputs: >-
227-
./wheelhouse/*.whl
228-
229-
- name: Create GitHub Release
230-
env:
231-
GITHUB_TOKEN: ${{ github.token }}
232-
run: >-
233-
gh release create
234-
"${{ github.ref_name }}"
235-
--repo "${{ github.repository }}"
236-
--notes ""
237-
- name: Upload artifact signatures to GitHub Release
238-
env:
239-
GITHUB_TOKEN: ${{ github.token }}
240-
run: >-
241-
gh release upload
242-
"${{ github.ref_name }}" wheelhouse/**
243-
--repo "${{ github.repository }}"
244-
245-
publish-to-testpypi:
246-
name: Publish Python distribution to TestPyPI
247-
# if: ${{ github.ref == "refs/heads/master" && github.repository_owner == "theochem" }}
248-
needs:
249-
- build_wheels
250-
runs-on: ubuntu-latest
251-
252-
environment:
253-
name: TestPyPI
254-
url: https://test.pypi.org/project/${{ env.PYPI_NAME }}
184+
path: dist
185+
merge-multiple: true
255186

256-
permissions:
257-
id-token: write
258-
259-
steps:
260-
- name: Download all the dists
261-
uses: actions/download-artifact@v4
262-
with:
263-
name: python-package-distributions
264-
path: wheelhouse/
265-
- name: Publish distribution to TestPyPI
187+
- name: Publish distribution to PyPI
266188
uses: pypa/gh-action-pypi-publish@release/v1
267-
with:
268-
repository-url: https://test.pypi.org/legacy/
269189
env:
270190
TWINE_USERNAME: "__token__"
271-
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
191+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}

MANIFEST.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,10 @@ include README.rst
55
include doc/Makefile
66
include doc/source/conf.py
77
include doc/source/*.rst
8+
include pyci/pyci.so.0
9+
include pyci/pyci.so.0.6.1
10+
include pyci/_pyci.so
11+
include pyci/_pyci.so.0
12+
include pyci/_pyci.so.0.6.1
13+
14+

build_wrapper.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import os
2+
import subprocess
3+
import sys
4+
5+
def build_with_make():
6+
# Ensure we're in the correct directory (root of the project with Makefile)
7+
os.chdir(os.path.dirname(os.path.abspath(__file__)))
8+
9+
try:
10+
subprocess.run(["make"])
11+
except subprocess.CalledProcessError as e:
12+
print("Error: make failed with exit code", e.returncode)
13+
sys.exit(1)
14+
15+
try:
16+
subprocess.run(["make", "test"])
17+
except subprocess.CalledProcessError as e:
18+
print("Error: make test failed with exit code", e.returncode)
19+
sys.exit(1)

0 commit comments

Comments
 (0)