From 2430188b613788c0964f84031c9847c6f4208e08 Mon Sep 17 00:00:00 2001 From: onon1101 Date: Sun, 21 Apr 2024 14:01:46 +0800 Subject: [PATCH] update actions --- .github/workflows/clang-tidy-check.yml | 24 +++++ .github/workflows/main.yml | 128 +++++++++++-------------- .github/workflows/multi_system.yml | 115 ---------------------- 3 files changed, 80 insertions(+), 187 deletions(-) create mode 100644 .github/workflows/clang-tidy-check.yml delete mode 100644 .github/workflows/multi_system.yml diff --git a/.github/workflows/clang-tidy-check.yml b/.github/workflows/clang-tidy-check.yml new file mode 100644 index 00000000..50f2bbc0 --- /dev/null +++ b/.github/workflows/clang-tidy-check.yml @@ -0,0 +1,24 @@ +name: clang-tidy-review + +# You can be more specific, but it currently only works on pull requests +on: [pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + # Optionally generate compile_commands.json + + - uses: ZedThree/clang-tidy-review@v0.14.0 + id: review + + # Uploads an artefact containing clang_fixes.json + - uses: ZedThree/clang-tidy-review/upload@v0.14.0 + id: upload-review + + # If there are any comments, fail the check + - if: steps.review.outputs.total_comments > 0 + run: exit 1 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f9d41004..6e1f4f9d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,86 +1,70 @@ +name: Compile -name: main-before - -on: +on: merge_group: pull_request: -# linux-gcc jobs: build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 + runs-on: ${{ matrix.config.os }} + strategy: + fail-fast: false + matrix: + config: + - os: ubuntu-latest + compiler: gcc + generator: Ninja + deps_cmdline: sudo apt-get update && sudo apt-get -y install gcc cmake ninja-build libglu1-mesa-dev mesa-common-dev xorg-dev + - os: ubuntu-latest + compiler: clang + generator: Ninja + deps_cmdline: sudo apt-get update && sudo apt-get -y install clang cmake ninja-build libglu1-mesa-dev mesa-common-dev xorg-dev + - os: windows-latest + compiler: msvc + generator: Visual Studio 17 2022 + - os: windows-latest + compiler: mingw + generator: MinGW Makefiles + - os: macos-latest + compiler: clang + generator: Ninja + deps_cmdline: brew install cmake ninja mesa-glu mesa xorg-server - - name: Installing Dependencies - run: | - sudo apt-get update - sudo apt-get -y install gcc cmake ninja-build libglu1-mesa-dev mesa-common-dev xorg-dev + steps: + - if: matrix.config.os == 'windows-latest' && matrix.config.compiler == 'mingw' + name: "Set Windows-MinGW-Compiler" + uses: seanmiddleditch/gha-setup-ninja@master - - name: Checkout Repository - uses: actions/checkout@v3 + - name: "Checkout Repository" + uses: actions/checkout@v4 with: submodules: recursive - - name: Building Project - if: matrix.os == 'ubuntu-latest' - env: - CC: gcc - CXX: g++ + - name: Install Dependencies + shell: bash run: | - cmake -B build -G "Ninja" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - cmake --build build - -# jobs: -# build: -# runs-on: ${{ matrix.os }} -# strategy: -# fail-fast: false -# matrix: -# os: [ubuntu-latest] -# compiler: [{ cc: gcc, cxx: g++ }, { cc: clang, cxx: clang++ }] -# build_type: [Debug] -# binary: [linux-binary] -# include: -# - os: windows-latest -# build_type: Debug -# binary: windows-binary - -# steps: -# - if: matrix.os == 'ubuntu-latest' -# name: Installing Dependencies -# run: | -# sudo apt-get update -# sudo apt-get -y install ${{ matrix.compiler.cc }} cmake ninja-build libglu1-mesa-dev mesa-common-dev xorg-dev - -# - name: Checkout Repository -# uses: actions/checkout@v3 -# with: -# submodules: recursive + if [[ ! -z "${{ matrix.config.deps_cmdline }}" ]]; then + eval ${{ matrix.config.deps_cmdline }} + fi -# - name: Check Format -# if: matrix.os == 'ubuntu-latest' && matrix.compiler == 'clang' -# run: | -# find src/ include/ test/ assets/shaders/ -name "*.*" -print0 | \ -# xargs -0 clang-format --dry-run --Werror --ferror-limit=15 - -# - name: Building Project -# if: matrix.os == 'ubuntu-latest' -# env: -# CC: ${{ matrix.compiler.cc }} -# CXX: ${{ matrix.compiler.cxx }} -# run: | -# cmake -B build -G "Ninja" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -# cmake --build build - -# - name: Run Linter -# if: matrix.os == 'ubuntu-latest' && matrix.compiler == 'clang' -# run: | -# find src/ include/ test/ -name "*.*" -print0 | \ -# xargs -0 run-clang-tidy true -p build + - name: "Setup cmake" + run: | + cmake -B build -DCMAKE_BUILD_TYPE=Debug -G "${{ matrix.config.generator }}" + cmake --build build -# - name: Building Project -# if: matrix.os == 'windows-latest' -# run: | -# cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -# cmake --build build --config ${{ matrix.build_type }} + formatting-check: + name: Formatting Check + runs-on: ubuntu-latest + strategy: + matrix: + path: + - "src" + - "include" + steps: + - uses: actions/checkout@v3 + - name: Run clang-format style check for C/C++/Protobuf programs. + uses: jidicula/clang-format-action@v4.11.0 + with: + clang-format-version: "18" + check-path: ${{ matrix.path }} + fallback-style: "Mozilla" # optional diff --git a/.github/workflows/multi_system.yml b/.github/workflows/multi_system.yml deleted file mode 100644 index b1a1ccc1..00000000 --- a/.github/workflows/multi_system.yml +++ /dev/null @@ -1,115 +0,0 @@ - -name: main - -on: - merge_group: - pull_request: - -jobs: - - windows-visual-studio: - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - - name: "Setup Visual Studio" - uses: egor-tensin/vs-shell@v2 - - - name: Checkout Repository - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: "Setup cmake" - run: | - cmake -B build -DCMAKE_BUILD_TYPE=Debug - cmake --build build - - windows-mingw: - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - uses: seanmiddleditch/gha-setup-ninja@master - - - name: Checkout Repository - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: "Build" - run: | - cmake -B build -DCMAKE_BUILD_TYPE=Debug -G "MinGW Makefiles" - # cmake -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Debug - cmake --build build - macos: - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - - - name: "Setup required packages" - run: brew install cmake ninja mesa-glu mesa xorg-server - - - - name: Checkout Repository - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Building Project - run: | - cmake -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Debug - cmake --build build - - linux-clang: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: "Setup required packages" - run: | - sudo apt-get update - sudo apt-get -y install clang cmake ninja-build libglu1-mesa-dev mesa-common-dev xorg-dev - - - name: "Setup clang" - uses: egor-tensin/setup-clang@v1 - - - name: Checkout Repository - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Building Project - env: - CC: clang - CXX: clang++ - run: | - cmake -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Debug - cmake --build build - - linux-gcc: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Installing Dependencies - run: | - sudo apt-get update - sudo apt-get -y install gcc cmake ninja-build libglu1-mesa-dev mesa-common-dev xorg-dev - - - name: Checkout Repository - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Building Project - env: - CC: gcc - CXX: g++ - run: | - cmake -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Debug - cmake --build build - - # CXX: g++ - # run: | - # cmake -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Debug - # cmake --build build