mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
reviewdog/action-misspell is used on frc-docs. It has a dictionary of commonly misspelled words, so it has less false positives then other tools.
150 lines
5.1 KiB
YAML
150 lines
5.1 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 main origin/main
|
|
- 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==2026.57
|
|
- name: Run
|
|
run: ${{ runner.temp }}/wpiformat/bin/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@v7
|
|
with:
|
|
archive: false
|
|
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 main origin/main
|
|
- 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==2026.57
|
|
- 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 -list-changed-files
|
|
- name: Run clang-tidy release
|
|
run: ${{ runner.temp }}/wpiformat/bin/wpiformat -no-format -tidy-changed -compile-commands=build/TargetedCompileCommands/linuxx86-64release
|
|
- name: Run clang-tidy debug
|
|
run: ${{ runner.temp }}/wpiformat/bin/wpiformat -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 main origin/main
|
|
- 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@v7
|
|
with:
|
|
archive: false
|
|
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() }}
|
|
|
|
check-spelling:
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- name: misspell
|
|
uses: reviewdog/action-misspell@v1
|
|
with:
|
|
reporter: "github-check"
|
|
fail_level: "error"
|
|
exclude: |
|
|
**/*.svg
|
|
**/thirdparty/**
|
|
**/upstream_utils/**
|
|
**/generated/**
|
|
./wpigui/src/main/native/cpp/portable-file-dialogs.*
|
|
./wpimath/src/main/native/include/wpi/units/base.hpp
|
|
./wpinet/src/main/native/linux/AvahiClient.*
|
|
./wpinet/src/main/native/cpp/http_parser.cpp
|
|
./wpinet/src/main/native/include/wpi/net/http_parser.hpp
|
|
./wpiutil/src/main/native/include/wpi/util/FastQueue.hpp
|
|
./wpiutil/src/test/native/cpp/json/**
|
|
./wpiutil/src/test/native/cpp/llvm/**
|
|
./wpiutil/src/test/native/cpp/span/**
|