-
Notifications
You must be signed in to change notification settings - Fork 2
/
wercker.yml
125 lines (104 loc) · 2.85 KB
/
wercker.yml
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
box: golang
build:
steps:
- script:
name: set API_VERSION
code: export API_VERSION="v0.2.10"
- script:
name: install lirc
code: |
apt -qq update
apt -qq install autoconf libtool libxml2-dev xsltproc python3
cd /tmp
git clone git://git.code.sf.net/p/lirc/git lirc
cd lirc
git checkout lirc-0_9_2a
./autogen.sh
./configure
make
make install
ldconfig
- script:
name: print version
code: |
go version
lircd -v
echo "API_VERSION=$API_VERSION"
- script:
name: launch lircd
code: |
export LIRC_RUN_PATH=$WERCKER_SOURCE_DIR/lirc/test
cp $LIRC_RUN_PATH/lircd.conf /usr/local/etc/lirc/lircd.conf.d/lighting.conf
mkdir -p /var/run/lirc
lircd --logfile=$LIRC_RUN_PATH/lirc.log \
--allow-simulate \
--driver simsend
- setup-go-workspace:
package-dir: github.com/ww24/lirc-web-api
- script:
name: glide install
code: |
curl https://glide.sh/get | sh
glide install
- script:
name: go get
code: |
go get -u github.com/mitchellh/gox
- script:
name: go test
code: |
go test -v $(glide nv)
- script:
name: show lircd log
code: |
cat $LIRC_RUN_PATH/lirc.log
- script:
name: cross compile
code: |
target="darwin/amd64 linux/386 linux/amd64 linux/arm"
mkdir -p build
gox \
-osarch="$target" \
-tags="prod" \
-ldflags="-X main.version=$API_VERSION" \
-output="build/api_{{.OS}}_{{.Arch}}"
- script:
name: create tarball
code: |
cd build
mv ../frontend .
for t in $(echo $target); do
osarch=($(echo $t | tr '/' ' '))
ext=
tarball="$WERCKER_OUTPUT_DIR/api_${osarch[0]}_${osarch[1]}.tar.gz"
if [ "${osarch[0]}" = "windows" ]; then
ext=".exe"
fi
tar czvf $tarball "api_${osarch[0]}_${osarch[1]}${ext}" frontend
done
- script:
name: copy to output
code: |
cp "$WERCKER_SOURCE_DIR/build/api_linux_386" "$WERCKER_OUTPUT_DIR"
cp "$WERCKER_SOURCE_DIR/README.md" "$WERCKER_OUTPUT_DIR"
- shellcheck:
files: install.sh uninstall.sh
deploy:
steps:
- install-packages:
packages: lirc file
- github-create-release:
token: $GITHUB_TOKEN
tag: $(./api_linux_386 -v)
- github-upload-asset:
token: $GITHUB_TOKEN
file: api_darwin_amd64.tar.gz
- github-upload-asset:
token: $GITHUB_TOKEN
file: api_linux_386.tar.gz
- github-upload-asset:
token: $GITHUB_TOKEN
file: api_linux_amd64.tar.gz
- github-upload-asset:
token: $GITHUB_TOKEN
file: api_linux_arm.tar.gz