Skip to content

Commit

Permalink
🧪 Pass sdist into cibuildwheel directly
Browse files Browse the repository at this point in the history
This patch also brings a copy of `cibuildwheel` in through the GitHub
Actions interface instead of PyPI.
  • Loading branch information
webknjaz committed May 28, 2024
1 parent 4e60e2a commit 2eda2d1
Showing 1 changed file with 23 additions and 44 deletions.
67 changes: 23 additions & 44 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ jobs:
if: ${{ ! contains(matrix.spec, 'x86_64') }}

- name: build/test wheels
uses: pypa/[email protected]
env:
CFLAGS: -Dffi_call=cffistatic_ffi_call # override name for ffi_call to break hard if we linked against someone else's libffi
CIBW_ARCHS_LINUX: all
Expand All @@ -292,29 +293,21 @@ jobs:
CIBW_PRERELEASE_PYTHONS: 'True'
CIBW_TEST_REQUIRES: pytest setuptools # 3.12+ no longer includes distutils, just always ensure setuptools is present
CIBW_TEST_COMMAND: PYTHONUNBUFFERED=1 python -m pytest ${{ matrix.test_args || '{project}' }} # default to test all
run: |
set -eux
mkdir cffi
tar zxf ${{ steps.fetch_sdist.outputs.download-path }}/cffi*.tar.gz/cffi*.tar.gz --strip-components=1 -C cffi
python -m pip install --upgrade "${{ matrix.cibw_version || 'cibuildwheel' }}"
# actually build libffi + wheel (using env tweaks above)
python -m cibuildwheel --output-dir dist ./cffi
shell: bash
with:
package-dir: >-
${{ steps.fetch_sdist.outputs.download-path
}}/${{ needs.python_sdist.outputs.artifact_name }}
- name: determine built wheel filename
id: built-artifact-lookup
run: echo "artifact_name=$(ls ./dist/)" >> "${GITHUB_OUTPUT}"
run: echo "artifact_name=$(ls ./wheelhouse/)" >> "${GITHUB_OUTPUT}"
shell: bash -eEuxo pipefail {0}

- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ steps.built-artifact-lookup.outputs.artifact_name }}
path: dist/${{ steps.built-artifact-lookup.outputs.artifact_name }}
path: wheelhouse/${{ steps.built-artifact-lookup.outputs.artifact_name }}
if-no-files-found: error
if: ${{ env.skip_artifact_upload != 'true' }}

Expand Down Expand Up @@ -404,40 +397,33 @@ jobs:
# built-in virtualenv/pip are pinned to busted versions that fail on newer Pythons

- name: build wheel prereqs
run: |
set -eux
python3 -m pip install --user --upgrade "${{ matrix.cibw_version || 'cibuildwheel' }}"
brew uninstall --ignore-dependencies libffi 2>&1 || true
run: brew uninstall --ignore-dependencies libffi 2>&1 || true
shell: bash -eux {0}

- name: build/test wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: ${{ matrix.spec }}
CIBW_PRERELEASE_PYTHONS: 'True'
CIBW_TEST_REQUIRES: pytest setuptools
CIBW_TEST_COMMAND: pip install pip --upgrade; cd {project}; PYTHONUNBUFFERED=1 pytest
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.deployment_target || '10.9' }}
SDKROOT: ${{ matrix.sdkroot || 'macosx' }}
run: |
set -eux
mkdir cffi
tar zxf ${{ steps.fetch_sdist.outputs.download-path }}/cffi*.tar.gz/cffi*.tar.gz --strip-components=1 -C cffi
python3 -m cibuildwheel --output-dir dist cffi
shell: bash
with:
package-dir: >-
${{ steps.fetch_sdist.outputs.download-path
}}/${{ needs.python_sdist.outputs.artifact_name }}
- name: determine built wheel filename
id: built-artifact-lookup
run: echo "artifact_name=$(ls ./dist/)" >> "${GITHUB_OUTPUT}"
run: echo "artifact_name=$(ls ./wheelhouse/)" >> "${GITHUB_OUTPUT}"
shell: bash -eEuxo pipefail {0}

- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ steps.built-artifact-lookup.outputs.artifact_name }}
path: dist/${{ steps.built-artifact-lookup.outputs.artifact_name }}
path: wheelhouse/${{ steps.built-artifact-lookup.outputs.artifact_name }}
if-no-files-found: error
if: ${{ env.skip_artifact_upload != 'true' }}

Expand Down Expand Up @@ -505,36 +491,29 @@ jobs:
name: ${{ needs.python_sdist.outputs.artifact_name }}

- name: build/test wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: ${{ matrix.spec }}
CIBW_PRERELEASE_PYTHONS: 'True'
CIBW_TEST_REQUIRES: pytest setuptools
CIBW_TEST_COMMAND: 'python -m pytest {package}/src/c'
# FIXME: /testing takes ~45min on Windows and has some failures...
# CIBW_TEST_COMMAND='python -m pytest {package}/src/c {project}/testing'
run: |
set -eux
mkdir cffi
tar zxf cffi*.tar.gz/cffi*.tar.gz --strip-components=1 -C cffi
python -m pip install --upgrade pip
pip install "${{ matrix.cibw_version || 'cibuildwheel'}}"
python -m cibuildwheel --output-dir dist cffi
shell: bash
with:
package-dir: >-
${{ steps.fetch_sdist.outputs.download-path
}}/${{ needs.python_sdist.outputs.artifact_name }}
- name: determine built wheel filename
id: built-artifact-lookup
run: echo "artifact_name=$(ls ./dist/)" >> "${GITHUB_OUTPUT}"
run: echo "artifact_name=$(ls ./wheelhouse/)" >> "${GITHUB_OUTPUT}"
shell: bash -eEuxo pipefail {0}

- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ steps.built-artifact-lookup.outputs.artifact_name }}
path: dist/${{ steps.built-artifact-lookup.outputs.artifact_name }}
path: wheelhouse/${{ steps.built-artifact-lookup.outputs.artifact_name }}
if-no-files-found: error
if: ${{ env.skip_artifact_upload != 'true' }}

Expand Down

0 comments on commit 2eda2d1

Please sign in to comment.