Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Enable importing the built package during the package-build workflow #93

Merged
merged 5 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions .github/workflows/_reusable-package-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ on:
workflow_call:
inputs:
package-name:
description: The name of the package to build and install.
description: The name of the package to build, install, and import (this must
be the package's importable name).
required: true
type: string
python-versions-array:
Expand Down Expand Up @@ -66,13 +67,23 @@ jobs:
- name: Test installing wheel
shell: bash
run: pip install dist/*.whl
- name: Test importing ${{ env.PACKAGE_NAME }}
run: python -c "import ${{ env.PACKAGE_NAME }}"
- name: Uninstall wheel
run: pip uninstall --yes "${{ env.PACKAGE_NAME }}"
shell: bash
run: |
pip uninstall -y ${{ env.PACKAGE_NAME }}
pip freeze | xargs pip uninstall -y
- name: Test installing tarball
shell: bash
run: pip install dist/*.tar.gz
- name: Test importing ${{ env.PACKAGE_NAME }}
run: python -c "import ${{ env.PACKAGE_NAME }}"
- name: Uninstall tarball
run: pip uninstall --yes "${{ env.PACKAGE_NAME }}"
shell: bash
run: |
pip uninstall -y ${{ env.PACKAGE_NAME }}
pip freeze | xargs pip uninstall -y
# Check that all jobs passed
check-build-and-install-passed:
if: ${{ !cancelled() }}
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ Valid subsections within a version are:

Things to be included in the next release go here.

### Added

- Updated the `_reusable-package-build.yml` file to include a step that will test importing the built package to check for any missing dependencies.
- IMPORTANT: This workflow now requires the `package-name` input be the python-importable name of the package to be built, e.g. `python -c "import package_name"`.

### Changed

- Bumped dependency versions.
Expand Down
10 changes: 5 additions & 5 deletions workflows/package-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ and operating system specified.

## Inputs

| Input variable | Necessity | Description | Default |
| ------------------------- | --------- | ----------------------------------------------------------------------------------------- | ---------------------------------- |
| `package-name` | required | The name of the package to build and install. | |
| `python-versions-array` | required | A valid JSON array of Python versions to validate the package can be installed with. | |
| `operating-systems-array` | optional | A valid JSON array of operating system names to validate the package can be installed on. | `'["ubuntu", "windows", "macos"]'` |
| Input variable | Necessity | Description | Default |
| ------------------------- | --------- | --------------------------------------------------------------------------------------------------- | ---------------------------------- |
| `package-name` | required | The name of the package to build, install, and import (this must be the package's importable name). | |
| `python-versions-array` | required | A valid JSON array of Python versions to validate the package can be installed with. | |
| `operating-systems-array` | optional | A valid JSON array of operating system names to validate the package can be installed on. | `'["ubuntu", "windows", "macos"]'` |

## Example

Expand Down
Loading