summaryrefslogtreecommitdiffstats
path: root/.github/workflows/cibuild.sh
blob: 55ddd1772e1763f103ccc9c2ae2da2588b196a34 (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
#!/bin/bash

PHASES=(${@:-CONFIGURE MAKE CHECK})
COMPILER="${COMPILER:?}"
COMPILER_VERSION="${COMPILER_VERSION}"
CFLAGS=(-O1 -g)
CXXFLAGS=(-O1 -g)

CC="gcc${COMPILER_VERSION:+-$COMPILER_VERSION}"
CXX="g++${COMPILER_VERSION:+-$COMPILER_VERSION}"

set -ex

for phase in "${PHASES[@]}"; do
	case $phase in
	CONFIGURE)
		opts=(
			--enable-libargon2
		)

		sudo -E git clean -xdf

		./autogen.sh
		CC="$CC" CXX="$CXX" CFLAGS="${CFLAGS[@]}" CXXFLAGS="${CXXFLAGS[@]}" ./configure "${opts[@]}"
		;;
	MAKE)
		make -j
		make -j -C tests check-programs
		;;
	CHECK)
		make check
		;;

	*)
		echo >&2 "Unknown phase '$phase'"
		exit 1
	esac
done