Skip to content

Commit

Permalink
Add skip-wheel to build only sdists
Browse files Browse the repository at this point in the history
  • Loading branch information
hynek committed Mar 23, 2024
1 parent ab41294 commit ed2dda0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci-argon2-cffi-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@
id: baipp
with:
path: hynek/argon2-cffi-bindings
skip-wheel: 'true'
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ jobs:
### Inputs

- `path`: the location of the Python package to build (*optional*, default: `.`).
- `skip-wheel`: Whether to skip building the wheel in addition to the source distribution.
The only meaningful value is `'true'` (note the quotes – GitHub Actions only allow string inputs) and everything else is treated as falsey.
(*optional*, default: `'false'`).


### Outputs
Expand Down
26 changes: 19 additions & 7 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ inputs:
description: Where to look for the Python package to inspect.
required: false
default: .
skip-wheel:
description: Only build the source distribution.
required: false
default: 'false'
outputs:
dist:
description: The location of the built packages.
Expand Down Expand Up @@ -38,12 +42,16 @@ runs:
install -r ${{ github.action_path }}/requirements/tools.txt
shell: bash

# Build SDist, then build wheel out of it.
# Build SDist, then build wheel out of it if user didn't forbid it.
# Set 'SOURCE_DATE_EPOCH' based on the last commit for build
# reproducibility.
- run: >
SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
/tmp/baipp/bin/python -m build --outdir /tmp/baipp/dist
if [[ "${{ inputs.skip-wheel }}" == "true" ]]; then
/tmp/baipp/bin/python -m build --sdist --outdir /tmp/baipp/dist
else
/tmp/baipp/bin/python -m build --outdir /tmp/baipp/dist
fi
shell: bash
working-directory: ${{ inputs.path }}
Expand All @@ -66,6 +74,7 @@ runs:
- run: /tmp/baipp/bin/check-wheel-contents /tmp/baipp/dist/*.whl
shell: bash
working-directory: ${{ inputs.path }}
if: ${{ inputs.skip-wheel }} != 'true'

- name: Check PyPI README
shell: bash
Expand All @@ -82,17 +91,20 @@ runs:
run: |
cd /tmp/baipp/dist
mkdir -p out/sdist
mkdir -p out/wheels
/tmp/baipp/bin/python -m wheel unpack --dest out/wheels *.whl
tar xf *.tar.gz -C out/sdist
echo -e '\n<details><summary>SDist contents</summary>\n' >> $GITHUB_STEP_SUMMARY
(cd /tmp/baipp/dist/out/sdist && tree -Da --timefmt="%Y-%m-%dT%H:%M:%SZ" * | sed 's/^/ /' | tee -a $GITHUB_STEP_SUMMARY)
echo -e '\n</details>\n' >> $GITHUB_STEP_SUMMARY
echo -e '\n<details><summary>Wheel contents</summary>\n' >> $GITHUB_STEP_SUMMARY
(cd /tmp/baipp/dist/out/wheels && tree -Da --timefmt="%Y-%m-%dT%H:%M:%SZ" * | sed 's/^/ /' | tee -a $GITHUB_STEP_SUMMARY)
echo -e '\n</details>\n' >> $GITHUB_STEP_SUMMARY
if [[ ${{ inputs.skip-wheel }} != 'true' ]]; then
mkdir -p out/wheels
/tmp/baipp/bin/python -m wheel unpack --dest out/wheels *.whl
echo -e '\n<details><summary>Wheel contents</summary>\n' >> $GITHUB_STEP_SUMMARY
(cd /tmp/baipp/dist/out/wheels && tree -Da --timefmt="%Y-%m-%dT%H:%M:%SZ" * | sed 's/^/ /' | tee -a $GITHUB_STEP_SUMMARY)
echo -e '\n</details>\n' >> $GITHUB_STEP_SUMMARY
fi
echo ----- Metadata Follows -----
echo -e '\n<details><summary>Metadata</summary>\n' >> $GITHUB_STEP_SUMMARY
Expand Down

0 comments on commit ed2dda0

Please sign in to comment.