-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
119 lines (111 loc) · 2.91 KB
/
.gitlab-ci.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
# Source it from https://hub.docker.com/r/syso/easylab-env/
image: syso/easylab-env
stages:
- build
- test
- release
- staging
cache:
paths:
- gopath/
- node_modules/
- .glide/
- .npm/
build:
stage: build
before_script:
- echo Build reference is $CI_BUILD_REF
- echo CI entry directory is $CI_PROJECT_DIR
script:
- export GOPATH=$CI_PROJECT_DIR/gopath/
- export GOROOT=/goroot
- npm config set cache $/.npm --global
- mkdir -p $GOPATH/src/github.com/FabLabBerlin/
- ln -sfn $PWD $GOPATH/src/github.com/FabLabBerlin/localmachines
- cd $GOPATH/src/github.com/FabLabBerlin/localmachines
- glide install
- cd clients/machines
- npm install
- cd $GOPATH/src/github.com/FabLabBerlin/localmachines
- cd clients/admin
- npm install
- bower install --allow-root
artifacts:
paths:
- gopath/
test:
stage: test
variables:
MYSQL_DATABASE: fabsmith_test
MYSQL_USER: user
MYSQL_PASSWORD: pass
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
services:
- mysql:latest
artifacts:
paths:
- ./*.deb
script:
- export GOPATH=$CI_PROJECT_DIR/gopath/
- /prepare-env.sh
- cd $GOPATH/src/github.com/FabLabBerlin/localmachines
- ./testall
release-amd64:
stage: release
cache:
paths:
- gopath/
- node_modules/
- .glide/
- .npm/
artifacts:
paths:
- ./*.deb
script:
- export GOPATH=$CI_PROJECT_DIR/gopath/
- /prepare-env.sh
- cd $GOPATH/src/github.com/FabLabBerlin/localmachines
- ./scripts/build_deb amd64
release-arm:
stage: release
artifacts:
paths:
- ./*.deb
script:
- export GOPATH=$CI_PROJECT_DIR/gopath/
- /prepare-env.sh
- cd $GOPATH/src/github.com/FabLabBerlin/localmachines
- ./scripts/build_deb arm
release-mips:
stage: release
artifacts:
paths:
- ./*.deb
script:
- export GOPATH=$CI_PROJECT_DIR/gopath/
- /prepare-env.sh
- ./scripts/build_deb mips
deploy:
stage: staging
image: ubuntu:14.04
variables:
MYSQL_DATABASE: fabsmith
MYSQL_USER: user
MYSQL_PASSWORD: pass
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
services:
- mysql:latest
script:
- export GOPATH=$CI_PROJECT_DIR/gopath/
- apt-get update && apt-get install -y daemontools daemontools-run mysql-client
- su -c 'exec /usr/bin/svscanboot &'
- dpkg -i localmachines_*.amd64.deb
- cp conf/app.example.conf conf/app.conf
- sed -e "s/mysqlhost = localhost/mysqlhost = mysql/g" /opt/localmachines/conf/app.example.conf > /opt/localmachines/conf/app.conf
- mysql --user=root --host=mysql --password="$MYSQL_ROOT_PASSWORD" "$MYSQL_DATABASE" < fabsmith_template.sql
- bee migrate -conn="$MYSQL_USER:$MYSQL_PASSWORD@tcp(mysql:3306)/$MYSQL_DATABASE"
- svc -d /etc/service/localmachines
- svc -u /etc/service/localmachines
- ps uwax|grep localmachines
- tail -n 100 /opt/localmachines/server.log
when: manual