forked from code-dot-org/code-dot-org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.drone.yml
192 lines (175 loc) · 5.62 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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
---
kind: pipeline
type: docker
name: unit
clone:
disable: true
steps:
- name: clone
image: docker:git
commands:
- git clone --branch $DRONE_SOURCE_BRANCH --depth 200 $DRONE_GIT_HTTP_URL .
- git reset --hard $DRONE_COMMIT
# Also fetch the target branch (which is staging for pull requests.) We need this for determining which tests to run based on changed files.
- git remote set-branches --add origin $DRONE_TARGET_BRANCH
- git fetch --depth 100 origin $DRONE_TARGET_BRANCH
- name: restore-cache
image: plugins/s3-cache
settings:
endpoint: s3://code-dot-org
debug: true
pull: true
restore: true
filename: unit-tests-cache.tar
- name: unit-tests
image: wjordan/code-dot-org:2020-09-10
pull: always
volumes:
- name: rbenv
path: /home/circleci/.rbenv
- name: mysql
path: /var/lib/mysql
environment:
# Each Drone secret below must be explicitly written to locals.yml in /docker/unit_tests.sh
CLOUDFRONT_KEY_PAIR_ID:
from_secret: CLOUDFRONT_KEY_PAIR_ID
CLOUDFRONT_PRIVATE_KEY:
from_secret: CLOUDFRONT_PRIVATE_KEY
CODECOV_TOKEN:
from_secret: CODECOV_TOKEN
commands:
# If running on EC2, get hostname from ec2 metadata
- hostname=$(curl -s --max-time 3 http://169.254.169.254/latest/meta-data/public-hostname || echo $DRONE_RUNNER_HOSTNAME); echo "Running on $hostname"
- sudo chown -R circleci:circleci .
# cache is restored to source directory, so we need to copy it into the right place
- cp -rn "$(pwd)/home/circleci/.rbenv" /home/circleci || true
- rm -rf "$(pwd)/home/circleci/.rbenv"
# Depended on by CircleUtils: https://github.com/code-dot-org/code-dot-org/blob/56c4061afb55432ba8ccecc72b5b960ebd9480aa/lib/cdo/circle_utils.rb#L19
- export CIRCLE_SHA1=$DRONE_COMMIT
- EXIT_CODE=0
- /entrypoint.sh docker/unit_tests.sh || EXIT_CODE=$?
- while pgrep bash >/dev/null; do echo "found bash process; keeping container alive"; sleep 20; done
- exit $EXIT_CODE
- name: update-cache
image: plugins/s3-cache
volumes:
- name: rbenv
path: /home/circleci/.rbenv
settings:
endpoint: s3://code-dot-org
debug: true
pull: true
rebuild: true
filename: unit-tests-cache.tar
mount:
- /home/circleci/.rbenv
volumes:
- name: rbenv
temp: {}
- name: mysql
temp: {}
trigger:
branch:
- 'staging'
- 'staging-next'
event:
- pull_request
---
kind: pipeline
type: docker
name: ui
clone:
disable: true
services:
- name: ui-tests-redis
image: redis
ports:
- 6379
steps:
- name: clone
image: docker:git
commands:
- git clone --branch $DRONE_SOURCE_BRANCH --depth 200 $DRONE_GIT_HTTP_URL .
- git reset --hard $DRONE_COMMIT
# Also fetch the target branch (which is staging or staging-next for pull requests.) We need this for determining which tests to run based on changed files.
- git remote set-branches --add origin $DRONE_TARGET_BRANCH
- git fetch --depth 100 origin $DRONE_TARGET_BRANCH
# Merge so we're up-to-date with the target before running tests. We only do this for UI tests, not unit tests,
# since it disrupts Codecov pull request reports.
- git config user.name "Drone"
- git config user.email "[email protected]"
- git merge origin/$DRONE_TARGET_BRANCH
- name: restore-cache
image: plugins/s3-cache
settings:
endpoint: s3://code-dot-org
debug: true
pull: true
restore: true
- name: ui-tests
image: wjordan/code-dot-org:2020-09-10
volumes:
- name: rbenv
path: /home/circleci/.rbenv
- name: mysql
path: /var/lib/mysql
environment:
# Each Drone secret below must be explicitly written to locals.yml in /docker/ui_tests.sh
CLOUDFRONT_KEY_PAIR_ID:
from_secret: CLOUDFRONT_KEY_PAIR_ID
CLOUDFRONT_PRIVATE_KEY:
from_secret: CLOUDFRONT_PRIVATE_KEY
PROPERTIES_ENCRYPTION_KEY:
from_secret: PROPERTIES_ENCRYPTION_KEY
FIREBASE_NAME:
from_secret: FIREBASE_NAME
FIREBASE_SECRET:
from_secret: FIREBASE_SECRET
FIREBASE_SHARED_SECRET:
from_secret: FIREBASE_SHARED_SECRET
SAUCE_USERNAME:
from_secret: SAUCE_USERNAME
SAUCE_ACCESS_KEY:
from_secret: SAUCE_ACCESS_KEY
commands:
# If running on EC2, get hostname from ec2 metadata
- hostname=$(curl -s --max-time 3 http://169.254.169.254/latest/meta-data/public-hostname || echo $DRONE_RUNNER_HOSTNAME); echo "Running on $hostname"
- sudo chown -R circleci:circleci .
# cache is restored to source directory, so we need to copy it into the right place
- cp -rn "$(pwd)/home/circleci/.rbenv" /home/circleci || true
# Depended on by CircleUtils: https://github.com/code-dot-org/code-dot-org/blob/56c4061afb55432ba8ccecc72b5b960ebd9480aa/lib/cdo/circle_utils.rb#L19
- export CIRCLE_SHA1=$DRONE_COMMIT
- EXIT_CODE=0
- /entrypoint.sh docker/ui_tests.sh || EXIT_CODE=$?
- while pgrep bash >/dev/null; do echo "found bash process; keeping container alive"; sleep 20; done
- exit $EXIT_CODE
- name: update-cache
image: plugins/s3-cache
volumes:
- name: rbenv
path: /home/circleci/.rbenv
settings:
endpoint: s3://code-dot-org
debug: true
pull: true
rebuild: true
mount:
- /home/circleci/.rbenv
# Used to avoid re-seeding UI test data unless something changed - see cached_ui_test task in https://github.com/code-dot-org/code-dot-org/blob/staging/dashboard/lib/tasks/seed.rake
- dashboard/db/ui_test_data.hash
- dashboard/db/ui_test_data.sql
volumes:
- name: rbenv
temp: {}
- name: mysql
temp: {}
trigger:
branch:
- 'staging'
- 'staging-next'
event:
- pull_request
---
kind: signature
hmac: dc4e945db625740ff05bf17df74f5e97a40b0e336db058bf3ea7c5543e9ce9e5
...