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
113 lines
3.3 KiB
YAML
113 lines
3.3 KiB
YAML
name: Lint and Format
|
|
|
|
on:
|
|
# Run on pushes to main and pushed tags, and on pull requests against main, but ignore the docs folder
|
|
push:
|
|
pull_request:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
validation:
|
|
name: "Validation"
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: gradle/actions/wrapper-validation@v5
|
|
wpiformat:
|
|
name: "wpiformat"
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- name: Fetch all history and metadata
|
|
run: |
|
|
git fetch --prune --unshallow
|
|
git checkout -b pr
|
|
git branch -f main origin/main
|
|
- name: Set up Python 3.12
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version: 3.12
|
|
- name: Install wpiformat
|
|
run: pip3 install wpiformat==2025.79
|
|
- name: Run
|
|
run: wpiformat
|
|
- name: Check output
|
|
run: |
|
|
set +e
|
|
git --no-pager diff --exit-code HEAD
|
|
exit_code=$?
|
|
if test "$exit_code" -ne "0"; then
|
|
echo "::error ::Linting failed. See https://docs.photonvision.org/en/latest/docs/contributing/linting.html"
|
|
exit $exit_code
|
|
fi
|
|
- name: Generate diff
|
|
run: git diff HEAD > wpiformat-fixes.patch
|
|
if: ${{ failure() }}
|
|
- uses: actions/upload-artifact@v6
|
|
with:
|
|
name: wpiformat fixes
|
|
path: wpiformat-fixes.patch
|
|
if: ${{ failure() }}
|
|
javaformat:
|
|
name: "Java Formatting"
|
|
needs: [validation]
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: actions/setup-java@v5
|
|
with:
|
|
java-version: 17
|
|
distribution: temurin
|
|
- run: |
|
|
set +e
|
|
./gradlew spotlessCheck
|
|
exit_code=$?
|
|
if test "$exit_code" -ne "0"; then
|
|
echo "::error ::Linting failed. See https://docs.photonvision.org/en/latest/docs/contributing/linting.html"
|
|
exit $exit_code
|
|
fi
|
|
name: Run spotless
|
|
client-lint-format:
|
|
name: "PhotonClient Lint and Formatting"
|
|
defaults:
|
|
run:
|
|
working-directory: photon-client
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
cache-dependency-path: photon-client/pnpm-lock.yaml
|
|
- name: Install Dependencies
|
|
run: pnpm i --frozen-lockfile
|
|
- name: Check Linting
|
|
run: |
|
|
set +e
|
|
pnpm run lint-ci
|
|
exit_code=$?
|
|
if test "$exit_code" -ne "0"; then
|
|
echo "::error ::Linting failed. See https://docs.photonvision.org/en/latest/docs/contributing/linting.html"
|
|
exit $exit_code
|
|
fi
|
|
- name: Check Formatting
|
|
run: |
|
|
set +e
|
|
pnpm run format-ci
|
|
exit_code=$?
|
|
if test "$exit_code" -ne "0"; then
|
|
echo "::error ::Linting failed. See https://docs.photonvision.org/en/latest/docs/contributing/linting.html"
|
|
exit $exit_code
|
|
fi
|