mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
When downloading a patch to fix linting errors, it's annoying to have to unzip it, particularly when it's a single file. This PR updates the `upload-artifact` action to v7, which allows for uploading an artifact without zipping it. It also sets archive to false for all patches generated by linting.
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==2026.57
|
|
- 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@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 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==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 -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@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() }}
|