Skip to content

Commit 2681868

Browse files
authored
Merge pull request #768 from mpusz/ci/conan-args
ci: merge conan-conf/-config into conan-args and add compiler_executables
2 parents 7dd1f8b + 62e5033 commit 2681868

File tree

5 files changed

+17
-10
lines changed

5 files changed

+17
-10
lines changed

.github/job_matrix.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def for_github(self):
119119
# expose individual ConanOptions fields as top-level matrix properties
120120
# (needed for YAML conditions and cache keys)
121121
ret.update(features)
122-
ret["conan-config"] = " ".join(f"-o '&:{k}={v}'" for k, v in features.items())
122+
options = " ".join(f"-o '&:{k}={v}'" for k, v in features.items())
123123
ret["config-summary-str"] = self.infostr(adjusted=False)
124124
# Pre-build the -s flags so workflows and repro scripts can use them directly
125125
# without sed-patching the auto-detected Conan profile.
@@ -141,6 +141,13 @@ def for_github(self):
141141
ret["conan-build-folder"] = (
142142
f"{_COMPILER_TYPE_MAP[self.toolchain.compiler.type]}-{self.toolchain.compiler.version}-{self.std}"
143143
)
144+
cc = self.toolchain.compiler.cc
145+
cxx = self.toolchain.compiler.cxx
146+
if cc and cxx:
147+
conf = f'-c \'tools.build:compiler_executables={{"c": "{cc}", "cpp": "{cxx}"}}\''
148+
ret["conan-args"] = f"{conf} {options}"
149+
else:
150+
ret["conan-args"] = options
144151
return ret
145152

146153
def _formatters():

.github/workflows/ci-clang-tidy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ jobs:
147147
conan build . -b missing ${{ matrix.conan-settings }} \
148148
-c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" \
149149
-c user.mp-units.build:all=True -c user.mp-units.analyze:clang-tidy=True -c tools.build:skip_test=True \
150-
${{ matrix.conan-config }} 2>&1 | tee /tmp/clang-tidy.log
150+
${{ matrix.conan-args }} 2>&1 | tee /tmp/clang-tidy.log
151151
exit ${PIPESTATUS[0]}
152152
- name: Emit clang-tidy annotations
153153
if: failure()
@@ -185,5 +185,5 @@ jobs:
185185
echo "" >> $GITHUB_STEP_SUMMARY
186186
echo "**Local repro** (in the provided '.devcontainer' or GitHub CodeSpaces environment):" >> $GITHUB_STEP_SUMMARY
187187
echo '```sh' >> $GITHUB_STEP_SUMMARY
188-
echo "conan build . -b missing ${{ matrix.conan-settings }} -c user.mp-units.build:all=True -c user.mp-units.analyze:clang-tidy=True -c tools.build:skip_test=True ${{ matrix.conan-config }}" >> $GITHUB_STEP_SUMMARY
188+
echo "conan build . -b missing ${{ matrix.conan-settings }} -c user.mp-units.build:all=True -c user.mp-units.analyze:clang-tidy=True -c tools.build:skip_test=True ${{ matrix.conan-args }}" >> $GITHUB_STEP_SUMMARY
189189
echo '```' >> $GITHUB_STEP_SUMMARY

