mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-26 15:40:06 +01:00
gitlab CI: move the build instructions into a bash file
Extending/debugging scripts in the gitlab CI directly is a pain, the turnaround cycle is terrible. Let's move this into a shellscript that we can just call directly. Bonus side-effect: if we wanted to extend the script: set somewhere, this is now much easier to override. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
3f051ca9d8
commit
142399f8a3
2 changed files with 54 additions and 19 deletions
|
|
@ -122,24 +122,6 @@ variables:
|
|||
reports:
|
||||
junit: $MESON_BUILDDIR/junit-*.xml
|
||||
|
||||
# The default build instructions
|
||||
.default_build:
|
||||
script:
|
||||
- rm -rf "$MESON_BUILDDIR"
|
||||
- meson "$MESON_BUILDDIR" $MESON_ARGS
|
||||
- meson configure "$MESON_BUILDDIR"
|
||||
- ninja -C "$MESON_BUILDDIR" $NINJA_ARGS
|
||||
- if test x"$MESON_TEST_ARGS" != "x"; then
|
||||
echo "Running meson test -C \"$MESON_BUILDDIR\" $MESON_TEST_ARGS";
|
||||
meson test -C "$MESON_BUILDDIR" $MESON_TEST_ARGS || touch .failed;
|
||||
./.gitlab-ci/meson-junit-report.py
|
||||
--project-name=libinput
|
||||
--job-id="$CI_JOB_ID"
|
||||
--output="$MESON_BUILDDIR/junit-$CI_JOB_NAME-report.xml"
|
||||
"$MESON_BUILDDIR/meson-logs/testlog.json";
|
||||
test -f .failed && exit 1;
|
||||
fi
|
||||
|
||||
#################################################################
|
||||
# #
|
||||
# prep stage #
|
||||
|
|
@ -466,8 +448,9 @@ freebsd:11.2@container-clean:
|
|||
extends:
|
||||
- .policy
|
||||
- .default_artifacts
|
||||
- .default_build
|
||||
stage: build
|
||||
script:
|
||||
- .gitlab-ci/meson-build.sh
|
||||
dependencies: []
|
||||
|
||||
#
|
||||
|
|
|
|||
52
.gitlab-ci/meson-build.sh
Executable file
52
.gitlab-ci/meson-build.sh
Executable file
|
|
@ -0,0 +1,52 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ -z "$MESON_BUILDDIR" ]]; then
|
||||
echo "\$MESON_BUILDDIR undefined."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# emulate a few gitlab variables to make it easier to
|
||||
# run and debug locally.
|
||||
if [[ -z "$CI_JOB_ID" ]] || [[ -z "$CI_JOB_NAME" ]]; then
|
||||
echo "Missing \$CI_JOB_ID or \$CI_JOB_NAME".
|
||||
CI_JOB_ID=$(date +%s)
|
||||
CI_JOB_NAME='libinput-job-local'
|
||||
echo "Simulating gitlab environment: "
|
||||
echo " CI_JOB_ID=$CI_JOB_ID"
|
||||
echo " CI_JOB_NAME=$CI_JOB_NAME"
|
||||
fi
|
||||
|
||||
|
||||
echo "*************************************************"
|
||||
echo "builddir: $MESON_BUILDDIR"
|
||||
echo "meson args: $MESON_ARGS"
|
||||
echo "ninja args: $NINJA_ARGS"
|
||||
echo "meson test args: $MESON_TEST_ARGS"
|
||||
echo "*************************************************"
|
||||
|
||||
set -e
|
||||
|
||||
rm -rf "$MESON_BUILDDIR"
|
||||
meson "$MESON_BUILDDIR" $MESON_ARGS
|
||||
meson configure "$MESON_BUILDDIR"
|
||||
ninja -C "$MESON_BUILDDIR" $NINJA_ARGS
|
||||
|
||||
if [[ -z "$MESON_TEST_ARGS" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# we still want to generate the reports, even if meson test fails
|
||||
set +e
|
||||
meson test -C "$MESON_BUILDDIR" $MESON_TEST_ARGS
|
||||
exit_code=$?
|
||||
set -e
|
||||
|
||||
# We need the glob for the testlog so that it picks up those suffixed by a
|
||||
# suite (e.g. testlog-valgrind.json)
|
||||
./.gitlab-ci/meson-junit-report.py \
|
||||
--project-name=libinput \
|
||||
--job-id="$CI_JOB_ID" \
|
||||
--output="$MESON_BUILDDIR/junit-$CI_JOB_NAME-report.xml" \
|
||||
"$MESON_BUILDDIR"/meson-logs/testlog*.json; \
|
||||
|
||||
exit $exit_code
|
||||
Loading…
Add table
Reference in a new issue