ci: wire up Meson builds
Wire up CI builds for both GitLab and GitHub that use the Meson build system. While the setup is mostly trivial, one gotcha is the test output directory used to be in "t/", but now it is contained in the build directory. To unify the logic across Makefile- and Meson-based builds we explicitly set up the `TEST_OUTPUT_DIRECTORY` variable so that it is the same for both build systems. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
Dec 13, 2024 at 11:41 UTC
eab5dbab92fa60298aa4a1952fcbc6cae824d939
6 files changed
+48
-9
.github/workflows/main.yml
+7
@@ -286,6 +286,9 @@ jobs:
286
- jobname: osx-gcc
287
cc: gcc-13
288
pool: macos-13
289
+ - jobname: osx-meson
290
+ cc: clang
291
+ pool: macos-13
292
- jobname: linux-gcc-default
293
cc: gcc
294
pool: ubuntu-latest
@@ -298,11 +301,15 @@ jobs:
301
- jobname: linux-asan-ubsan
302
cc: clang
303
pool: ubuntu-latest
304
+ - jobname: linux-meson
305
+ cc: gcc
306
+ pool: ubuntu-latest
307
env:
308
CC: ${{matrix.vector.cc}}
309
CC_PACKAGE: ${{matrix.vector.cc_package}}
310
jobname: ${{matrix.vector.jobname}}
311
distro: ${{matrix.vector.pool}}
312
+ TEST_OUTPUT_DIRECTORY: ${{github.workspace}}/t
313
runs-on: ${{matrix.vector.pool}}
314
steps:
315
- uses: actions/checkout@v4
.gitlab-ci.yml
+8
@@ -20,6 +20,7 @@ test:linux:
20
- saas-linux-medium-amd64
21
variables:
22
CUSTOM_PATH: "/custom"
23
+ TEST_OUTPUT_DIRECTORY: "/tmp/test-output"
24
before_script:
25
- ./ci/install-dependencies.sh
26
script:
@@ -31,6 +32,7 @@ test:linux:
32
if test "$CI_JOB_STATUS" != 'success'
33
then
34
sudo --preserve-env --set-home --user=builder ./ci/print-test-failures.sh
35
+ mv "$TEST_OUTPUT_DIRECTORY"/failed-test-artifacts t/
36
fi
37
parallel:
38
matrix:
@@ -67,6 +69,9 @@ test:linux:
69
image: fedora:latest
70
- jobname: linux-musl
71
image: alpine:latest
72
+ - jobname: linux-meson
73
+ image: ubuntu:latest
74
+ CC: gcc
75
artifacts:
76
paths:
77
- t/failed-test-artifacts
@@ -104,6 +109,9 @@ test:osx:
109
- jobname: osx-reftable
110
image: macos-13-xcode-14
111
CC: clang
112
+ - jobname: osx-meson
113
+ image: macos-14-xcode-15
114
+ CC: clang
115
artifacts:
116
paths:
117
- t/failed-test-artifacts
ci/install-dependencies.sh
+7
@@ -58,6 +58,7 @@ ubuntu-*|ubuntu32-*|debian-*)
58
make libssl-dev libcurl4-openssl-dev libexpat-dev wget sudo default-jre \
59
tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl \
60
libemail-valid-perl libio-pty-perl libio-socket-ssl-perl libnet-smtp-ssl-perl libdbd-sqlite3-perl libcgi-pm-perl \
61
+ libpcre2-dev meson ninja-build pkg-config \
62
${CC_PACKAGE:-${CC:-gcc}} $PYTHON_PACKAGE
63
64
case "$distro" in
@@ -90,6 +91,12 @@ macos-*)
91
sudo xattr -d com.apple.quarantine "$CUSTOM_PATH/p4" "$CUSTOM_PATH/p4d" 2>/dev/null || true
92
rm helix-core-server.tgz
93
94
+ case "$jobname" in
95
+ osx-meson)
96
+ brew install meson ninja pcre2
97
+ ;;
98
+ esac
99
+
100
if test -n "$CC_PACKAGE"
101
then
102
BREW_PACKAGE=${CC_PACKAGE/-/@}
ci/lib.sh
+1
-1
@@ -236,7 +236,7 @@ then
236
CC="${CC_PACKAGE:-${CC:-gcc}}"
237
DONT_SKIP_TAGS=t
238
handle_failed_tests () {
239
- echo "FAILED_TEST_ARTIFACTS=t/failed-test-artifacts" >>$GITHUB_ENV
239
+ echo "FAILED_TEST_ARTIFACTS=${TEST_OUTPUT_DIRECTORY:-t}/failed-test-artifacts" >>$GITHUB_ENV
240
create_failed_test_artifacts
241
return 1
242
}
ci/print-test-failures.sh
+1
-1
@@ -46,7 +46,7 @@ do
46
;;
47
github-actions)
48
mkdir -p failed-test-artifacts
49
- echo "FAILED_TEST_ARTIFACTS=t/failed-test-artifacts" >>$GITHUB_ENV
49
+ echo "FAILED_TEST_ARTIFACTS=${TEST_OUTPUT_DIRECTORY:t}/failed-test-artifacts" >>$GITHUB_ENV
50
cp "${TEST_EXIT%.exit}.out" failed-test-artifacts/
51
tar czf failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir"
52
continue
ci/run-build-and-tests.sh
+24
-7
@@ -48,12 +48,29 @@ pedantic)
48
;;
49
esac
50
51
-group Build make
52
-if test -n "$run_tests"
53
-then
54
- group "Run tests" make test ||
55
- handle_failed_tests
56
-fi
57
-check_unignored_build_artifacts
51
+case "$jobname" in
52
+*-meson)
53
+ group "Configure" meson setup build . \
54
+ --warnlevel 2 --werror \
55
+ --wrap-mode nofallback
56
+ group "Build" meson compile -C build --
57
+ if test -n "$run_tests"
58
+ then
59
+ group "Run tests" meson test -C build --print-errorlogs --test-args="$GIT_TEST_OPTS" || (
60
+ ./t/aggregate-results.sh "${TEST_OUTPUT_DIRECTORY:-t}/test-results"
61
+ handle_failed_tests
62
+ )
63
+ fi
64
+ ;;
65
+*)
66
+ group Build make
67
+ if test -n "$run_tests"
68
+ then
69
+ group "Run tests" make test ||
70
+ handle_failed_tests
71
+ fi
72
+ ;;
73
+esac
74
75
+check_unignored_build_artifacts
76
save_good_tree