From f996f91677cdc838665ce8210bebb358c9bb76eb Mon Sep 17 00:00:00 2001 From: puerling Date: Fri, 6 Sep 2024 17:30:24 +0200 Subject: [PATCH] pin clang-format version in CI to the same version as in pre-commit --- .github/workflows/ci.yml | 81 ++++++++++++++++++++++++++++------------ 1 file changed, 57 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d75cb0bb5..f6d7b7cba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,11 @@ jobs: fail-fast: false env: BUILD_TYPE: Release - CMAKE_FLAGS: -DSPIRIT_UI_USE_IMGUI=ON -DSPIRIT_UI_CXX_USE_QT=OFF -DSPIRIT_ENABLE_PINNING=ON -DSPIRIT_ENABLE_DEFECTS=ON + CMAKE_FLAGS: > + -DSPIRIT_UI_USE_IMGUI=ON + -DSPIRIT_UI_CXX_USE_QT=OFF + -DSPIRIT_ENABLE_PINNING=ON + -DSPIRIT_ENABLE_DEFECTS=ON SOURCES: "find core/include/ core/src/ ui-cpp/utility/ ui-cpp/ui-imgui/include/ ui-cpp/ui-imgui/src/ -iname *.hpp -o -iname *.cpp" steps: @@ -19,14 +23,18 @@ jobs: - name: ๐Ÿ“š Install required system packages run: | sudo apt-get update - sudo apt-get install xorg-dev libglu1-mesa-dev libgtk-3-dev clang-format-18 clang-tidy-18 + sudo apt-get install xorg-dev libglu1-mesa-dev libgtk-3-dev tree - uses: actions/setup-python@v4 with: python-version: '3.10' - name: ๐Ÿ“š Install python packages - run: pip install --user numpy pylint black + run: > + pip install --user numpy pylint + "black==22.10.0" + "clang-format==18.1.8" + "clang-tidy==18.1.8" - name: ๐Ÿ“ Create build folder run: cmake -E make_directory ${{runner.workspace}}/build @@ -40,8 +48,8 @@ jobs: if: always() shell: bash run: | - clang-format-18 --version - OUTPUT=$($SOURCES | xargs clang-format-18 -n 2>&1) + clang-format --version + OUTPUT=$($SOURCES | xargs clang-format -n 2>&1) if [[ $OUTPUT ]]; then echo "$OUTPUT" exit 1 @@ -51,13 +59,13 @@ jobs: if: always() shell: bash run: | - clang-tidy-18 --version + clang-tidy --version - name: ๐Ÿงช Python code formatting check shell: bash run: | - black core/python --check - black ui-python --check + git ls-files core/python/{,**/}*.py | xargs black --check + git ls-files ui-python/{,**/}*.py | xargs black --check - name: ๐Ÿงช Python code quality checks, linting shell: bash @@ -75,7 +83,12 @@ jobs: parallelisation: "openmp" env: BUILD_TYPE: Release - CMAKE_FLAGS: -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DSPIRIT_UI_USE_IMGUI=ON -DSPIRIT_UI_CXX_USE_QT=OFF -DSPIRIT_BUILD_TEST=ON + CMAKE_FLAGS: > + -DCMAKE_C_COMPILER=gcc + -DCMAKE_CXX_COMPILER=g++ + -DSPIRIT_UI_USE_IMGUI=ON + -DSPIRIT_UI_CXX_USE_QT=OFF + -DSPIRIT_BUILD_TEST=ON OMP_NUM_THREADS: 4 steps: @@ -122,11 +135,11 @@ jobs: fail-fast: false matrix: include: - - os: ubuntu-22.04 + - os: ubuntu-24.04 parallelisation: "" - - os: ubuntu-22.04 + - os: ubuntu-24.04 parallelisation: "openmp" - - os: ubuntu-22.04 + - os: ubuntu-24.04 parallelisation: "cuda" - os: macos-13 parallelisation: "" @@ -138,23 +151,26 @@ jobs: parallelisation: "openmp" env: BUILD_TYPE: Release - CMAKE_FLAGS: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DSPIRIT_UI_USE_IMGUI=ON -DSPIRIT_UI_CXX_USE_QT=OFF + CMAKE_FLAGS: > + -DCMAKE_C_COMPILER=clang + -DCMAKE_CXX_COMPILER=clang++ + -DSPIRIT_UI_USE_IMGUI=ON + -DSPIRIT_UI_CXX_USE_QT=OFF + -DSPIRIT_BUILD_TEST=ON OMP_NUM_THREADS: 4 steps: - uses: actions/checkout@v3 - name: ๐Ÿ“š Install LLVM 17 and some libs (Ubuntu) - if: matrix.os == 'ubuntu-22.04' + if: matrix.os == 'ubuntu-24.04' shell: bash run: | - sudo apt-get --purge remove "clang*" - wget --no-verbose -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - sudo add-apt-repository "deb https://apt.llvm.org/jammy/ llvm-toolchain-jammy main" sudo apt-get update sudo apt-get install xorg-dev libglu1-mesa-dev libgtk-3-dev clang-17 lldb-17 lld-17 libomp-17-dev sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-17 10 sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-17 10 + clang --version - name: ๐Ÿ“š Install CUDA Toolkit if: matrix.parallelisation == 'cuda' @@ -184,6 +200,13 @@ jobs: choco upgrade llvm "CMAKE_FLAGS=$env:CMAKE_FLAGS -G Ninja" >> $env:GITHUB_ENV + - uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: ๐Ÿ“š Install python packages + run: pip install --user numpy + - name: ๐Ÿ“ Create build folder run: cmake -E make_directory ${{runner.workspace}}/build @@ -210,9 +233,6 @@ jobs: working-directory: ${{runner.workspace}}/build run: cmake --build . --config $BUILD_TYPE -j 2 - - name: ๐Ÿ“š Install python packages - run: pip install --user numpy - - name: ๐Ÿงช Test if: matrix.parallelisation != 'cuda' shell: bash @@ -231,7 +251,11 @@ jobs: - parallelisation: "cuda" env: BUILD_TYPE: Release - CMAKE_FLAGS: -DCMAKE_CXX_COMPILER=nvc++ -DSPIRIT_UI_USE_IMGUI=ON -DSPIRIT_UI_CXX_USE_QT=OFF + CMAKE_FLAGS: > + -DCMAKE_CXX_COMPILER=nvc++ + -DSPIRIT_UI_USE_IMGUI=ON + -DSPIRIT_UI_CXX_USE_QT=OFF + -DSPIRIT_BUILD_TEST=ON OMP_NUM_THREADS: 4 steps: @@ -297,7 +321,10 @@ jobs: runs-on: windows-2022 env: BUILD_TYPE: Release - CMAKE_FLAGS: -DSPIRIT_UI_USE_IMGUI=ON -DSPIRIT_UI_CXX_USE_QT=OFF + CMAKE_FLAGS: > + -DSPIRIT_UI_USE_IMGUI=ON + -DSPIRIT_UI_CXX_USE_QT=OFF + -DSPIRIT_BUILD_TEST=ON steps: - uses: actions/checkout@v3 @@ -336,7 +363,10 @@ jobs: - os: windows-2022 env: BUILD_TYPE: Debug - CMAKE_FLAGS: -DSPIRIT_UI_USE_IMGUI=OFF -DSPIRIT_UI_CXX_USE_QT=OFF + CMAKE_FLAGS: > + -DSPIRIT_UI_USE_IMGUI=OFF + -DSPIRIT_UI_CXX_USE_QT=OFF + -DSPIRIT_BUILD_TEST=ON EXCLUDETESTS: solver steps: @@ -425,7 +455,10 @@ jobs: os: ubuntu-22.04 env: BUILD_TYPE: Release - CMAKE_FLAGS: -DSPIRIT_UI_USE_IMGUI=ON -DSPIRIT_UI_CXX_USE_QT=OFF + CMAKE_FLAGS: > + -DSPIRIT_UI_USE_IMGUI=ON + -DSPIRIT_UI_CXX_USE_QT=OFF + -DSPIRIT_BUILD_TEST=ON steps: - uses: actions/checkout@v3