From d67de617c5ce00dc197fc9b74e08e5866c137d2f Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Tue, 23 Jan 2024 22:29:31 +0100 Subject: [PATCH] ci: separate builds for different formatting options enabled --- .github/workflows/ci-conan.yml | 14 ++++++++++++-- .github/workflows/ci-test-package-cmake.yml | 15 +++++++++++++-- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-conan.yml b/.github/workflows/ci-conan.yml index 5528a5364..aab13c3d6 100644 --- a/.github/workflows/ci-conan.yml +++ b/.github/workflows/ci-conan.yml @@ -35,11 +35,12 @@ env: jobs: build: - name: "C++${{ matrix.std }} ${{ matrix.config.name }} ${{ matrix.build_type }}" + name: "${{ matrix.formatting }} C++${{ matrix.std }} ${{ matrix.config.name }} ${{ matrix.build_type }}" runs-on: ${{ matrix.config.os }} strategy: fail-fast: false matrix: + formatting: ["std::format", "fmtlib"] std: [20, 23] config: # - { @@ -65,6 +66,7 @@ jobs: cxx: "g++-12", }, cxx_modules: "False", + std_format_support: "False", conan-config: "", } - { @@ -78,6 +80,7 @@ jobs: cxx: "g++-13", }, cxx_modules: "False", + std_format_support: "True", conan-config: "", } - { @@ -92,6 +95,7 @@ jobs: }, lib: "libc++", cxx_modules: "False", + std_format_support: "True", conan-config: "", } - { @@ -106,6 +110,7 @@ jobs: }, lib: "libc++", cxx_modules: "True", + std_format_support: "True", conan-config: "", } - { @@ -119,9 +124,13 @@ jobs: cxx: "clang++", }, cxx_modules: "False", + std_format_support: "True", conan-config: "", } build_type: ["Release", "Debug"] + exclude: + - formatting: "std::format" + std_format_support: "False" env: CC: ${{ matrix.config.compiler.cc }} @@ -196,12 +205,13 @@ jobs: sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler.cppstd=.*/compiler.cppstd=${{ matrix.std }}/' ~/.conan2/profiles/default sed -i.backup '/^\[settings\]$/,/^\[/ s/^build_type=.*/build_type=${{ matrix.build_type }}/' ~/.conan2/profiles/default conan profile show -pr default + - run: echo "use_fmtlib=$([ "${{ matrix.formatting }}" == "fmtlib" ] && echo "True" || echo "False")" >> $GITHUB_ENV - name: Create Conan package shell: bash run: | conan create . --user mpusz --channel ${CHANNEL} --lockfile-out=package.lock \ -b mp-units/* -b missing -c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" \ - -c user.build:all=True -o cxx_modules=${{ matrix.config.cxx_modules }} ${{ matrix.config.conan-config }} + -c user.build:all=True -o cxx_modules=${{ matrix.config.cxx_modules }} -o use_fmtlib=${{ env.use_fmtlib }} ${{ matrix.config.conan-config }} - name: Obtain package reference id: get-package-ref shell: bash diff --git a/.github/workflows/ci-test-package-cmake.yml b/.github/workflows/ci-test-package-cmake.yml index faad53091..2e27b4e28 100644 --- a/.github/workflows/ci-test-package-cmake.yml +++ b/.github/workflows/ci-test-package-cmake.yml @@ -36,11 +36,12 @@ on: jobs: test_package: - name: "C++${{ matrix.std }} ${{ matrix.config.name }} ${{ matrix.build_type }}" + name: "${{ matrix.formatting }} C++${{ matrix.std }} ${{ matrix.config.name }} ${{ matrix.build_type }}" runs-on: ${{ matrix.config.os }} strategy: fail-fast: false matrix: + formatting: ["std::format", "fmtlib"] std: [20, 23] config: # - { @@ -64,6 +65,7 @@ jobs: cxx: "g++-12", }, cxx_modules: "False", + std_format_support: "False", } - { name: "GCC-13", @@ -76,6 +78,7 @@ jobs: cxx: "g++-13", }, cxx_modules: "False", + std_format_support: "True", } - { name: "Clang-16", @@ -89,6 +92,7 @@ jobs: }, lib: "libc++", cxx_modules: "False", + std_format_support: "True", } - { name: "Clang-17", @@ -102,6 +106,7 @@ jobs: }, lib: "libc++", cxx_modules: "False", + std_format_support: "True", } - { name: "Apple Clang 15", @@ -114,8 +119,12 @@ jobs: cxx: "clang++", }, cxx_modules: "False", + std_format_support: "True", } build_type: ["Release", "Debug"] + exclude: + - formatting: "std::format" + std_format_support: "False" env: CC: ${{ matrix.config.compiler.cc }} @@ -191,10 +200,12 @@ jobs: sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler.cppstd=.*/compiler.cppstd=${{ matrix.std }}/' ~/.conan2/profiles/default sed -i.backup '/^\[settings\]$/,/^\[/ s/^build_type=.*/build_type=${{ matrix.build_type }}/' ~/.conan2/profiles/default conan profile show -pr default + - run: echo "use_fmtlib=$([ "${{ matrix.formatting }}" == "fmtlib" ] && echo "True" || echo "False")" >> $GITHUB_ENV - name: Install Conan dependencies shell: bash run: | - conan install . -b missing -c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" -c user.build:all=False -o cxx_modules=${{ matrix.config.cxx_modules }} + conan install . -b missing -c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" -c user.build:all=False \ + -o cxx_modules=${{ matrix.config.cxx_modules }} -o use_fmtlib=${{ env.use_fmtlib }} mv CMakeUserPresets.json src - name: Configure mp-units CMake if: matrix.config.compiler.type == 'VISUAL' || matrix.config.compiler.type == 'MSVC'