-
Notifications
You must be signed in to change notification settings - Fork 0
/
circle.yml
98 lines (85 loc) · 3.09 KB
/
circle.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
machine:
services:
- docker
- postgresql
- redis
environment:
REPO: ../.go_workspace/src/sourcegraph.com/sourcegraph/sourcegraph
PGUSER: ubuntu
PGDATABASE: circle_test
PGSSLMODE: disable
PATH: $HOME/google-cloud-sdk/bin:$HOME/protobuf-3.0.0-beta-1/src:$PATH
REDIS_MASTER_ENDPOINT: ":6379"
CLOUDSDK_CORE_DISABLE_PROMPTS: 1
LONG_VERSION: $(printf %05d $CIRCLE_BUILD_NUM)_$(date +%Y-%m-%d)_${CIRCLE_SHA1:0:7}
# Don't block on `git diff` invocations of `less`.
GIT_PAGER:
node:
version: 4.1.0
dependencies:
pre:
- ./dev/ci/install-go.sh
- ./dev/ci/packages.sh
- ./dev/ci/install-test-tools.sh
cache_directories:
- ~/google-cloud-sdk
- ~/protobuf-3.0.0-beta-1/src
- ~/cache
override:
- rm -rf $HOME/.go_workspace/src
- mkdir -p $HOME/.go_workspace/src/sourcegraph.com/sourcegraph
- cp -r $PWD $REPO
- ./dev/ci/versions.sh
- git config --global user.email "ci@example.com"
- git config --global user.name "CI User"
- ./dev/ci/install-gcloud.sh
- ./dev/ci/install-protobuf.sh
- ./dev/ci/patch-exec-latency.sh
test:
override:
- mkdir -p $CIRCLE_TEST_REPORTS/junit:
parallel: true
- ./dev/circle-ci-run-tests.sh:
pwd: $REPO
parallel: true
- make smoke:
pwd: $REPO
post:
- ./dev/circle-ci-gather-coverage.sh:
pwd: $REPO
- npm run graph:
pwd: $REPO/app
- cp $REPO/app/artifacts/* $CIRCLE_ARTIFACTS
deployment:
master-branch:
branch: master
commands:
- ./dev/circle-build-docker-image.sh $LONG_VERSION:
pwd: $REPO
- ./dev/circle-release-sourcemaps.sh $LONG_VERSION:
pwd: $REPO
- docker tag us.gcr.io/sourcegraph-dev/sourcegraph:$LONG_VERSION us.gcr.io/sourcegraph-dev/sourcegraph:latest
- gcloud docker push us.gcr.io/sourcegraph-dev/sourcegraph:latest
- curl http://deploy-bot.sourcegraph.com/set-branch-version -F "token=$DEPLOY_BOT_TOKEN" -F "branch=master" -F "version=$LONG_VERSION"
- echo $LONG_VERSION | gsutil cp - gs://sourcegraph-metadata/latest-successful-build
staging-branch:
branch: [staging, staging2, staging3, staging4]
commands:
- ./dev/circle-build-docker-image.sh $LONG_VERSION:
pwd: $REPO
- ./dev/circle-release-sourcemaps.sh $LONG_VERSION:
pwd: $REPO
- curl http://deploy-bot.sourcegraph.com/set-branch-version -F "token=$DEPLOY_BOT_TOKEN" -F "branch=$CIRCLE_BRANCH" -F "version=$LONG_VERSION"
release-tag:
tag: /[0-9]+\.[0-9]+\.[0-9]+/
commands:
- ./dev/circle-build-docker-image.sh $CIRCLE_TAG:
pwd: $REPO
# push to Docker Hub
- docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASSWORD
- docker tag us.gcr.io/sourcegraph-dev/sourcegraph:$CIRCLE_TAG sourcegraph/sourcegraph:$CIRCLE_TAG
- docker tag us.gcr.io/sourcegraph-dev/sourcegraph:$CIRCLE_TAG sourcegraph/sourcegraph:latest
- docker push sourcegraph/sourcegraph:$CIRCLE_TAG
- docker push sourcegraph/sourcegraph:latest
- ./dev/circle-release-sourcemaps.sh $CIRCLE_TAG:
pwd: $REPO