summaryrefslogtreecommitdiff
path: root/ci/build-and-verify-source-package
blob: d74bc152c970f34b93bbfbf65322b87518d5bdb6 (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
#!/bin/sh
#
# Test that it works to build from a source archive exported by "git archive"
# outside a Git repository.

set -eu

# Unset CI variable to trigger ccache user build mode.
unset CI

# Ninja builds with relative paths so that ccache can be used to cache the build
# without resorting to setting base_dir.
export CMAKE_GENERATOR=Ninja

tmp_dir=$(mktemp -d)
trap "rm -rf $tmp_dir" EXIT

git archive --prefix=ccache/ -o $tmp_dir/ccache.tar.gz HEAD
cd $tmp_dir
tar xf ccache.tar.gz
cd ccache
mkdir build
cd build
cmake ..
ninja -v
jobs=$(getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1)
ctest --output-on-failure -j $jobs