-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathci.sh
executable file
·76 lines (60 loc) · 1.5 KB
/
ci.sh
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
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env bash
# Environment variables:
# DSTEP_COMPILER: the compiler to build with
# DSTEP_LLVM_VERSION: the version of LLVM to link with
# DSTEP_TARGET_TRIPLE: the target triple to build for
# DSTEP_RELEASE_PLATFORM: the name of the platform
set -exo pipefail
export MACOSX_DEPLOYMENT_TARGET=10.9
download() {
curl --retry 3 -fsS "$1"
}
d_compiler() {
echo "$DSTEP_COMPILER" | \
sed 's/-latest//' | \
sed 's/dmd-master/dmd-nightly/'
}
install_d_compiler() {
download https://dlang.org/d-keyring.gpg | gpg --import /dev/stdin
source $(download https://dlang.org/install.sh | bash -s "$(d_compiler)" -a)
}
configure() {
./configure --llvm-path "llvm-$DSTEP_LLVM_VERSION" --statically-link-clang
}
target_triple_arg() {
if echo "$(d_compiler)" | grep -i -q ldc; then
echo "--mtriple=$DSTEP_TARGET_TRIPLE"
else
echo "-target=$DSTEP_TARGET_TRIPLE"
fi
}
run_tests() {
DFLAGS="$(target_triple_arg)" dub test --verror
}
release() {
DFLAGS="$(target_triple_arg)" dub build -b release --verror
strip "$target_path"*
archive
}
version() {
"$target_path"* --version
}
release_name() {
echo "$app_name-$(version)-$DSTEP_RELEASE_PLATFORM"
}
archive() {
if uname | grep -i -q mingw; then
7z a "$(release_name).7z" "$target_path"*
else
tar Jcf "$(release_name).tar.xz" -C "$target_dir" "$app_name"
fi
}
app_name="dstep"
target_dir="bin"
target_path="$target_dir/$app_name"
install_d_compiler
configure
case "$1" in
'test') run_tests ;;
'release') release ;;
esac