Skip to content

Commit

Permalink
Add cibuildwheel
Browse files Browse the repository at this point in the history
  • Loading branch information
smith120bh committed Jul 20, 2024
1 parent 8fa7508 commit fcf97f3
Showing 1 changed file with 79 additions and 17 deletions.
96 changes: 79 additions & 17 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,68 @@
name: Release

on:
# push:
# # Sequence of patterns matched against refs/tags
# tags:
# - 'release-v*' # Push events to matching release-v*, i.e. release-v1.0, release-v20.15.10
release:
types: [published, edited]
jobs:
build:
name: Test and Build Python Release Package with Release Dependencies
build_sdist:
name: Build Source Distribution
runs-on: "ubuntu-latest"
steps:
- name: Checkout pyCUFSM Repository
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5

- name: Install dependencies
run: |
python -m pip install --upgrade poetry
poetry install
- name: Build Source Distribution
run: poetry build -f sdist

- name: Upload Source Distribution
uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz

build_wheels:
name: Build wheels on ${{ matrix.python }}-${{ matrix.buildplat[1] }}
needs: build_sdist
runs-on: ${{ matrix.buildplat[0] }}
strategy:
fail-fast: false
matrix:
buildplat:
- [ubuntu-latest, manylinux_x86_64]
- [ubuntu-latest, manylinux_aarch64]
- [ubuntu-latest, musllinux_x86_64]
- [macos-13, macosx_x86_64]
- [macos-14, macosx_arm64]
- [windows-latest, win_amd64]
python: ["cp310", "cp311", "cp312"]

steps:
- name: Checkout pyCUFSM Repository
uses: actions/checkout@v4

- name: Build wheels
uses: pypa/cibuildwheel@v2.19.1
env:
CIBW_BUILD: "${{ matrix.python }}-${{ matrix.buildplat[1] }}"
with:
output-dir: dist

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.python }}-${{ matrix.buildplat[1] }}
path: ./dist/*.whl

run_tests:
name: Fully Test Release Package with Release Dependencies
needs: build_sdist
runs-on: "ubuntu-latest"
strategy:
matrix:
Expand All @@ -36,17 +89,26 @@ jobs:
- name: Run FEM tests with pytest
run: |
poetry run pytest --pspec tests/
- name: Install pypa/build
run: |
pip install build
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
publish:
name: Publish to PyPI
needs:
- build_sdist
- build_wheels
- run_tests
runs-on: "ubuntu-latest"

steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true

- name: Display our files
run: ls dist

- name: Publish to pypi
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down

0 comments on commit fcf97f3

Please sign in to comment.