Upgrade cargo and node dependencies (#929) #2536
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint and Format | |
on: [pull_request, push] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
format: | |
name: "Format" | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Fetch all history and metadata | |
run: | | |
git checkout -b pr | |
git branch -f main origin/main | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: "temurin" | |
java-version: 21 | |
- name: Install Linux dependencies | |
run: | | |
sudo apt-get update -q | |
sudo apt-get install -y \ | |
build-essential \ | |
curl \ | |
file \ | |
libayatana-appindicator3-dev \ | |
libgtk-3-dev \ | |
librsvg2-dev \ | |
libssl-dev \ | |
libwebkit2gtk-4.0-dev \ | |
wget | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
cache: "pnpm" | |
- run: pnpm install [email protected] | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- run: pip3 install wpiformat==2024.45 | |
- run: pnpm run fmt | |
- run: cargo clippy -- -D warnings | |
- 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() }} | |
- 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() }} | |
tsc: | |
name: "TypeScript compiler" | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
cache: "pnpm" | |
- run: pnpm install | |
- run: npx tsc | |
choreolib-tidy: | |
name: "ChoreoLib clang-tidy" | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Fetch all history and metadata | |
run: | | |
git config --global --add safe.directory /__w/Choreo/Choreo | |
git checkout -b pr | |
git branch -f main origin/main | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- run: pip3 install wpiformat==2024.45 | |
- name: Create compile_commands.json | |
working-directory: choreolib | |
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 | |
working-directory: choreolib | |
run: wpiformat -f . -list-changed-files | |
- name: Run clang-tidy debug | |
working-directory: choreolib | |
run: wpiformat -f . -no-format -tidy-all -compile-commands=build/TargetedCompileCommands/linuxx86-64debug -vv | |
- name: Run clang-tidy release | |
working-directory: choreolib | |
run: wpiformat -f . -no-format -tidy-all -compile-commands=build/TargetedCompileCommands/linuxx86-64release -vv | |
trajoptlib-tidy: | |
name: "TrajoptLib clang-tidy" | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Fetch all history and metadata | |
run: | | |
git config --global --add safe.directory /__w/Choreo/Choreo | |
git checkout -b pr | |
git branch -f main origin/main | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Install LLVM 18 | |
run: | | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 18 all | |
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 200 | |
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 200 | |
echo "CC=clang" >> $GITHUB_ENV | |
echo "CXX=clang++" >> $GITHUB_ENV | |
echo "CXXFLAGS=-stdlib=libc++" >> $GITHUB_ENV | |
- run: pip3 install wpiformat==2024.45 | |
- name: Create compile_commands.json | |
run: cmake -B build -S . -DCMAKE_EXPORT_COMPILE_COMMANDS=YES | |
working-directory: trajoptlib | |
- name: List changed files | |
run: wpiformat -f . -list-changed-files | |
working-directory: trajoptlib | |
- name: Run clang-tidy | |
run: wpiformat -f . -no-format -tidy-all -compile-commands=build -tidy-extra-args std=c++23 -vv | |
working-directory: trajoptlib |