mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
## Description CI will now run whenever a branch is pushed or a PR is opened. Fixes 2027 behaviour and allows running CI on forks ## 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 v2024.3.1 - [ ] 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 Signed-off-by: Jade Turner <spacey-sooty@proton.me>
69 lines
1.8 KiB
YAML
69 lines
1.8 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:
|
|
buildAndDeploy:
|
|
runs-on: ubuntu-22.04
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: 3.11
|
|
|
|
- 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
|
|
|
|
# Disable due to robotpy issue. See
|
|
# https://github.com/PhotonVision/photonvision/issues/1968
|
|
# - 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
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@master
|
|
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
|