Skip to content

Commit b37f3b2

Browse files
committed
ci: add local repro instructions to CMake test package failure summary
1 parent babf8fd commit b37f3b2

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,31 @@ jobs:
287287
run: |
288288
if [ "${{ job.status }}" = "failure" ]; then
289289
echo "## ❌ CMake Test Package Failed: ${{ matrix.config-summary-str }}" >> $GITHUB_STEP_SUMMARY
290+
echo "" >> $GITHUB_STEP_SUMMARY
291+
echo "**Local repro:**" >> $GITHUB_STEP_SUMMARY
292+
if [ "${{ matrix.toolchain.compiler.type }}" != "MSVC" ]; then
293+
case "${{ matrix.toolchain.compiler.type }}" in
294+
GCC) CONAN_COMPILER="gcc" ;;
295+
CLANG) CONAN_COMPILER="clang" ;;
296+
APPLE_CLANG) CONAN_COMPILER="apple-clang" ;;
297+
esac
298+
SETTINGS="-s compiler=${CONAN_COMPILER} -s compiler.version=${{ matrix.toolchain.compiler.version }} -s compiler.cppstd=${{ matrix.std }} -s build_type=${{ matrix.build_type }}"
299+
[ "${{ matrix.toolchain.compiler.type }}" = "CLANG" ] && SETTINGS="${SETTINGS} -s compiler.libcxx=libc++"
300+
CC="${{ matrix.toolchain.compiler.cc }}"
301+
CXX="${{ matrix.toolchain.compiler.cxx }}"
302+
COMPILER_CONF="-c 'tools.build:compiler_executables={\"c\": \"${CC}\", \"cpp\": \"${CXX}\"}'"
303+
BUILD_TYPE_LOWER=$(echo "${{ matrix.build_type }}" | tr '[:upper:]' '[:lower:]')
304+
echo '```sh' >> $GITHUB_STEP_SUMMARY
305+
echo "conan install . -b missing ${SETTINGS} ${COMPILER_CONF} -c user.mp-units.build:all=False ${{ matrix.conan-config }}" >> $GITHUB_STEP_SUMMARY
306+
echo "echo '{\"version\":4,\"include\":[\"../CMakeUserPresets.json\"]}' > src/CMakeUserPresets.json" >> $GITHUB_STEP_SUMMARY
307+
echo "echo '{\"version\":4,\"include\":[\"../CMakeUserPresets.json\"]}' > test_package/CMakeUserPresets.json" >> $GITHUB_STEP_SUMMARY
308+
echo "(cd src && source ../build/generators/conanbuild.sh && cmake --preset conan-default -DCMAKE_INSTALL_PREFIX=../out && cmake --build --preset conan-${BUILD_TYPE_LOWER} --target install)" >> $GITHUB_STEP_SUMMARY
309+
echo "(cd test_package && source ../build/generators/conanbuild.sh && cmake --preset conan-default -Dmp-units_DIR=../build -Bbuild/local && cmake --build build/local --config ${{ matrix.build_type }})" >> $GITHUB_STEP_SUMMARY
310+
echo "./test_package/build/local/${{ matrix.build_type }}/test_package-headers" >> $GITHUB_STEP_SUMMARY
311+
echo '```' >> $GITHUB_STEP_SUMMARY
312+
else
313+
echo "_MSVC: refer to the workflow steps in \`ci-test-package-cmake.yml\`._" >> $GITHUB_STEP_SUMMARY
314+
fi
290315
else
291316
echo "## ⏹️ CMake Test Package Cancelled: ${{ matrix.config-summary-str }}" >> $GITHUB_STEP_SUMMARY
292317
fi

0 commit comments

Comments
 (0)