ci: Split clang into separate script, run it in CoreOS CI
Let's do a build with clang as a cleanly separate context instead of serially; and also do it unconditionally. This is prep for turning on more `-Werror` flow in both cases, and also using clang `scan-build` in CI.
This commit is contained in:
parent
4b1120d57e
commit
14f75f94ef
@ -48,7 +48,16 @@ unit: {
|
|||||||
MAKE_JOBS=${n} CARGO_BUILD_JOBS=${n} ci/unit.sh
|
MAKE_JOBS=${n} CARGO_BUILD_JOBS=${n} ci/unit.sh
|
||||||
""")
|
""")
|
||||||
}
|
}
|
||||||
}}
|
},
|
||||||
|
clang: {
|
||||||
|
// Build with clang/clang++
|
||||||
|
def n = 5
|
||||||
|
cosaPod(buildroot: true, runAsUser: 0, memory: "2Gi", cpu: "${n}") {
|
||||||
|
checkout scm
|
||||||
|
shwrap("ci/clang-build-check.sh")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stage("Test") {
|
stage("Test") {
|
||||||
parallel insttests: {
|
parallel insttests: {
|
||||||
|
@ -14,26 +14,3 @@ export PATH="$HOME/.cargo/bin:$PATH"
|
|||||||
${dn}/build.sh
|
${dn}/build.sh
|
||||||
make check
|
make check
|
||||||
make install
|
make install
|
||||||
|
|
||||||
# And now a clang build with -Werror turned on. We can't do this with gcc (in
|
|
||||||
# build.sh) because it doesn't support -Wno-error=macro-redefined, (and neither
|
|
||||||
# does clang on CentOS). Anyway, all we want is at least one clang run.
|
|
||||||
if test -x /usr/bin/clang; then
|
|
||||||
if grep -q -e 'static inline.*_GLIB_AUTOPTR_LIST_FUNC_NAME' /usr/include/glib-2.0/glib/gmacros.h; then
|
|
||||||
echo 'Skipping clang check, see https://bugzilla.gnome.org/show_bug.cgi?id=796346'
|
|
||||||
else
|
|
||||||
# Except unused-command-line-argument:
|
|
||||||
# error: argument unused during compilation: '-specs=/usr/lib/rpm/redhat/redhat-hardened -cc1' [-Werror,-Wunused-command-line-argument]
|
|
||||||
# Except for macro-redefined:
|
|
||||||
# /usr/include/python2.7/pyconfig-64.h:1199:9: error: '_POSIX_C_SOURCE' macro redefined
|
|
||||||
# Except for deprecated-declarations: libdnf python bindings uses deprecated
|
|
||||||
# functions
|
|
||||||
export CFLAGS="-Wall -Werror -Wno-error=deprecated-declarations -Wno-error=macro-redefined -Wno-error=unused-command-line-argument ${CFLAGS:-}"
|
|
||||||
export CC=clang
|
|
||||||
git clean -dfx && git submodule foreach git clean -dfx
|
|
||||||
# XXX: --disable-introspection because right now we're always building the
|
|
||||||
# introspection bits with gcc, which doesn't understand some of the flags
|
|
||||||
# above (see Makefile-lib.am)
|
|
||||||
build ${CONFIGOPTS:-} --disable-introspection
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
16
ci/clang-build-check.sh
Executable file
16
ci/clang-build-check.sh
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/bash
|
||||||
|
# Install build dependencies, run unit tests and installed tests.
|
||||||
|
|
||||||
|
# This script is what Prow runs.
|
||||||
|
|
||||||
|
set -xeuo pipefail
|
||||||
|
|
||||||
|
dn=$(dirname $0)
|
||||||
|
. ${dn}/libbuild.sh
|
||||||
|
|
||||||
|
# add cargo's directory to the PATH like we do in CoreOS CI
|
||||||
|
export PATH="$HOME/.cargo/bin:$PATH"
|
||||||
|
|
||||||
|
export CC=clang CXX=clang++
|
||||||
|
${dn}/build.sh
|
||||||
|
make check
|
Loading…
Reference in New Issue
Block a user