-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.travis.yml
133 lines (131 loc) · 4.76 KB
/
.travis.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
---
os: linux
dist: focal
language: rust
cache: cargo
rust:
- 1.45.2
env:
global:
BASE_IMAGE: alexlauni/liftright-data-server
DOCKER_BUILDKIT: 1
jobs:
include:
- stage: build
before_script:
- rustup component add rustfmt
- rustup component add clippy
# As a result of https://github.com/travis-ci/travis-ci/issues/1066, we run
# everything in one large command instead of multiple commands.
# In this way, the build stops immediately if one of the commands fails.
script: |
cargo fmt --all -- --check &&
cargo clippy -- -D warnings &&
cargo build &&
cargo test
- stage: build
services:
- docker
before_script:
- echo ${DOCKER_PASSWORD} | docker login -u ${DOCKER_USERNAME} --password-stdin
script:
- export SHORT_TAG=$(git rev-parse --short ${TRAVIS_COMMIT})
- export BRANCH_TAG=${TRAVIS_BRANCH}-${SHORT_TAG}
- docker build
--target planner
--cache-from ${BASE_IMAGE}:planner
--tag ${BASE_IMAGE}:planner
--build-arg BUILDKIT_INLINE_CACHE=1
"."
- docker build
--target cacher
--cache-from ${BASE_IMAGE}:planner
--cache-from ${BASE_IMAGE}:cacher
--tag ${BASE_IMAGE}:cacher
--build-arg BUILDKIT_INLINE_CACHE=1
"."
- docker build
--target builder
--cache-from ${BASE_IMAGE}:planner
--cache-from ${BASE_IMAGE}:cacher
--cache-from ${BASE_IMAGE}:builder
--tag ${BASE_IMAGE}:builder
--build-arg BUILDKIT_INLINE_CACHE=1
"."
- docker build
--cache-from ${BASE_IMAGE}:planner
--cache-from ${BASE_IMAGE}:cacher
--cache-from ${BASE_IMAGE}:builder
--cache-from ${BASE_IMAGE}:latest
--tag ${BASE_IMAGE}:latest
--tag ${BASE_IMAGE}:${BRANCH_TAG}
--build-arg BUILDKIT_INLINE_CACHE=1
"."
after_success:
- docker push ${BASE_IMAGE}:planner
- docker push ${BASE_IMAGE}:cacher
- docker push ${BASE_IMAGE}:builder
deploy:
- provider: script
edge: true
script:
- docker push ${BASE_IMAGE}
on:
all_branches: true
- provider: script
edge: true
script:
- docker tag ${BASE_IMAGE} ${BASE_IMAGE}:${SHORT_TAG}
- docker push ${BASE_IMAGE}
on:
branch: main
- stage: benchmark
language: python
python:
- "3.8"
before_install:
- sudo add-apt-repository -y ppa:jfhovinne/groovy-focal-backports
- sudo apt-get -q update
- sudo apt-get -y install wrk
- pip install pipenv
install:
- git config --replace-all remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
- git fetch
- |
PSHA=$(git cat-file -p ${TRAVIS_COMMIT} |grep parent |tail -n1 |cut -d ' ' -f2) &&
PBRANCH=$(git name-rev --name-only ${PSHA} |cut -d '/' -f3)
- git clone https://launibot:${GH_TOKEN}@github.com/LiftRight/lrds-bench
- cd lrds-bench
- pipenv install
before_script:
- docker-compose -f mongo-compose.yaml up -d
script:
- export BRANCH_TAG=${TRAVIS_BRANCH}-$(git rev-parse --short ${TRAVIS_COMMIT})
- git clone --single-branch --branch=gh-pages https://github.com/lamalex/liftright-data-server.git output
- echo "Removing ${PBRANCH}*.json"
- rm -f output/${PBRANCH}*.json
- pipenv run python bench-tags.py --runs=1 --on-tag=${BRANCH_TAG} --output=output
after_script:
- docker run --rm -it lumir/remove-dockerhub-tag --user ${DOCKER_USERNAME} --password ${DOCKER_PASSWORD} ${DOCKER_USERNAME}/liftright-data-server:${BRANCH_TAG}
deploy:
provider: pages
edge: true
strategy: git
token: ${GH_TOKEN}
local_dir: output
cleanup: false
on:
all_branches: true
- stage: rollout
if: branch = main AND NOT type = pull_request
before_install:
- curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash &&
mv kustomize ~/bin
script: |
export SHORT_TAG=$(git rev-parse --short ${TRAVIS_COMMIT}) &&
git clone https://github.com/LiftRight/lrds-deploy.git &&
cd lrds-deploy/lrds/overlays/staging &&
kustomize edit set image alexlauni/liftright-data-server=alexlauni/liftright-data-server:${SHORT_TAG} &&
git commit kustomization.yaml -m "Update staging docker image to ${SHORT_TAG}" &&
git remote set-url origin https://launibot:${GH_TOKEN}@github.com/LiftRight/lrds-deploy.git &&
git push origin main