forked from gravitational/webapps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
97 lines (87 loc) · 2.31 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
---
kind: pipeline
type: kubernetes
name: test-and-build
trigger:
branch:
- master
- branch/*
event:
include:
- push
workspace:
path: /tmp
clone:
disable: true
steps:
- name: Check out code
image: docker:git
environment:
GITHUB_PRIVATE_KEY:
from_secret: GITHUB_PRIVATE_KEY
commands:
- mkdir -p /tmp/webassets
- cd /tmp/webassets
- git init && git remote add origin ${DRONE_REMOTE_URL}
- |
# handle pull requests
if [ "${DRONE_BUILD_EVENT}" = "pull_request" ]; then
git fetch origin +refs/heads/${DRONE_COMMIT_BRANCH}:
git checkout ${DRONE_COMMIT_BRANCH}
git fetch origin ${DRONE_COMMIT_REF}:
git merge ${DRONE_COMMIT}
# handle tags
elif [ "${DRONE_BUILD_EVENT}" = "tag" ]; then
git fetch origin +refs/tags/${DRONE_TAG}:
git checkout -qf FETCH_HEAD
# handle pushes/other events
else
if [ "${DRONE_COMMIT_BRANCH}" = "" ]; then
git fetch origin
git checkout -qf ${DRONE_COMMIT_SHA}
else
git fetch origin +refs/heads/${DRONE_COMMIT_BRANCH}:
git checkout ${DRONE_COMMIT} -b ${DRONE_COMMIT_BRANCH}
fi
fi
# check out submodules
- mkdir -m 0700 /root/.ssh && echo "$GITHUB_PRIVATE_KEY" > /root/.ssh/id_rsa && chmod 600 /root/.ssh/id_rsa
- ssh-keyscan -H github.com > /root/.ssh/known_hosts 2>/dev/null && chmod 600 /root/.ssh/known_hosts
- git submodule update --init --recursive
- rm -f /root/.ssh/id_rsa
- name: Run tests
image: docker:git
volumes:
- name: dockersock
path: /var/run
commands:
# install make
- apk add --no-cache make
# run tests
- cd /tmp/webassets
- make clean test
- name: Build artifacts
image: docker:git
volumes:
- name: dockersock
path: /var/run
commands:
# install make
- apk add --no-cache make
# build artifacts
- cd /tmp/webassets
- make build
services:
- name: Start Docker
image: docker:dind
privileged: true
volumes:
- name: dockersock
path: /var/run
volumes:
- name: dockersock
temp: {}
---
kind: signature
hmac: 11cc48c9df3830e257866c94bca190496d6a402941641553981ff6269b8667ab
...