Build Python examples during CI run (#2273)

Adds `photonlib-python-examples` to CI build run to make sure that
Python builds cleanly against that PR/commit.
This commit is contained in:
Charlotte Wilson
2026-01-07 16:14:39 -05:00
committed by GitHub
parent 3f9e2a9fa8
commit 6ca7354542
2 changed files with 77 additions and 9 deletions

View File

@@ -12,7 +12,7 @@ concurrency:
cancel-in-progress: true
jobs:
buildAndDeploy:
build-and-deploy:
runs-on: ubuntu-24.04
steps:
@@ -33,8 +33,7 @@ jobs:
- name: Build wheel
working-directory: ./photon-lib/py
run: |
python setup.py sdist bdist_wheel
run: python setup.py sdist bdist_wheel
- name: Run Unit Tests
working-directory: ./photon-lib/py
@@ -43,11 +42,7 @@ jobs:
pytest
- name: Run mypy type checking
uses: liskin/gh-problem-matcher-wrap@v3
with:
linters: mypy
run: |
mypy --show-column-numbers --config-file photon-lib/py/pyproject.toml photon-lib
run: mypy --show-column-numbers --config-file photon-lib/py/pyproject.toml photon-lib
- name: Upload artifacts
uses: actions/upload-artifact@master
@@ -64,3 +59,76 @@ jobs:
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
build-python-examples:
strategy:
matrix:
os: [ubuntu-24.04, windows-2022, macos-14]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: 3.12
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel pytest mypy numpy wpilib pyntcore opencv-python robotpy==2026.1.1b1 pyfrc
- name: Build wheel
working-directory: ./photon-lib/py
run: python setup.py sdist bdist_wheel
- name: Run Unit Tests (Unix)
working-directory: ./photon-lib/py
if: runner.os != 'Windows'
run: |
pip install --no-cache-dir dist/*.whl
pytest
- name: Run Unit Tests (Windows)
working-directory: ./photon-lib/py
if: runner.os == 'Windows'
shell: cmd
run: |
for %%f in (dist/*.whl) do (
echo installing dist/%%f
pip install --no-cache-dir dist/%%f
)
pytest
- name: Build and configure PhotonLibPy (bash)
working-directory: ./photon-lib/py
if: runner.os != 'Windows'
run: |
./buildAndTest.sh
./enableUsingDevBuilds.sh
- name: Build and configure PhotonLibPy (pwsh)
working-directory: ./photon-lib/py
if: runner.os == 'Windows'
run: |
./buildandTest.bat
./enableUsingDevBuilds.bat
- name: Run mypy type checking
run: mypy --show-column-numbers --config-file photon-lib/py/pyproject.toml photon-lib
- name: Build Python examples
working-directory: photonlib-python-examples
shell: bash
run: |
for folder in */;
do
echo $folder
./run.sh $folder
done

View File

@@ -22,4 +22,4 @@ export PYTHONPATH=$PHOTONLIBPY_ROOT
cd $1
# Run the example
robotpy sim
python3 robot.py sim