Skip to content

Commit

Permalink
Try build clang-tidy plugin with LLVM 16 on Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
BrettDong committed Mar 30, 2023
1 parent 13ff27b commit 5e6e8e2
Showing 1 changed file with 39 additions and 38 deletions.
77 changes: 39 additions & 38 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Clang-tidy (clang-12, tiles)
name: LLVM 16 clang-tidy

on:
push:
Expand Down Expand Up @@ -31,47 +31,48 @@ jobs:
needs: skip-duplicates
if: ${{ needs.skip-duplicates.outputs.should_skip != 'true' }}

runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
env:
CMAKE: 1
CLANG: clang++-12
COMPILER: clang++-12
CATA_CLANG_TIDY: plugin
TILES: 1
CLANG: clang++-16
CLANG_DIR: '/usr/lib/llvm-16/lib/cmake/clang'
COMPILER: clang++-16
LLVM_DIR: '/usr/lib/llvm-16/lib/cmake/llvm'
SOUND: 1
TILES: 1
steps:
- name: install LLVM 16
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main"
sudo apt update
sudo apt install llvm-16 llvm-16-dev llvm-16-tools clang-16 clang-tidy-16 clang-tools-16 libclang-16-dev
- name: install dependencies
run: |
sudo apt install python3-pip libncursesw5-dev libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev \
libsdl2-mixer-dev libpulse-dev ccache gettext jq ninja-build cmake
pip3 install --user lit
- name: ensure clang-tidy and FileCheck commands point to LLVM 16
run: |
mkdir ~/llvm-command-override
ln -s /usr/bin/clang-tidy-16 ~/llvm-command-override/clang-tidy
ln -s /usr/bin/FileCheck-16 ~/llvm-command-override/FileCheck
echo "$HOME/llvm-command-override" >> $GITHUB_PATH
- name: checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: install dependencies
- name: build clang-tidy plugin
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-12 main"
sudo apt-get update
sudo apt-get install libncursesw5-dev clang-12 libclang-12-dev llvm-12-dev llvm-12-tools \
libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev libpulse-dev ccache \
gettext jq
- name: prepare
run: bash ./build-scripts/requirements.sh
- name: determine changed files
if: ${{ github.event_name == 'pull_request' }}
uses: actions/github-script@v5
with:
script: |
var fs = require('fs');
const response = await github.paginate(github.rest.pulls.listFiles,
{
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
}
);
const files = response.map(x => x.filename);
for (const path of files) {
console.log(path);
}
fs.writeFileSync("files_changed", files.join('\n'));
- uses: ammaraskar/gcc-problem-matcher@master
- name: run clang-tidy
run: bash ./build-scripts/clang-tidy.sh
cmake -B build -D CMAKE_BUILD_TYPE=Release \
-D CMAKE_CXX_COMPILER=${COMPILER} \
-D CMAKE_EXPORT_COMPILE_COMMANDS=ON \
-D CATA_CLANG_TIDY_PLUGIN=ON \
-D LLVM_DIR="${LLVM_DIR}" \
-D Clang_DIR="${CLANG_DIR}" \
-D TILES=${TILES} \
-D SOUND=${SOUND} \
-G Ninja
ninja -C build libCataAnalyzerPlugin.so
- name: test clang-tidy plugin
run: |
lit -v build/tools/clang-tidy-plugin/test

0 comments on commit 5e6e8e2

Please sign in to comment.