mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
## Description This fixes up and renables the python examples builds. Main fixes - Test shell script just straight up didn't do what it was intended to do - Replace analog imus (and half refactored sims) with OnboardIMU - Fixes swerve velocities function signature - "regenerates" the default robotpy test ## 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_, including events that led to this PR - [ ] 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 all settings going back to the previous seasons's last release (seasons end after champs ends) - [ ] 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 - [ ] If this PR adds a dependency, the license has been checked for compatibility and steps taken to follow it --------- Co-authored-by: Matt Morley <matthew.morley.ca@gmail.com> Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
147 lines
3.4 KiB
YAML
147 lines
3.4 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-py:
|
|
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.14
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install setuptools wheel
|
|
|
|
- name: Build wheel
|
|
working-directory: ./photon-lib/py
|
|
run: python setup.py sdist bdist_wheel
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: dist
|
|
path: ./photon-lib/py/dist/
|
|
|
|
test-py:
|
|
needs: build-py
|
|
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.14
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install pytest mypy
|
|
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
name: dist
|
|
path: dist/
|
|
|
|
- name: Install package
|
|
shell: bash
|
|
run: pip install --no-cache-dir dist/*.whl
|
|
|
|
- name: Run Unit Tests
|
|
shell: bash
|
|
run: pytest --import-mode=importlib photon-lib/py/test/
|
|
|
|
- name: Run mypy type checking
|
|
run: mypy --show-column-numbers --config-file photon-lib/py/pyproject.toml photon-lib
|
|
|
|
build-python-examples:
|
|
needs: build-py
|
|
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.14
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
python -m pip install mypy
|
|
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
name: dist
|
|
path: ./photon-lib/py/dist/
|
|
|
|
- name: Install PhotonLibPy package
|
|
working-directory: ./photon-lib/py
|
|
shell: bash
|
|
run: |
|
|
pip install --no-cache-dir dist/*.whl
|
|
|
|
- name: Build Python examples
|
|
working-directory: photonlib-python-examples
|
|
shell: bash
|
|
run: |
|
|
for folder in */;
|
|
do
|
|
echo $folder
|
|
./test.sh $folder
|
|
done
|
|
|
|
deploy:
|
|
needs: [test-py, build-python-examples]
|
|
runs-on: ubuntu-24.04
|
|
# Only upload on tags
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
|
|
steps:
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
name: dist
|
|
path: dist/
|
|
|
|
- name: Publish package distributions to PyPI
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
with:
|
|
packages-dir: ./dist/
|
|
|
|
permissions:
|
|
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|