summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2023-01-05 09:25:26 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2023-01-05 09:25:46 +1000
commit6d0d778e59940953a16c209e7d2541e3247e8556 (patch)
treede360e8f070f4660dc26c575c91aefb1f538fa6c
parentac3d44ee7a1363c913a7b24768cdda6e0d55deb5 (diff)
downloadlibevdev-6d0d778e59940953a16c209e7d2541e3247e8556.tar.gz
gitlab CI: replace the meson-build.sh with the libinput one
The libinput one is more generic and expressive, taking arguments and whatnot. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rwxr-xr-x.gitlab-ci/meson-build.sh57
1 files changed, 43 insertions, 14 deletions
diff --git a/.gitlab-ci/meson-build.sh b/.gitlab-ci/meson-build.sh
index 1ed1923..d12dd0f 100755
--- a/.gitlab-ci/meson-build.sh
+++ b/.gitlab-ci/meson-build.sh
@@ -1,9 +1,38 @@
-#!/bin/bash
+#!/usr/bin/env bash
+set -x
if [[ -f .meson_environment ]]; then
. .meson_environment
fi
+# If test args are set, we assume we want to run the tests
+MESON_RUN_TEST="$MESON_TEST_ARGS"
+
+while [[ $# -gt 0 ]]; do
+ case $1 in
+ --skip-setup)
+ shift
+ MESON_SKIP_SETUP="1"
+ ;;
+ --skip-build)
+ shift
+ MESON_SKIP_BUILD="1"
+ ;;
+ --skip-test)
+ shift
+ MESON_RUN_TEST=""
+ ;;
+ --run-test)
+ shift
+ MESON_RUN_TEST="1"
+ ;;
+ *)
+ echo "Unknow commandline argument $1"
+ exit 1
+ ;;
+ esac
+done
+
if [[ -z "$MESON_BUILDDIR" ]]; then
echo "\$MESON_BUILDDIR undefined."
exit 1
@@ -20,6 +49,10 @@ if [[ -z "$CI_JOB_ID" ]] || [[ -z "$CI_JOB_NAME" ]]; then
echo " CI_JOB_NAME=$CI_JOB_NAME"
fi
+if [[ -n "$FDO_CI_CONCURRENT" ]]; then
+ NINJA_ARGS="-j$FDO_CI_CONCURRENT $NINJA_ARGS"
+ export MESON_TESTTHREADS="$FDO_CI_CONCURRENT"
+fi
echo "*************************************************"
echo "builddir: $MESON_BUILDDIR"
@@ -30,20 +63,16 @@ echo "*************************************************"
set -e
-rm -rf "$MESON_BUILDDIR"
-meson "$MESON_BUILDDIR" $MESON_ARGS
+if [[ -z "$MESON_SKIP_SETUP" ]]; then
+ rm -rf "$MESON_BUILDDIR"
+ meson setup "$MESON_BUILDDIR" $MESON_ARGS
+fi
meson configure "$MESON_BUILDDIR"
-ninja -C "$MESON_BUILDDIR" $NINJA_ARGS
-if [[ ! -z "$SKIP_MESON_TEST" ]]; then
- echo "Skipping meson test"
- exit 0
+if [[ -z "$MESON_SKIP_BUILD" ]]; then
+ ninja -C "$MESON_BUILDDIR" $NINJA_ARGS
fi
-# we still want to generate the reports, even if meson test fails
-set +e
-meson test -C "$MESON_BUILDDIR" $MESON_TEST_ARGS --print-errorlogs
-exit_code=$?
-set -e
-
-exit $exit_code
+if [[ -n "$MESON_RUN_TEST" ]]; then
+ meson test -C "$MESON_BUILDDIR" $MESON_TEST_ARGS --print-errorlogs
+fi