forked from mickael-kerjean/filestash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
141 lines (126 loc) · 3.3 KB
/
.drone.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
kind: pipeline
name: default
workspace:
base: /go
path: src/github.com/mickael-kerjean.me/filestash
clone:
depth: 1
steps:
- name: build_prepare
image: alpine
depends_on: [ clone ]
commands:
- mkdir -p ./dist/data/
- cp -R config dist/data/config
- name: build_go
image: golang:1.11-stretch
depends_on: [ clone ]
environment:
CGO_LDFLAGS_ALLOW: '-fopenmp'
commands:
- mkdir ../plugin/
- mv server/plugin/plg_* ../plugin
- go get -t ./server/...
- go build -ldflags "-X github.com/mickael-kerjean/filestash/server/common.BUILD_NUMBER=`date -u +%Y%m%d`" -o dist/filestash server/main.go
- name: build_js
image: node:8-alpine
depends_on: [ clone ]
commands:
- npm install > /dev/null 2>&1
- NODE_ENV=production npm run build
- name: test_prepare
image: alpine
depends_on: [ clone ]
environment:
PASSWORD:
from_secret: GIT_PASSWORD
commands:
- apk --no-cache add git > /dev/null 2>&1
- cd ../ && git clone "https://readonly:$PASSWORD@git.kerjean.me/filestash/test.git"
- chmod -R 777 ./test/
- chmod -R 777 ./filestash/dist/data
- name: test_go
image: golang:1.11-alpine
depends_on: [ test_prepare ]
commands:
- apk --no-cache add git gcc libc-dev > /dev/null 2>&1
- go get -t ../test/unit_go/...
- go test -v ../test/unit_go/...
- name: test_js
image: node:8-alpine
depends_on: [ test_prepare ]
commands:
- cd ../test/unit_js
- npm install > /dev/null 2>&1
- npm test
- name: test_e2e
image: machines/puppeteer
depends_on: [ build_prepare, build_js, build_go ]
environment:
ADMIN_PASSWORD: $$2a$$10$$9OFbPZV4lYpYjU5eUi91o.kgeMyCuW11j878YBRri3gBwccq2lSFy
APP_URL: http://127.0.0.1:8334
CI: true
commands:
- ./dist/filestash &
- cd ../test/e2e
- npm install > /dev/null 2>&1
- node servers/webdav.js &
- npm test
- name: release
image: plugins/docker
depends_on: [ build_prepare, build_go, build_js, test_prepare, test_go, test_js ]
when:
branch: master
settings:
dockerfile: ./docker/prod/Dockerfile
repo: machines/filestash
username:
from_secret: DOCKER_USERNAME
password:
from_secret: DOCKER_PASSWORD
tags: latest
- name: deploy
image: appleboy/drone-ssh
depends_on: [ release ]
when:
branch: master
settings:
command_timeout: 5m
host: hal.kerjean.me
user:
from_secret: SSH_USERNAME
password:
from_secret: SSH_PASSWORD
port: 22
script:
- cd /app/filestash/
- docker pull machines/filestash:latest
- docker-compose up -d
- name: report
image: plugins/irc
depends_on: [ deploy ]
settings:
prefix: build
nick: blipblip
channel: filestash
host: chat.freenode.net
port: 6667
template: >
{{#success build.status}}
Build success: https://github.com/mickael-kerjean/filestash/commit/{{build.commit}}
{{else}}
Build failure: er}} https://github.com/mickael-kerjean/filestash/commit/{{build.commit}}
{{/success}}
# - name: deployement_state
# image: machines/puppeteer
# depends_on: [ deploy ]
# environment:
# APP_URL: https://demo.filestash.app
# GITHUB_TOKEN:
# from_secret: GITHUB_TOKEN
# CI: true
# commands:
# - curl -sD - -o /dev/null https://demo.filestash.app/about
# - cd ../test/e2e
# - npm install > /dev/null 2>&1
# - npm run state