Skip to content

Commit eab5dba

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9faf396 commit eab5dba

File tree

6 files changed

+48
-9
lines changed

6 files changed

+48
-9
lines changed

.github/workflows/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ jobs:
286286
- jobname: osx-gcc
287287
cc: gcc-13
288288
pool: macos-13
289+
- jobname: osx-meson
290+
cc: clang
291+
pool: macos-13
289292
- jobname: linux-gcc-default
290293
cc: gcc
291294
pool: ubuntu-latest
@@ -298,11 +301,15 @@ jobs:
298301
- jobname: linux-asan-ubsan
299302
cc: clang
300303
pool: ubuntu-latest
304+
- jobname: linux-meson
305+
cc: gcc
306+
pool: ubuntu-latest
301307
env:
302308
CC: ${{matrix.vector.cc}}
303309
CC_PACKAGE: ${{matrix.vector.cc_package}}
304310
jobname: ${{matrix.vector.jobname}}
305311
distro: ${{matrix.vector.pool}}
312+
TEST_OUTPUT_DIRECTORY: ${{github.workspace}}/t
306313
runs-on: ${{matrix.vector.pool}}
307314
steps:
308315
- uses: actions/checkout@v4

.gitlab-ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ test:linux:
2020
- saas-linux-medium-amd64
2121
variables:
2222
CUSTOM_PATH: "/custom"
23+
TEST_OUTPUT_DIRECTORY: "/tmp/test-output"
2324
before_script:
2425
- ./ci/install-dependencies.sh
2526
script:
@@ -31,6 +32,7 @@ test:linux:
3132
if test "$CI_JOB_STATUS" != 'success'
3233
then
3334
sudo --preserve-env --set-home --user=builder ./ci/print-test-failures.sh
35+
mv "$TEST_OUTPUT_DIRECTORY"/failed-test-artifacts t/
3436
fi
3537
parallel:
3638
matrix:
@@ -67,6 +69,9 @@ test:linux:
6769
image: fedora:latest
6870
- jobname: linux-musl
6971
image: alpine:latest
72+
- jobname: linux-meson
73+
image: ubuntu:latest
74+
CC: gcc
7075
artifacts:
7176
paths:
7277
- t/failed-test-artifacts
@@ -104,6 +109,9 @@ test:osx:
104109
- jobname: osx-reftable
105110
image: macos-13-xcode-14
106111
CC: clang
112+
- jobname: osx-meson
113+
image: macos-14-xcode-15
114+
CC: clang
107115
artifacts:
108116
paths:
109117
- t/failed-test-artifacts

ci/install-dependencies.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ ubuntu-*|ubuntu32-*|debian-*)
5858
make libssl-dev libcurl4-openssl-dev libexpat-dev wget sudo default-jre \
5959
tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl \
6060
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 \
6162
${CC_PACKAGE:-${CC:-gcc}} $PYTHON_PACKAGE
6263

6364
case "$distro" in
@@ -90,6 +91,12 @@ macos-*)
9091
sudo xattr -d com.apple.quarantine "$CUSTOM_PATH/p4" "$CUSTOM_PATH/p4d" 2>/dev/null || true
9192
rm helix-core-server.tgz
9293

94+
case "$jobname" in
95+
osx-meson)
96+
brew install meson ninja pcre2
97+
;;
98+
esac
99+
93100
if test -n "$CC_PACKAGE"
94101
then
95102
BREW_PACKAGE=${CC_PACKAGE/-/@}

ci/lib.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ then
236236
CC="${CC_PACKAGE:-${CC:-gcc}}"
237237
DONT_SKIP_TAGS=t
238238
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
240240
create_failed_test_artifacts
241241
return 1
242242
}

ci/print-test-failures.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ do
4646
;;
4747
github-actions)
4848
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
5050
cp "${TEST_EXIT%.exit}.out" failed-test-artifacts/
5151
tar czf failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir"
5252
continue

ci/run-build-and-tests.sh

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,29 @@ pedantic)
4848
;;
4949
esac
5050

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
5874

75+
check_unignored_build_artifacts
5976
save_good_tree

0 commit comments

Comments
 (0)