.github/workflows/ci-conan.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,15 @@ jobs:
170170
conan create . --user mpusz --channel ${CHANNEL} --lockfile-out=package.lock \
171171
-b mp-units/* -b missing ${{ matrix.conan-settings }} \
172172
-c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" -c user.mp-units.build:all=True \
173-
${{ matrix.conan-config }}
173+
${{ matrix.conan-args }}
174174
- name: Create Conan package
175175
if: matrix.toolchain.compiler.type == 'MSVC'
176176
shell: bash
177177
run: |
178178
conan create . --user mpusz --channel ${CHANNEL} --lockfile-out=package.lock \
179179
-b mp-units/* -b missing ${{ matrix.conan-settings }} \
180180
-c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" -c user.mp-units.build:all=False \
181-
${{ matrix.conan-config }}
181+
${{ matrix.conan-args }}
182182
- name: Obtain package reference
183183
id: get-package-ref
184184
shell: bash
@@ -208,7 +208,7 @@ jobs:
208208
echo "**Local repro** (in the provided '.devcontainer' or GitHub CodeSpaces environment):" >> $GITHUB_STEP_SUMMARY
209209
echo '```sh' >> $GITHUB_STEP_SUMMARY
210210
[ "${{ matrix.toolchain.compiler.type }}" != "MSVC" ] && ALL="True" || ALL="False"
211-
echo "conan create . -b mp-units/* -b missing ${{ matrix.conan-settings }} -c user.mp-units.build:all=${ALL} ${{ matrix.conan-config }}" >> $GITHUB_STEP_SUMMARY
211+
echo "conan create . -b mp-units/* -b missing ${{ matrix.conan-settings }} -c user.mp-units.build:all=${ALL} ${{ matrix.conan-args }}" >> $GITHUB_STEP_SUMMARY
212212
echo '```' >> $GITHUB_STEP_SUMMARY
213213
214214
outputs:

.github/workflows/ci-freestanding.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ jobs:
162162
conan build . -b missing ${{ matrix.conan-settings }} \
163163
-c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" \
164164
-c user.mp-units.build:all=True \
165-
${{ matrix.conan-config }}
165+
${{ matrix.conan-args }}
166166
- name: Clean Conan cache before backup
167167
shell: bash
168168
run: |
@@ -178,5 +178,5 @@ jobs:
178178
echo "" >> $GITHUB_STEP_SUMMARY
179179
echo "**Local repro** (in the provided '.devcontainer' or GitHub CodeSpaces environment):" >> $GITHUB_STEP_SUMMARY
180180
echo '```sh' >> $GITHUB_STEP_SUMMARY
181-
echo "conan build . -b missing ${{ matrix.conan-settings }} -c user.mp-units.build:all=True ${{ matrix.conan-config }}" >> $GITHUB_STEP_SUMMARY
181+
echo "conan build . -b missing ${{ matrix.conan-settings }} -c user.mp-units.build:all=True ${{ matrix.conan-args }}" >> $GITHUB_STEP_SUMMARY
182182
echo '```' >> $GITHUB_STEP_SUMMARY

.github/workflows/ci-test-package-cmake.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ jobs:
174174
run: |
175175
conan install . -b missing ${{ matrix.conan-settings }} \
176176
-c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" \
177-
-c user.mp-units.build:all=False ${{ matrix.conan-config }}
177+
-c user.mp-units.build:all=False ${{ matrix.conan-args }}
178178
- name: Provide dependencies for the build
179179
shell: bash
180180
working-directory: src
@@ -290,7 +290,7 @@ jobs:
290290
BUILD_TYPE_LOWER=$(echo "${{ matrix.build_type }}" | tr '[:upper:]' '[:lower:]')
291291
echo '```sh' >> $GITHUB_STEP_SUMMARY
292292
echo "echo 'tools.cmake.cmake_layout:build_folder_vars=[\"settings.compiler\", \"settings.compiler.version\", \"settings.compiler.cppstd\"]' >> ~/.conan2/global.conf" >> $GITHUB_STEP_SUMMARY
293-
echo "conan install . -b missing ${{ matrix.conan-settings }} -c user.mp-units.build:all=False ${{ matrix.conan-config }}" >> $GITHUB_STEP_SUMMARY
293+
echo "conan install . -b missing ${{ matrix.conan-settings }} -c user.mp-units.build:all=False ${{ matrix.conan-args }}" >> $GITHUB_STEP_SUMMARY
294294
echo "echo '{\"version\":4,\"include\":[\"../CMakeUserPresets.json\"]}' > src/CMakeUserPresets.json" >> $GITHUB_STEP_SUMMARY
295295
echo "echo '{\"version\":4,\"include\":[\"../CMakeUserPresets.json\"]}' > test_package/CMakeUserPresets.json" >> $GITHUB_STEP_SUMMARY
296296
echo "(cd src && source ../build/${{ matrix.conan-build-folder }}/generators/conanbuild.sh && cmake --preset conan-${{ matrix.conan-build-folder }} -DCMAKE_INSTALL_PREFIX=../out && cmake --build --preset conan-${{ matrix.conan-build-folder }}-${BUILD_TYPE_LOWER} --target install)" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)