Skip to content

Commit

Permalink
Build Python sdist separately to avoid duplicate artifacts (#491)
Browse files Browse the repository at this point in the history
  • Loading branch information
calcmogul committed Apr 6, 2024
1 parent 16e3650 commit 184ce27
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 24 deletions.
75 changes: 52 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
name: ${{ matrix.os }} - native
path: pkg

build-python:
build-python-wheel:
timeout-minutes: 10
strategy:
fail-fast: false
Expand All @@ -50,7 +50,7 @@ jobs:
- os: macOS-14
version: '3.9'

name: "${{ matrix.os }} - python ${{ matrix.version }}"
name: "${{ matrix.os }} - python ${{ matrix.version }} wheel"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand All @@ -69,7 +69,7 @@ jobs:
run: pip3 install build tox

- name: Build
run: python3 -m build
run: python3 -m build --wheel

- name: Repair wheel
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macOS')
Expand All @@ -81,9 +81,57 @@ jobs:

- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }} - python ${{ matrix.version }}
name: ${{ matrix.os }} - python ${{ matrix.version }} wheel
path: dist

build-python-sdist:
timeout-minutes: 10

name: "Python sdist"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.version }}

- name: Update version string
run: python3 ./tools/update_version.py

- name: Install build and tox Python packages
run: pip3 install build tox

- name: Build
run: python3 -m build --sdist

- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }} - python ${{ matrix.version }} sdist
path: dist

pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-22.04
needs: [build-python-wheel, build-python-sdist]
if: github.repository_owner == 'SleipnirGroup' && github.ref == 'refs/heads/main'
environment:
name: pypi
url: https://pypi.org/p/sleipnirgroup-jormungandr
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
path: dist
pattern: '* - python *'
merge-multiple: true
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

build-cross:
strategy:
fail-fast: false
Expand Down Expand Up @@ -135,22 +183,3 @@ jobs:
with:
name: Wasm
path: pkg

pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-22.04
needs: [build-python]
if: github.repository_owner == 'SleipnirGroup' && github.ref == 'refs/heads/main'
environment:
name: pypi
url: https://pypi.org/p/sleipnirgroup-jormungandr
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
path: dist
pattern: '* - python *'
merge-multiple: true
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "sleipnirgroup-jormungandr"
description = "A linearity-exploiting sparse nonlinear constrained optimization problem solver that uses the interior-point method."
version = "0.0.1.dev106"
version = "0.0.1.dev108"
readme = "README.md"
requires-python = ">=3.7"
dependencies = [ "matplotlib", "numpy", "scipy" ]
Expand Down

0 comments on commit 184ce27

Please sign in to comment.