Skip to content

Commit

Permalink
ci: add a py3-none-any fallback wheel
Browse files Browse the repository at this point in the history
  • Loading branch information
art049 committed Jan 7, 2025
1 parent 3b1a30c commit 64900a8
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 11 deletions.
43 changes: 39 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,46 @@ jobs:
name: wheels-${{ matrix.platform.arch }}
path: wheelhouse/*.whl

build-py3-none-any:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v4
- uses: actions/setup-python@v2
with:
python-version: "3.12"
- name: Build py3-none-any wheel
env:
PYTEST_CODSPEED_SKIP_EXTENSION_BUILD: "1"
run: uv build --wheel --out-dir dist/

- uses: actions/upload-artifact@v4
with:
name: wheels-py3-none-any
path: dist/*.whl

build-sdist:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v4
- uses: actions/setup-python@v2
with:
python-version: "3.12"
- name: Build the source dist
run: uv build --sdist --out-dir dist/

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

publish:
needs: build-wheels
needs:
- build-wheels
- build-py3-none-any
- build-sdist

runs-on: ubuntu-24.04
steps:
- uses: actions/download-artifact@v4
Expand All @@ -54,9 +92,6 @@ jobs:
merge-multiple: true
path: dist/

- name: Build the source dist
run: uv build --sdist --out-dir dist/

- name: List artifacts
run: ls -al dist/*

Expand Down
24 changes: 17 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,19 @@
IS_EXTENSION_REQUIRED = (
os.environ.get("PYTEST_CODSPEED_FORCE_EXTENSION_BUILD") is not None
)

SKIP_EXTENSION_BUILD = (
os.environ.get("PYTEST_CODSPEED_SKIP_EXTENSION_BUILD") is not None
)

if SKIP_EXTENSION_BUILD and IS_EXTENSION_REQUIRED:
raise ValueError("Extension build required but the build requires to skip it")

if IS_EXTENSION_REQUIRED and not IS_EXTENSION_BUILDABLE:
raise ValueError(
"The extension is required but the current platform is not supported"
)


ffi_extension = build.ffibuilder.distutils_extension()
ffi_extension.optional = not IS_EXTENSION_REQUIRED

Expand All @@ -43,11 +50,14 @@
)

setup(
package_data={
"pytest_codspeed": [
"instruments/valgrind/_wrapper/*.h",
"instruments/valgrind/_wrapper/*.c",
]
exclude_package_data={
"pytest_codspeed.instruments.valgrind._wrapper": [
"*.c",
"*.h",
"build.py",
],
},
ext_modules=[ffi_extension] if IS_EXTENSION_BUILDABLE else [],
ext_modules=(
[ffi_extension] if IS_EXTENSION_BUILDABLE and not SKIP_EXTENSION_BUILD else []
),
)

0 comments on commit 64900a8

Please # to comment.