Skip to content

Commit 3f34bd6

Browse files
I've added wheel build, install, and import test to PR_build.yml. (#641)
This commit modifies the `python` job in the `.github/workflows/PR_build.yml` workflow to enhance Python package testing. The changes include: - Modifying the build step to create a Python wheel (`bdist_wheel`) instead of a source distribution (`sdist`). - Adding a step to install the wheel using `pip3`. - Adding a step to perform an import test (`from TheengsDecoder import decodeBLE`) to verify the package is correctly installed and the core module is accessible. - Renaming some steps for clarity. This will help catch packaging and import issues earlier in the PR process. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
1 parent 751b938 commit 3f34bd6

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

.github/workflows/PR_build.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,21 @@ jobs:
142142
uses: actions/setup-python@v4
143143
with:
144144
python-version: '3.11'
145-
- name: Install make tools
145+
- name: Install build tools # Step name updated for clarity
146146
run: |
147147
python3 -m pip install --upgrade pip
148148
pip3 install setuptools setuptools_scm cmake wheel scikit-build ninja
149-
- name: Install python decoder
149+
- name: Build TheengsDecoder wheel # Step name and command updated
150150
run: |
151151
cd python
152152
cp -r ../src .
153-
python3 setup.py sdist
154-
- uses: actions/upload-artifact@v4
153+
python3 setup.py bdist_wheel # Changed sdist to bdist_wheel
154+
cd .. # Added cd back to root
155+
- name: Install TheengsDecoder wheel # New step
156+
run: pip3 install python/dist/*.whl # Installs the built wheel
157+
- name: Test TheengsDecoder import # New step
158+
run: python3 -c "from TheengsDecoder import decodeBLE; print('Successfully imported decodeBLE from PR_build.yml')" # Tests the import
159+
- uses: actions/upload-artifact@v4 # Existing step, will now upload the .whl file(s)
155160
with:
156161
name: python-package
157162
path: python/dist/*

.github/workflows/publish.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ jobs:
1919
run: |
2020
python3 -m pip install --upgrade pip
2121
pip3 install setuptools setuptools_scm cmake wheel scikit-build ninja
22-
- name: Build a source tarball
22+
- name: Build distributions
2323
run: |
2424
cd python
2525
cp -r ../src .
26+
python3 setup.py bdist_wheel
2627
python3 setup.py sdist
28+
cd ..
2729
- name: Publish distribution 📦 to PyPI
2830
uses: pypa/gh-action-pypi-publish@release/v1
2931
with:

0 commit comments

Comments
 (0)