-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* modified publish workflow using same as https://github.com/aprsa/ndpolator/blob/main/.github/workflows/on_release.yaml * address build wheel warnings * bump ubuntu runner to 24.04 * upgrade cibuildwheel * skip failing builds
- Loading branch information
Showing
2 changed files
with
59 additions
and
47 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,52 +1,59 @@ | ||
name: Release | ||
|
||
on: | ||
# NOTE: PR trigger is to ensure changes do not break packaging. | ||
pull_request: | ||
release: | ||
types: [released] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
workflow_dispatch: | ||
pull_request: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build-n-publish: | ||
name: Build and publish Python distributions to PyPI | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | ||
if: github.repository == 'phoebe-project/phoebe2' | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Install python-build and twine | ||
run: python -m pip install build "twine>=3.3" | ||
|
||
- name: Build package | ||
run: python -m build --sdist --wheel . | ||
|
||
- name: List result | ||
run: ls -l dist | ||
|
||
- name: Check dist | ||
run: python -m twine check --strict dist/* | ||
|
||
- name: Test package | ||
run: | | ||
cd .. | ||
python -m venv testenv | ||
testenv/bin/pip install pytest phoebe2/dist/*.whl | ||
testenv/bin/python -c "import phoebe" | ||
# NOTE: Do not run this part for PR testing. | ||
- name: Publish distribution to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
if: github.event_name != 'pull_request' | ||
build-sdist: | ||
name: Package source distribution | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build sdist tarball | ||
run: | | ||
pipx run build --sdist | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: cibw-sdist | ||
path: dist/*.tar.gz | ||
|
||
build-wheels: | ||
name: Build wheels on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-24.04, macos-13, macos-14] | ||
steps: | ||
- name: Checkout the sources | ||
uses: actions/checkout@v4 | ||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
env: | ||
CIBW_SKIP: pp37-* pp38-* pp39-* pp31*-macosx* | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | ||
path: ./wheelhouse/*.whl | ||
|
||
publish-to-pypi: | ||
if: github.event_name != 'pull_request' | ||
needs: [build-sdist, build-wheels] | ||
name: Publish release to PyPI | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/phoebe | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Gather sdist tarball and wheels | ||
uses: actions/download-artifact@v4 | ||
with: | ||
pattern: cibw-* | ||
path: dist | ||
merge-multiple: true | ||
- name: Publish package distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 |
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