Skip to content

Commit

Permalink
build: add py3-none-any wheels to the distribution artifacts (#1914)
Browse files Browse the repository at this point in the history
* Add an option to disable compilation of the binary wheel.

* Modify sdist workflow to also produce a py3-none-any wheel.

* Correct the reference to the non-binary job.
  • Loading branch information
freakboy3742 authored Jan 10, 2025
1 parent 4fa393a commit 40c40b6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
26 changes: 14 additions & 12 deletions .github/workflows/kit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ jobs:
run: |
python -m pip install -r requirements/kit.pip
- name: "Build wheels"
- name: "Build binary wheels"
env:
CIBW_BUILD: ${{ matrix.py }}*-*
CIBW_ARCHS: ${{ matrix.arch }}
Expand All @@ -173,23 +173,23 @@ jobs:
run: |
python -m cibuildwheel --output-dir wheelhouse
- name: "List wheels"
- name: "List binary wheels"
run: |
ls -al wheelhouse/
- name: "Check wheels"
run: |
python -m twine check wheelhouse/*
- name: "Upload wheels"
- name: "Upload binary wheels"
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: dist-${{ env.MATRIX_ID }}
path: wheelhouse/*.whl
retention-days: 7

sdist:
name: "Source distribution"
non-binary:
name: "Non-binary artifacts"
runs-on: ubuntu-latest
steps:
- name: "Check out the repo"
Expand All @@ -208,23 +208,25 @@ jobs:
run: |
python -m pip install -r requirements/kit.pip
- name: "Build sdist"
- name: "Build non-binary artifacts"
env:
COVERAGE_DISABLE_EXTENSION: 1
run: |
python -m build
- name: "List sdist"
- name: "List non-binary artifacts"
run: |
ls -al dist/
- name: "Check sdist"
- name: "Check non-binary artifacts"
run: |
python -m twine check dist/*
- name: "Upload sdist"
- name: "Upload non-binary artifacts"
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: dist-sdist
path: dist/*.tar.gz
name: dist-non-binary
path: dist/*
retention-days: 7

pypy:
Expand Down Expand Up @@ -277,7 +279,7 @@ jobs:
name: "Sign artifacts"
needs:
- wheels
- sdist
- non-binary
- pypy
runs-on: ubuntu-latest
permissions:
Expand Down
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,11 @@ def build_extension(self, ext):


# There are a few reasons we might not be able to compile the C extension.
# Figure out if we should attempt the C extension or not.
# Figure out if we should attempt the C extension or not. Define
# COVERAGE_DISABLE_EXTENSION in the build environment to explicitly disable the
# extension.

compile_extension = True
compile_extension = os.getenv("COVERAGE_DISABLE_EXTENSION", None) is None

if "__pypy__" in sys.builtin_module_names:
# Pypy can't compile C extensions
Expand Down

0 comments on commit 40c40b6

Please sign in to comment.