mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
## Description This bumps our actions to versions that use Node 24, instead of 20. Node 20 [enters EOL in April 2026](https://endoflife.date/nodejs). This PR also includes various cleanups that should speed up CI, and make it less complicated. This includes removing the architecture field from setup-java, as it detects the native architecture. We also upload our Gradle dependencies for charting in GitHub, this helps us keep track of what we're using, and if we need to upgrade. Finally, we bump the version of our image, to fix issues with the Rubik Pi fan among other reasons. continuation of #2194 supercedes #2276 ## Meta Merge checklist: - [x] Pull Request title is [short, imperative summary](https://cbea.ms/git-commit/) of proposed changes - [x] The description documents the _what_ and _why_ - [ ] If this PR changes behavior or adds a feature, user documentation is updated - [ ] If this PR touches photon-serde, all messages have been regenerated and hashes have not changed unexpectedly - [ ] If this PR touches configuration, this is backwards compatible with settings back to v2025.3.2 - [ ] If this PR touches pipeline settings or anything related to data exchange, the frontend typing is updated - [ ] If this PR addresses a bug, a regression test for it is added
135 lines
3.5 KiB
YAML
135 lines
3.5 KiB
YAML
name: Build and Distribute PhotonLibPy
|
|
|
|
permissions:
|
|
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-24.04
|
|
|
|
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
|
|
|
|
- name: Build wheel
|
|
working-directory: ./photon-lib/py
|
|
run: python setup.py sdist bdist_wheel
|
|
|
|
- name: Run Unit Tests
|
|
working-directory: ./photon-lib/py
|
|
run: |
|
|
pip install --no-cache-dir dist/*.whl
|
|
pytest
|
|
|
|
- name: Run mypy type checking
|
|
run: mypy --show-column-numbers --config-file photon-lib/py/pyproject.toml photon-lib
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: dist
|
|
path: ./photon-lib/py/dist/
|
|
|
|
- name: Publish package distributions to TestPyPI
|
|
# Only upload on tags
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
with:
|
|
packages-dir: ./photon-lib/py/dist/
|
|
|
|
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
|