ci: separate builds for different formatting options enabled

This commit is contained in:
Mateusz Pusz
2024-01-23 22:29:31 +01:00
parent fcadaf5d70
commit d67de617c5
2 changed files with 25 additions and 4 deletions

View File

@@ -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

View File

@@ -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'