-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
167 lines (151 loc) · 4.22 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
kind: pipeline
name: default
workspace:
base: /go
path: src/github.com/mickael-kerjean.me/filestash
clone:
depth: 1
steps:
- name: build_prepare
image: alpine:latest
depends_on: [ clone ]
commands:
- mkdir -p ./dist/data/state/
- cp -R config dist/data/state/config
- name: build_frontend
image: node:12-alpine
depends_on: [ build_prepare ]
commands:
- apk add make git > /dev/null
- npm install --silent
- make build_frontend
- name: build_backend
image: golang:1.12-stretch
depends_on: [ build_prepare ]
environment:
CGO_LDFLAGS_ALLOW: '-fopenmp'
commands:
- apt-get update > /dev/null && apt-get install -y libglib2.0-dev curl make > /dev/null
- make build_init
- find server/plugin/plg_* -type f -name '*.a' -exec mv {} /usr/local/lib/ \;
- go get -t ./server/...
- make build_backend
- timeout 1 ./dist/filestash || true
- name: test_prepare
image: alpine:latest
depends_on: [ clone ]
environment:
PASSWORD:
from_secret: GIT_PASSWORD
commands:
- apk add git > /dev/null
- chmod -R o+r+w+x ./dist/data
- cd ../ && git clone "https://readonly:$PASSWORD@git.kerjean.me/filestash/test.git"
- chmod -R 777 ./test/
- name: test_frontend
image: node:8-alpine
depends_on: [ test_prepare, build_frontend ]
commands:
- cd ../test/unit_js
- npm install --silent
- npm test
- name: test_backend
image: golang:1.12-alpine
depends_on: [ test_prepare, build_backend ]
commands:
- apk add git gcc libc-dev poppler-utils > /dev/null
- cp ../test/assets/* /tmp/
- go get -t ../test/unit_go/...
- go test -v --tags "fts5" ../test/unit_go/...
- name: test_e2e
image: machines/puppeteer
depends_on: [ build_frontend, build_backend ]
environment:
ADMIN_PASSWORD: $$2a$$10$$9OFbPZV4lYpYjU5eUi91o.kgeMyCuW11j878YBRri3gBwccq2lSFy
APP_URL: http://127.0.0.1:8334
CI: true
commands:
- ./dist/filestash > /dev/null &
- cd ../test/e2e
- npm install > /dev/null
- node servers/webdav.js > /dev/null &
- npm test
- name: release_prepare
image: debian:stable-slim
depends_on: [ test_e2e ]
environment:
GPG_PRIVATE:
from_secret: GPG_PRIVATE
GPG_PASSPHRASE:
from_secret: GPG_PASSPHRASE
commands:
- cp -R config/* ./dist/data/state/config/
- chmod -R o-r-w-x- ./dist/
- apt-get update > /dev/null && apt-get install -y gnupg1 curl > /dev/null
- mv dist filestash
- tar -cf filestash_linux-amd64.tar ./filestash
- curl -s "https://downloads.filestash.app/gpg?private=$GPG_PASSPHRASE" > /tmp/private.key
- echo $GPG_PASSPHRASE | gpg1 --import /tmp/private.key
- echo $GPG_PASSPHRASE | gpg1 --sign --passphrase-fd 0 --default-key mickael@kerjean.me --no-tty filestash_linux-amd64.tar
- name: release_publish
image: appleboy/drone-scp
depends_on: [ release_prepare ]
when:
branch: master
settings:
command_timeout: 30m
host: hal.kerjean.me
user:
from_secret: SSH_USERNAME
password:
from_secret: SSH_PASSWORD
source: filestash_linux-amd64.tar.gpg
target: /app/pages/data/projects/filestash/downloads/latest/
- name: release_docker
image: plugins/docker
depends_on: [ release_publish ]
when:
branch: master
settings:
dockerfile: ./docker/Dockerfile
repo: machines/filestash
username:
from_secret: DOCKER_USERNAME
password:
from_secret: DOCKER_PASSWORD
tags: latest
- name: release_deploy
image: appleboy/drone-ssh
depends_on: [ release_docker ]
when:
branch: master
settings:
command_timeout: 10m
host: hal.kerjean.me
user:
from_secret: SSH_USERNAME
password:
from_secret: SSH_PASSWORD
port: 22
script:
- cd /app/filestash/
- docker-compose pull
- docker-compose up -d --force-recreate --build
- docker image prune -f
- name: release_report
image: plugins/irc
depends_on: [ release_deploy ]
when:
branch: master
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}}