forked from mickael-kerjean/filestash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
177 lines (162 loc) · 4.64 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
168
169
170
171
172
173
174
175
176
177
kind: pipeline
name: default
workspace:
base: /go
path: filestash
clone:
depth: 1
steps:
- name: build_prepare
image: alpine:latest
depends_on: [ clone ]
commands:
- mkdir -p ./dist/data/state/config
- cp config/config.json ./dist/data/state/config/
- mkdir -p ./filestash/data/state/config
- cp config/config.json ./filestash/data/state/config/
- name: build_frontend
image: node:13-alpine
depends_on: [ build_prepare ]
commands:
- apk add make git > /dev/null
- npm install --silent
- make build_frontend
- name: build_backend
image: golang:1.16-stretch
depends_on: [ build_prepare, build_frontend ]
environment:
CGO_LDFLAGS_ALLOW: "-fopenmp"
GO111MODULE: "on"
commands:
- apt-get update > /dev/null && apt-get install -y libglib2.0-dev curl make > /dev/null
- make build_init
- make build_backend
- timeout 1 ./dist/filestash || true
- cp dist/filestash filestash/
- chmod -R o+r+w+x ./dist/data
- name: test_prepare
image: alpine:latest
depends_on: [ clone ]
environment:
PASSWORD:
from_secret: GIT_PASSWORD
commands:
- apk add git > /dev/null
- git clone https://mickael-kerjean:[email protected]/mickael-kerjean/filestash-test test
- 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_unit
image: golang:1.16-alpine
depends_on: [ test_prepare, build_backend, build_frontend ]
environment:
GO111MODULE: "on"
commands:
- apk add git gcc libc-dev poppler-utils > /dev/null
- cp ./test/assets/* /tmp/
- rm -rf server/generator/ && rm -rf server/plugin/plg_image_light
- sed -i '/plg_image_light/d' server/plugin/index.go
- echo "==== UNIT TEST ====="
- go generate ./test/unit_go/...
- go get github.com/stretchr/testify/assert
- go mod vendor
- go test --tags "fts5" -count=1 $(go list ./server/... | grep -v "server/plugin" | grep -v "server/generator")
- name: test_e2e
image: machines/puppeteer
depends_on: [ test_prepare, build_backend, build_frontend ]
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_frontend, test_backend_unit, test_e2e ]
when:
branch:
- master
environment:
GPG_PASSPHRASE:
from_secret: GPG_PASSPHRASE
commands:
- apt-get update > /dev/null && apt-get install -y gnupg1 curl > /dev/null
- chmod -R o-r-w-x- ./filestash
- tar -cf filestash_Linux-x86_64.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 [email protected] --no-tty filestash_Linux-x86_64.tar
- name: release_publish
image: appleboy/drone-scp
depends_on: [ release_prepare ]
when:
branch:
- master
settings:
command_timeout: 30m
host: rick.kerjean.me
username:
from_secret: SSH_USERNAME
password:
from_secret: SSH_PASSWORD
source: filestash_Linux-x86_64.tar.gpg
target: /mnt/me-kerjean-pages/projects/filestash/downloads/latest/
overwrite: true
- 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
- "${DRONE_COMMIT_SHA:0:7}"
- name: deployment
image: quay.io/honestbee/drone-kubernetes
depends_on: [ release_docker ]
when:
branch:
- master
kubernetes_server: ${KUBERNETES_SERVER}
kubernetes_cert: ${KUBERNETES_CERT}
kubernetes_token: ${KUBERNETES_TOKEN}
deployment: app-filestash-demo
repo: machines/filestash
namespace: filestash
container: app-filestash-demo
tag: latest
- name: release_report
image: plugins/irc
failure: ignore
depends_on: [ release_docker ]
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}}