mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
86 lines
2.3 KiB
YAML
86 lines
2.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@v4
|
|
- uses: gradle/actions/wrapper-validation@v4
|
|
wpiformat:
|
|
name: "wpiformat"
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- 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.8
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: 3.11
|
|
- name: Install wpiformat
|
|
run: pip3 install wpiformat==2025.48
|
|
- name: Run
|
|
run: wpiformat
|
|
- name: Check output
|
|
run: git --no-pager diff --exit-code HEAD
|
|
- name: Generate diff
|
|
run: git diff HEAD > wpiformat-fixes.patch
|
|
if: ${{ failure() }}
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: wpiformat fixes
|
|
path: wpiformat-fixes.patch
|
|
if: ${{ failure() }}
|
|
javaformat:
|
|
name: "Java Formatting"
|
|
needs: [validation]
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: actions/setup-java@v4
|
|
with:
|
|
java-version: 17
|
|
distribution: temurin
|
|
- run: ./gradlew spotlessCheck
|
|
name: Run spotless
|
|
|
|
client-lint-format:
|
|
name: "PhotonClient Lint and Formatting"
|
|
defaults:
|
|
run:
|
|
working-directory: photon-client
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
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: pnpm run lint-ci
|
|
- name: Check Formatting
|
|
run: pnpm run format-ci
|