mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
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:
84
.github/workflows/python.yml
vendored
84
.github/workflows/python.yml
vendored
@@ -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
|
||||
|
||||
@@ -22,4 +22,4 @@ export PYTHONPATH=$PHOTONLIBPY_ROOT
|
||||
cd $1
|
||||
|
||||
# Run the example
|
||||
robotpy sim
|
||||
python3 robot.py sim
|
||||
|
||||
Reference in New Issue
Block a user