Add ability to build with clang #2645
Workflow file for this run
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: Codestyle | |
on: | |
pull_request: | |
paths-ignore: | |
- docs/** | |
- README.md | |
- README_PYPI.md | |
- cli/** | |
- examples/** | |
- images/** | |
- .gitignore | |
- COPYING | |
- build.* | |
- pull_datasets.sh | |
- pyproject.toml | |
jobs: | |
clang-format-check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Pull clang-format | |
run: | | |
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main' | |
wget https://apt.llvm.org/llvm-snapshot.gpg.key | |
sudo apt-key add llvm-snapshot.gpg.key | |
sudo apt-get update | |
sudo apt-get install -y clang-format-18 | |
- name: Check formatting | |
run: | | |
set e | |
formatterOutput=$( git diff -U0 origin/$GITHUB_BASE_REF...HEAD | clang-format-diff-18 -p 1) | |
if [ "$formatterOutput" != "" ] | |
then | |
echo ":x: :x: :x:" >> $GITHUB_STEP_SUMMARY | |
echo "\`\`\`c " >> $GITHUB_STEP_SUMMARY | |
echo "$formatterOutput" >> $GITHUB_STEP_SUMMARY | |
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY | |
echo "$formatterOutput" | |
exit 1 | |
fi | |
echo "$formatterOutput" | |
echo "### $formatterOutput :heavy_check_mark:" >> $GITHUB_STEP_SUMMARY | |
clang-tidy-check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download libraries | |
uses: ./.github/composite-actions/download-libraries | |
with: | |
download-pybind: true | |
- name: Generate compile_commands.json | |
run: | | |
cmake -DCMAKE_C_COMPILER=gcc-10 \ | |
-DCMAKE_CXX_COMPILER=g -10 \ | |
-DCMAKE_BUILD_TYPE=Debug \ | |
-Dgtest_disable_pthreads=OFF \ | |
-DASAN=OFF \ | |
-DPYTHON=COMPILE \ | |
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | |
. -B ${{github.workspace}}/build | |
- uses: ZedThree/[email protected] | |
id: review | |
with: | |
apt_packages: libboost-dev | |
build_dir: build | |
config_file: '.clang-tidy' | |
split_workflow: true | |
- uses: ZedThree/clang-tidy-review/[email protected] | |
- name: Fail the check if clang-tidy reported issues | |
if: steps.review.outputs.total_comments > 0 | |
run: exit 1 |