-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Innoptech/build-wheels-for-multiple-os
ci: build wheels using cibuildwheel
- Loading branch information
Showing
7 changed files
with
216 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,93 @@ | ||
--- | ||
name: Publish OpenSTL | ||
on: push | ||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- 'v*' | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
name: Build distribution 📦 | ||
timeout-minutes: 30 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
runs-on: | ||
- self-hosted | ||
- manylinux | ||
env: | ||
PLAT: manylinux_2_28_x86_64 | ||
if: "github.event_name == 'pull_request'" | ||
name: Build and Test on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-13, macos-14] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.8' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install . | ||
- name: Run tests | ||
run: | | ||
python3 -m pip install numpy pytest | ||
pytest | ||
bump_version_and_tag: | ||
if: "github.event_name == 'push' && github.ref == 'refs/heads/main' && !startsWith(github.event.head_commit.message, 'bump:')" | ||
name: Bump version and tag on main | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
ssh-key: "${{ secrets.COMMIT_KEY }}" | ||
- name: Create bump and changelog | ||
uses: commitizen-tools/commitizen-action@master | ||
with: | ||
push: false | ||
- name: Print Version | ||
run: echo "Bumped to version ${{ steps.cz.outputs.version }}" | ||
- name: Push using ssh | ||
if: github.event_name == 'push' | ||
run: | | ||
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}" | ||
git config --global user.email "[email protected]" | ||
git push --tags | ||
git push | ||
build_wheels: | ||
if: "startsWith(github.event.head_commit.message, 'bump:')" | ||
name: Build wheels on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-13, macos-14] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build a binary wheel and a source tarball -> manylinux_2_28_x86_64 | ||
run: bash python/build-wheels.sh | ||
- name: Store the distribution packages | ||
uses: actions/upload-artifact@v3 | ||
- uses: actions/setup-python@v5 | ||
- name: Print the arch and system | ||
run: | | ||
python -c "import platform; print(f'System: {platform.system()}'); print(f'Architecture: {platform.architecture()[0]}')" | ||
- name: Install cibuildwheel | ||
run: python -m pip install cibuildwheel==2.18.1 | ||
- name: Build wheels | ||
run: python -m cibuildwheel --output-dir wheelhouse | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | ||
path: ./wheelhouse/*.whl | ||
|
||
publish-to-testpypi: | ||
name: Publish Python 🐍 distribution 📦 to TestPyPI | ||
needs: | ||
- build | ||
- build_wheels | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: testpypi | ||
|
@@ -32,37 +96,20 @@ jobs: | |
id-token: write | ||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v3 | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
pattern: cibw-* | ||
path: dist | ||
merge-multiple: true | ||
- name: Publish distribution 📦 to TestPyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
tests: | ||
name: Test openstl testpypi distrib | ||
needs: | ||
- publish-to-testpypi | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["pypy3.7", "pypy3.8", "pypy3.9", "pypy3.10", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Test the python package | ||
run: | | ||
python3 -m pip install --index-url https://test.pypi.org/simple/ openstl | ||
python3 -m pip install numpy pytest | ||
pytest ./tests/python | ||
|
||
publish-to-pypi: | ||
name: Publish Python 🐍 distribution 📦 to PyPI | ||
needs: | ||
- tests | ||
- publish-to-testpypi | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
|
@@ -71,12 +118,14 @@ jobs: | |
id-token: write | ||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v3 | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
pattern: cibw-* | ||
path: dist | ||
merge-multiple: true | ||
- name: Publish distribution 📦 to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
||
github-release: | ||
name: Sign the Python 🐍 distribution 📦 with Sigstore and upload them to GitHub | ||
Release | ||
|
@@ -88,10 +137,11 @@ jobs: | |
id-token: write | ||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v3 | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
pattern: cibw-* | ||
path: dist | ||
merge-multiple: true | ||
- name: Sign the dists with Sigstore | ||
uses: sigstore/[email protected] | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.