Skip to content

Commit

Permalink
🧪📦 Pass sdist to cibuildwheel @ GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
webknjaz committed Nov 27, 2023
1 parent f86fcd7 commit 299e9f5
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 12 deletions.
36 changes: 29 additions & 7 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ jobs:
- pre-setup
runs-on: ubuntu-latest
timeout-minutes: 1
outputs:
sdist-filename: >-
${{ steps.dist-filenames-detection.outputs.sdist-filename }}
wheel-filename: >-
${{ steps.dist-filenames-detection.outputs.wheel-filename }}
steps:
- name: Checkout project
uses: actions/checkout@v4
Expand All @@ -78,17 +83,33 @@ jobs:
env:
PIP_CONSTRAINT: requirements/cython.txt
run: python -Im build --config-setting=pure-python=true
- name: Determine actual created filenames
id: dist-filenames-detection
run: >
echo -n sdist-filename= >> "${GITHUB_OUTPUT}"
basename $(ls -1 dist/${{ needs.pre-setup.outputs.sdist-name }})
>> "${GITHUB_OUTPUT}"
echo -n wheel-filename= >> "${GITHUB_OUTPUT}"
basename $(ls -1 dist/${{ needs.pre-setup.outputs.wheel-name }})
>> "${GITHUB_OUTPUT}"
- name: Upload built artifacts for testing
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: ${{ needs.pre-setup.outputs.dists-artifact-name }}
# NOTE: Exact expected file names are specified here
# NOTE: as a safety measure — if anything weird ends
# NOTE: up being in this dir or not all dists will be
# NOTE: produced, this will fail the workflow.
path: |
dist/${{ needs.pre-setup.outputs.sdist-name }}
dist/${{ needs.pre-setup.outputs.wheel-name }}
dist/${{ steps.dist-filenames-detection.outputs.sdist-filename }}
dist/${{ steps.dist-filenames-detection.outputs.wheel-filename }}
retention-days: 15

lint:
Expand All @@ -107,7 +128,7 @@ jobs:
uses: ./.github/workflows/reusable-build-wheel.yml
with:
os: ${{ matrix.os }}
source-tarball-name: ${{ needs.pre-setup.outputs.sdist-name }}
source-tarball-name: ${{ needs.build-sdist.outputs.sdist-filename }}
dists-artifact-name: ${{ needs.pre-setup.outputs.dists-artifact-name }}
cython-tracing: >- # Cython line tracing for coverage collection
${{
Expand All @@ -122,6 +143,7 @@ jobs:
test:
name: Test
needs:
- build-sdist # transitive, for accessing settings
- build-wheels-for-tested-arches
- pre-setup # transitive, for accessing settings
strategy:
Expand Down Expand Up @@ -152,7 +174,7 @@ jobs:
- name: Retrieve the project source from an sdist inside the GHA artifact
uses: re-actors/checkout-python-sdist@release/v1
with:
source-tarball-name: ${{ needs.pre-setup.outputs.sdist-name }}
source-tarball-name: ${{ needs.build-sdist.outputs.sdist-filename }}
workflow-artifact-name: >-
${{ needs.pre-setup.outputs.dists-artifact-name }}
- name: Download distributions
Expand Down Expand Up @@ -324,7 +346,7 @@ jobs:
uses: ./.github/workflows/reusable-build-wheel.yml
with:
qemu: ${{ matrix.qemu }}
source-tarball-name: ${{ needs.pre-setup.outputs.sdist-name }}
source-tarball-name: ${{ needs.build-sdist.outputs.sdist-filename }}
dists-artifact-name: ${{ needs.pre-setup.outputs.dists-artifact-name }}

deploy:
Expand All @@ -349,7 +371,7 @@ jobs:
- name: Retrieve the project source from an sdist inside the GHA artifact
uses: re-actors/checkout-python-sdist@release/v1
with:
source-tarball-name: ${{ needs.pre-setup.outputs.sdist-name }}
source-tarball-name: ${{ needs.build-sdist.outputs.sdist-filename }}
workflow-artifact-name: >-
${{ needs.pre-setup.outputs.dists-artifact-name }}
Expand Down Expand Up @@ -381,7 +403,7 @@ jobs:
uses: sigstore/gh-action-sigstore-python@v2.1.0
with:
inputs: >-
./dist/${{ needs.pre-setup.outputs.sdist-name }}
./dist/${{ needs.build-sdist.outputs.sdist-filename }}
./dist/*.whl
- name: Upload artifact signatures to GitHub Release
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/reusable-build-wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ jobs:
# Ref: https://github.com/python-jsonschema/check-jsonschema/issues/354
timeout-minutes: 60 # FIXME: ${{ inputs.qemu && '60' || '20' }}
steps:
- name: Retrieve the project source from an sdist inside the GHA artifact
uses: re-actors/checkout-python-sdist@release/v1
- name: Download distributions
uses: actions/download-artifact@v3
with:
source-tarball-name: ${{ inputs.source-tarball-name }}
workflow-artifact-name: ${{ inputs.dists-artifact-name }}
name: ${{ inputs.dists-artifact-name }}
path: .tmp-dists

- name: Set up QEMU
if: inputs.qemu
Expand All @@ -72,6 +72,8 @@ jobs:
CIBW_CONFIG_SETTINGS: >- # Cython line tracing for coverage collection
pure-python=false
with-cython-tracing=${{ inputs.cython-tracing }}
with:
package-dir: .tmp-dists/${{ inputs.source-tarball-name }}

- name: Upload built artifacts for testing and publishing
uses: actions/upload-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ skip = "pp*"
COLOR = "yes"
FORCE_COLOR = "1"
MYPY_FORCE_COLOR = "1"
PIP_CONSTRAINT = "requirements/cython.txt"
PIP_CONSTRAINT = "{project}/requirements/cython.txt"
PRE_COMMIT_COLOR = "always"
PY_COLORS = "1"

Expand Down

0 comments on commit 299e9f5

Please sign in to comment.