From 10d1a2750cf448e6399f1750133c2d85b6e48b07 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Sat, 26 Apr 2025 19:27:32 -0600 Subject: [PATCH] Simplify Linux CI jobs --- .github/workflows/linux-bazel-builds.yml | 9 ++-- .github/workflows/linux-meson-builds.yml | 11 ++--- .github/workflows/linux-other-builds.yml | 58 ++++++++--------------- .github/workflows/linux-simple-builds.yml | 24 ++++------ 4 files changed, 38 insertions(+), 64 deletions(-) diff --git a/.github/workflows/linux-bazel-builds.yml b/.github/workflows/linux-bazel-builds.yml index 9c89b455..92a1c5ba 100644 --- a/.github/workflows/linux-bazel-builds.yml +++ b/.github/workflows/linux-bazel-builds.yml @@ -1,4 +1,4 @@ -name: Bazel build +name: Linux Builds (Bazel) on: [push, pull_request] @@ -14,12 +14,11 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Mount bazel cache + - name: Mount Bazel cache uses: actions/cache@v3 with: path: "/home/runner/.cache/bazel" key: bazel-ubuntu22-gcc11 - - name: Build Catch2 - run: | - bazelisk build --compilation_mode=${{matrix.compilation_mode}} //... + - name: Build + run: bazelisk build --compilation_mode=${{matrix.compilation_mode}} //... diff --git a/.github/workflows/linux-meson-builds.yml b/.github/workflows/linux-meson-builds.yml index 4a09de5c..e48dea9d 100644 --- a/.github/workflows/linux-meson-builds.yml +++ b/.github/workflows/linux-meson-builds.yml @@ -1,4 +1,4 @@ -name: Linux builds (meson) +name: Linux Builds (Meson) on: [push, pull_request] @@ -26,7 +26,7 @@ jobs: sudo apt-get update sudo apt-get install -y meson ninja-build ${{matrix.other_pkgs}} - - name: Configure build + - name: Configure env: CXX: ${{matrix.cxx}} CXXFLAGS: -std=c++${{matrix.std}} ${{matrix.cxxflags}} @@ -35,11 +35,10 @@ jobs: run: | meson -Dbuildtype=${{matrix.build_type}} ${{runner.workspace}}/meson-build - - name: Build tests + lib + - name: Build working-directory: ${{runner.workspace}}/meson-build run: ninja - - name: Run tests + - name: Test working-directory: ${{runner.workspace}}/meson-build - run: | - meson test --verbose + run: meson test --verbose diff --git a/.github/workflows/linux-other-builds.yml b/.github/workflows/linux-other-builds.yml index 0ff27556..7bc651a8 100644 --- a/.github/workflows/linux-other-builds.yml +++ b/.github/workflows/linux-other-builds.yml @@ -1,7 +1,7 @@ # The builds in this file are more complex (e.g. they need custom CMake # configuration) and thus are unsuitable to the simple build matrix # approach used in simple-builds -name: Linux builds (complex) +name: Linux Builds (Complex) on: [push, pull_request] @@ -79,63 +79,46 @@ jobs: sudo apt-get install -y ninja-build ${{matrix.other_pkgs}} - name: Configure build - working-directory: ${{runner.workspace}} - env: - CXX: ${{matrix.cxx}} - CXXFLAGS: ${{matrix.cxxflags}} # Note: $GITHUB_WORKSPACE is distinct from ${{runner.workspace}}. # This is important run: | - cmake -Bbuild -S$GITHUB_WORKSPACE \ + cmake -Bbuild -GNinja \ -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ + -DCMAKE_CXX_COMPILER=${{matrix.cxx}} \ -DCMAKE_CXX_STANDARD=${{matrix.std}} \ -DCMAKE_CXX_STANDARD_REQUIRED=ON \ -DCMAKE_CXX_EXTENSIONS=OFF \ -DCATCH_DEVELOPMENT_BUILD=ON \ - ${{matrix.cmake_configurations}} \ - -G Ninja + ${{matrix.cmake_configurations}} - - name: Build tests + lib - working-directory: ${{runner.workspace}}/build - run: ninja + - name: Build + run: cmake --build build + + - name: Test + run: ctest --test-dir build -j --output-on-failure - - name: Run tests - working-directory: ${{runner.workspace}}/build - run: ctest -C ${{matrix.build_type}} -j `nproc` ${{matrix.other_ctest_args}} --output-on-failure clang-tidy: - name: clang-tidy ${{matrix.version}}, ${{matrix.build_description}}, C++${{matrix.std}} ${{matrix.build_type}} + name: clang-tidy runs-on: ubuntu-22.04 - strategy: - matrix: - include: - - version: "15" - build_description: all - build_type: Debug - std: 17 - other_pkgs: '' - cmake_configurations: -DCATCH_BUILD_EXAMPLES=ON -DCATCH_ENABLE_CMAKE_HELPER_TESTS=ON steps: - uses: actions/checkout@v4 - name: Prepare environment run: | sudo apt-get update - sudo apt-get install -y ninja-build clang-${{matrix.version}} clang-tidy-${{matrix.version}} ${{matrix.other_pkgs}} + sudo apt-get install -y ninja-build clang-15 clang-tidy-15 - - name: Configure build - working-directory: ${{runner.workspace}} - env: - CXX: clang++-${{matrix.version}} - CXXFLAGS: ${{matrix.cxxflags}} + - name: Configure # Note: $GITHUB_WORKSPACE is distinct from ${{runner.workspace}}. # This is important run: | - clangtidy="clang-tidy-${{matrix.version}};-use-color" + clangtidy="clang-tidy-15;-use-color" # Use a dummy compiler/linker/ar/ranlib to effectively disable the # compilation and only run clang-tidy. - cmake -Bbuild -S$GITHUB_WORKSPACE \ - -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ - -DCMAKE_CXX_STANDARD=${{matrix.std}} \ + cmake -Bbuild -GNinja \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_COMPILER=clang++-15 \ + -DCMAKE_CXX_STANDARD=17 \ -DCMAKE_CXX_STANDARD_REQUIRED=ON \ -DCMAKE_CXX_EXTENSIONS=OFF \ -DCATCH_DEVELOPMENT_BUILD=ON \ @@ -145,9 +128,8 @@ jobs: -DCMAKE_CXX_COMPILER_AR=/usr/bin/true \ -DCMAKE_RANLIB=/usr/bin/true \ -DCMAKE_CXX_LINK_EXECUTABLE=/usr/bin/true \ - ${{matrix.cmake_configurations}} \ - -G Ninja + -DCATCH_BUILD_EXAMPLES=ON \ + -DCATCH_ENABLE_CMAKE_HELPER_TESTS=ON - name: Run clang-tidy - working-directory: ${{runner.workspace}}/build - run: ninja + run: cmake --build build diff --git a/.github/workflows/linux-simple-builds.yml b/.github/workflows/linux-simple-builds.yml index 1eec922a..4e30451e 100644 --- a/.github/workflows/linux-simple-builds.yml +++ b/.github/workflows/linux-simple-builds.yml @@ -1,4 +1,4 @@ -name: Linux builds (basic) +name: Linux Builds (Basic) on: [push, pull_request] @@ -97,26 +97,20 @@ jobs: sudo apt-get update sudo apt-get install -y ninja-build ${{matrix.other_pkgs}} - - name: Configure build - working-directory: ${{runner.workspace}} - env: - CXX: ${{matrix.cxx}} - CXXFLAGS: ${{matrix.cxxflags}} + - name: Configure # Note: $GITHUB_WORKSPACE is distinct from ${{runner.workspace}}. # This is important run: | - cmake -Bbuild -S$GITHUB_WORKSPACE \ + cmake -Bbuild -GNinja \ -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ + -DCMAKE_CXX_COMPILER=${{matrix.cxx}} \ -DCMAKE_CXX_STANDARD=${{matrix.std}} \ -DCMAKE_CXX_STANDARD_REQUIRED=ON \ -DCMAKE_CXX_EXTENSIONS=OFF \ - -DCATCH_DEVELOPMENT_BUILD=ON \ - -G Ninja + -DCATCH_DEVELOPMENT_BUILD=ON - - name: Build tests + lib - working-directory: ${{runner.workspace}}/build - run: ninja + - name: Build + run: cmake --build build - - name: Run tests - working-directory: ${{runner.workspace}}/build - run: ctest -C ${{matrix.build_type}} -j `nproc` --output-on-failure + - name: Test + run: ctest --test-dir build -j --output-on-failure