mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/ Done on the 2027 branch since the force change to Node 24 should (tm) happen after the last 2026 release. And in case it breaks something and we do need to backport to 2026, the release timeline on 2027 is not as strict
126 lines
4.3 KiB
YAML
126 lines
4.3 KiB
YAML
name: Lint and Format
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches-ignore:
|
|
- main
|
|
|
|
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
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Fetch all history and metadata
|
|
run: |
|
|
git checkout -b pr
|
|
git branch -f 2027 origin/2027
|
|
- name: Set up Python 3.12
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version: '3.12'
|
|
- name: Install wpiformat
|
|
run: |
|
|
python -m venv ${{ runner.temp }}/wpiformat
|
|
${{ runner.temp }}/wpiformat/bin/pip3 install wpiformat==2025.79
|
|
- name: Run
|
|
run: ${{ runner.temp }}/wpiformat/bin/wpiformat -default-branch 2027
|
|
- 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@v6
|
|
with:
|
|
name: wpiformat fixes
|
|
path: wpiformat-fixes.patch
|
|
if: ${{ failure() }}
|
|
- name: Write to job summary
|
|
run: |
|
|
echo '```diff' >> $GITHUB_STEP_SUMMARY
|
|
cat wpiformat-fixes.patch >> $GITHUB_STEP_SUMMARY
|
|
echo '' >> $GITHUB_STEP_SUMMARY
|
|
echo '```' >> $GITHUB_STEP_SUMMARY
|
|
if: ${{ failure() }}
|
|
|
|
tidy:
|
|
name: "clang-tidy"
|
|
runs-on: ubuntu-24.04
|
|
needs: [validation]
|
|
container: wpilib/ubuntu-base:24.04
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Fetch all history and metadata
|
|
run: |
|
|
git config --global --add safe.directory /__w/allwpilib/allwpilib
|
|
git checkout -b pr
|
|
git branch -f 2027 origin/2027
|
|
- name: Set up Python 3.12
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version: '3.12'
|
|
- name: Install wpiformat
|
|
run: |
|
|
python -m venv ${{ runner.temp }}/wpiformat
|
|
${{ runner.temp }}/wpiformat/bin/pip3 install wpiformat==2025.79
|
|
- name: Create compile_commands.json
|
|
run: |
|
|
./gradlew generateCompileCommands -Ptoolchain-optional-roboRio
|
|
./.github/workflows/fix_compile_commands.py build/TargetedCompileCommands/linuxx86-64release/compile_commands.json
|
|
./.github/workflows/fix_compile_commands.py build/TargetedCompileCommands/linuxx86-64debug/compile_commands.json
|
|
- name: List changed files
|
|
run: ${{ runner.temp }}/wpiformat/bin/wpiformat -default-branch 2027 -list-changed-files
|
|
- name: Run clang-tidy release
|
|
run: ${{ runner.temp }}/wpiformat/bin/wpiformat -default-branch 2027 -no-format -tidy-changed -compile-commands=build/TargetedCompileCommands/linuxx86-64release
|
|
- name: Run clang-tidy debug
|
|
run: ${{ runner.temp }}/wpiformat/bin/wpiformat -default-branch 2027 -no-format -tidy-changed -compile-commands=build/TargetedCompileCommands/linuxx86-64debug
|
|
javaformat:
|
|
name: "Java format"
|
|
runs-on: ubuntu-24.04
|
|
needs: [validation]
|
|
container: wpilib/systemcore-cross-ubuntu:2027-24.04
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Fetch all history and metadata
|
|
run: |
|
|
git config --global --add safe.directory /__w/allwpilib/allwpilib
|
|
git checkout -b pr
|
|
git branch -f 2027 origin/2027
|
|
- name: Run Java format
|
|
run: ./gradlew javaFormat spotbugsMain spotbugsTest spotbugsDev
|
|
- name: Check output
|
|
run: git --no-pager diff --exit-code HEAD
|
|
- name: Generate diff
|
|
run: git diff HEAD > javaformat-fixes.patch
|
|
if: ${{ failure() }}
|
|
- uses: actions/upload-artifact@v6
|
|
with:
|
|
name: javaformat fixes
|
|
path: javaformat-fixes.patch
|
|
if: ${{ failure() }}
|
|
- name: Write to job summary
|
|
run: |
|
|
echo '```diff' >> $GITHUB_STEP_SUMMARY
|
|
cat javaformat-fixes.patch >> $GITHUB_STEP_SUMMARY
|
|
echo '' >> $GITHUB_STEP_SUMMARY
|
|
echo '```' >> $GITHUB_STEP_SUMMARY
|
|
if: ${{ failure() }}
|