Make linker errors fail the CI builds
authorMark Abraham <mark.j.abraham@gmail.com>
Fri, 22 Oct 2021 08:24:26 +0000 (10:24 +0200)
committerAndrey Alekseenko <al42and@gmail.com>
Fri, 22 Oct 2021 11:31:32 +0000 (11:31 +0000)
admin/ci-scripts/gromacs-base-build.sh

index 2ff46293660e8caa4be4c41dd862242abed67a90..94843970e2d71f2b35af551fee43bd9dd84ab3a4 100755 (executable)
@@ -4,10 +4,20 @@ CMAKE=${CMAKE:-$(which cmake)}
 cd $BUILD_DIR
 $CMAKE --build . -- -j$KUBERNETES_CPU_LIMIT 2>&1 | tee buildLogFile.log
 $CMAKE --build . --target tests -- -j$KUBERNETES_CPU_LIMIT 2>&1 | tee testBuildLogFile.log
+
+# Find compiler warnings
 awk '/warning/,/warning.*generated|^$/' buildLogFile.log testBuildLogFile.log \
       | grep -v "CMake" | tee buildErrors.log || true
 grep "cannot be built" buildLogFile.log testBuildLogFile.log | tee -a buildErrors.log || true
+
+# Find linking errors:
+grep "^/usr/bin/ld:" buildLogFile.log testBuildLogFile.log | tee -a buildErrors.log || true
+
+# Install GROMACS
 $CMAKE --build . --target install 2>&1 | tee installBuildLogFile.log
+
+# Fail if there were warnings or errors reported
 if [ -s buildErrors.log ] ; then echo "Found compiler warning during build"; cat buildErrors.log; exit 1; fi
+# Remove object files to minimize artifact size
 find . -mindepth 1 -name '*.o' ! -type l -printf '%p\n' -delete 2>&1 > remove-build-objects.log
 cd ..