summaryrefslogtreecommitdiff
path: root/.github/workflows/builds.sh
blob: 24759fc8273c48b9dbbf424094bae1eb0df0f260 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/bash

set -e
set -o pipefail

CPUS=$(grep processor /proc/cpuinfo | wc -l)

# Use grouped output messages
infobegin() {
	echo "::group::${1}"
}
infoend() {
	echo "::endgroup::"
}

# Run meson first, then run autotools
# Because meson dist requires a clean git workspace
# Autotools will modify some files (such as po, etc.), making them dirty.
if [ -f meson.build ]; then

	infobegin "Configure (meson)"
	meson setup _build --prefix=/usr
	infoend

	infobegin "Build (meson)"
	meson compile -C _build
	infoend

	infobegin "Test (meson)"
	ninja -C _build test
	infoend

	infobegin "Dist (meson)"
	# Git safedirectory stop ninja dist
	# https://github.com/git/git/commit/8959555cee7ec045958f9b6dd62e541affb7e7d9
	# https://git-scm.com/docs/git-config/2.35.2#Documentation/git-config.txt-safedirectory
	git config --global --add safe.directory ${PWD}
	ninja -C _build dist
	infoend
fi

if [ -f autogen.sh ]; then
	infobegin "Configure (autotools)"
	NOCONFIGURE=1 ./autogen.sh
	./configure --prefix=/usr --enable-compile-warnings=maximum || {
		cat config.log
		exit 1
	}
	infoend

	infobegin "Build (autotools)"
	make -j ${CPUS}
	infoend

	infobegin "Check (autotools)"
	make -j ${CPUS} check || {
		find -name test-suite.log -exec cat {} \;
		exit 1
	}
	infoend

	infobegin "Distcheck (autotools)"
	make -j ${CPUS} distcheck
	infoend
fi