-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·61 lines (47 loc) · 1.64 KB
/
build.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
#!/bin/bash
set -euo pipefail
#set -x
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
version=$(git describe --abbrev)
export LUA_PATH='./?.lua;./?.lc;'"$script_dir"'/lib/?.lua;'
function setupWorkspaceForBuild {
echo Change directory to linuxinstall/
echo then: ansible-playbook -i localhost, --tags development setup-workstation.yaml
}
function buildDocs {
cp README.asciidoc /tmp/README.asciidoc
sed -i "s;@@@VERSION@@@;${version};" /tmp/README.asciidoc
sed -i "s;@@@DATE@@@;$(date +%d.%m.%Y);" /tmp/README.asciidoc
asciidoc /tmp/README.asciidoc && mv /tmp/README.html doc
}
args=${1:-bin}
if [[ "${args}" == "depends" ]]
then
setupWorkspaceForBuild
exit
fi
if [[ "${args}" == "doc" ]]
then
buildDocs
exit
fi
go build -o goyamp -ldflags "-X main.Version=${version}"
(
cd test
go test -coverprofile=../coverage.out -coverpkg ./../internal ./ -args "$*"
)
if [[ "${args}" == "coverage" ]]
then
go tool cover -html=coverage.out
fi
GOOS=windows GOARCH=amd64 go build -o goyamp.exe -ldflags "-X github.com/birchb1024/goyamp.Version=${version}"
GOOS=darwin GOARCH=amd64 go build -o goyamp_mac -ldflags "-X github.com/birchb1024/goyamp.Version=${version}"
GOOS=linux GOARCH=arm GOARM=7 go build -o goyamp_arm7 -ldflags "-X github.com/birchb1024/goyamp.Version=${version}"
GOOS=linux GOARCH=arm GOARM=6 go build -o goyamp_arm6 -ldflags "-X github.com/birchb1024/goyamp.Version=${version}"
if [[ "${args}" == "package" ]]
then
mkdir -p pkg
buildDocs
tar zcf pkg/goyamp-"${version}".tgz ./goyamp ./goyamp_mac ./goyamp.exe ./goyamp_arm6 ./goyamp_arm7 doc/README.html examples lib
exit
fi