Skip to content

Commit 3db3820

Browse files
lbogdanCompuIves
authored andcommitted
Add drone pipeline config.
1 parent 31b19f5 commit 3db3820

File tree

4 files changed

+103
-2
lines changed

4 files changed

+103
-2
lines changed

.drone.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
kind: pipeline
3+
name: default
4+
5+
steps:
6+
- name: restore node_modules cache
7+
image: codesandbox-cache:1
8+
settings:
9+
restore: true
10+
volumes:
11+
- name: node_modules-cache
12+
path: /cache
13+
when:
14+
event:
15+
- pull_request
16+
17+
- name: install packages
18+
image: node:10.15.3-jessie
19+
volumes:
20+
- name: yarn-cache
21+
path: /usr/local/share/.cache/yarn/v4
22+
commands:
23+
- yarn
24+
when:
25+
event:
26+
- pull_request
27+
28+
- name: build
29+
image: node:10.15.3-jessie
30+
commands:
31+
- export STAGING_BRANCH=pr$DRONE_PULL_REQUEST
32+
- yarn build
33+
when:
34+
event:
35+
- pull_request
36+
37+
- name: deploy
38+
image: codesandbox-deploy:1
39+
settings:
40+
domain: build.csb.dev
41+
volumes:
42+
- name: docker_sock
43+
path: /var/run/docker.sock
44+
- name: deployments
45+
path: /root/docker/deployments
46+
when:
47+
event:
48+
- pull_request
49+
50+
- name: slack notification
51+
image: plugins/slack
52+
settings:
53+
webhook:
54+
from_secret: slack_webhook
55+
channel: infra
56+
template: >
57+
{{#success build.status}}
58+
👍 {{repo.owner}}/{{repo.name}} pull request #{{build.pull}} successfully built. Access it at https://pr{{build.pull}}.build.csb.dev/ and see the build logs <{{build.link}}|here>.
59+
{{else}}
60+
👎 {{repo.owner}}/{{repo.name}} pull request #{{build.pull}} building failed. See what happened <{{build.link}}|here>.
61+
{{/success}}
62+
when:
63+
event:
64+
- pull_request
65+
status:
66+
- success
67+
- failure
68+
69+
- name: rebuild node_modules cache
70+
image: codesandbox-cache:1
71+
settings:
72+
rebuild: true
73+
volumes:
74+
- name: node_modules-cache
75+
path: /cache
76+
when:
77+
event:
78+
- pull_request
79+
80+
volumes:
81+
- name: yarn-cache
82+
host:
83+
path: /var/lib/docker/volumes/yarn-cache/_data
84+
- name: node_modules-cache
85+
host:
86+
path: /var/lib/docker/volumes/node_modules-cache/_data
87+
- name: docker_sock
88+
host:
89+
path: /var/run/docker.sock
90+
- name: deployments
91+
host:
92+
path: /root/docker/deployments
93+
---
94+
kind: signature
95+
hmac: bc5d7ea6acf15887e17055e6a230bca87495d5bd49b2d451aadabc548aac49c6
96+
97+
...

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ static/
99

1010
# Our server side code changes html, we don't want to unintentionally break this by formatting
1111
*.html
12+
13+
.drone.yml

packages/common/src/components/Preview/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ type State = {
7474

7575
const getSSEUrl = (sandbox?: Sandbox, initialPath: string = '') =>
7676
`https://${sandbox ? `${sandbox.id}.` : ''}sse.${
77-
process.env.NODE_ENV === 'development' ? 'codesandbox.io' : host()
77+
process.env.NODE_ENV === 'development' || process.env.STAGING
78+
? 'codesandbox.io'
79+
: host()
7880
}${initialPath}`;
7981

8082
interface IModulesByPath {

packages/common/src/utils/host.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default () => {
1010
}
1111

1212
if ('STAGING_BRANCH' in process.env) {
13-
return `http://${process.env.STAGING_BRANCH}.cs.lbogdan.tk`;
13+
return `http://${process.env.STAGING_BRANCH}.build.csb.dev`;
1414
}
1515

1616
if ('ROOT_URL' in process.env) {

0 commit comments

Comments
 (0)