This repository has been archived by the owner on Jul 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
.travis.yml
241 lines (216 loc) · 8.14 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
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
dist: bionic
os: linux
language: python
jobs:
include:
- stage: "Check"
name: "Validate"
language: shell
before_install:
- sudo apt-get update
- sudo apt-get install shellcheck -y
script: find . -name "*.sh" -print0 | xargs -0 -n1 shellcheck
- stage: "Check"
name: "Markdown Validate"
language: ruby
before_install:
- gem install mdl
script: mdl -r "~MD013" .
- stage: "Check"
name: "Lint python files"
language: python
cache: pip
python: "3.8"
script:
- make lint
- stage: "Test"
name: "test:unittest"
language: python
cache: pip
python: "3.8"
before_script:
- pip install codecov
- export PATH="${PATH}:$(pwd)"
script:
- coverage run --source=./src/illuminatio/ setup.py test --addopts="-m 'not e2e' --runslow"
after_success:
- codecov
- stage: "Test"
name: "docker - calico e2e Tests (py3.8)"
language: python
cache: pip
python: "3.8"
env:
- KUBECONFIG="$HOME/.kube/config"
# stable version in minikube v1.12.2
- KUBERNETES_VERSION=v1.18.3
- MINIKUBE_VERSION=v1.12.2
- CHANGE_MINIKUBE_NONE_USER=true
- MINIKUBE_WANTUPDATENOTIFICATION=false
- MINIKUBE_WANTREPORTERRORPROMPT=false
- MINIKUBE_HOME=$HOME
before_script:
# install dependent binaries
- curl --fail -Lo kubectl "https://storage.googleapis.com/kubernetes-release/release/${KUBERNETES_VERSION}/bin/linux/amd64/kubectl" && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
- curl --fail -Lo minikube "https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-linux-amd64" && chmod +x minikube && sudo mv minikube /usr/local/bin/
- mkdir -p $HOME/.kube $HOME/.minikube
- touch $KUBECONFIG
- minikube config set driver docker
- ./local_dev/start_docker.sh
- pip install -r requirements.txt
- pip install codecov
- python setup.py install
- sudo cp ${TRAVIS_BUILD_DIR}/nmap /usr/local/bin/nmap
script:
# run illuminatio e2e tests
- ./local_dev/run_e2e_tests.sh
after_success:
- codecov
- stage: "Test"
name: "containerd - calico e2e Tests (py3.8)"
language: python
cache: pip
python: "3.8"
env:
- KUBECONFIG="$HOME/.kube/config"
# stable version in minikube v1.12.2
- KUBERNETES_VERSION=v1.18.3
- MINIKUBE_VERSION=v1.12.2
- CHANGE_MINIKUBE_NONE_USER=true
- MINIKUBE_WANTUPDATENOTIFICATION=false
- MINIKUBE_WANTREPORTERRORPROMPT=false
- MINIKUBE_HOME=$HOME
before_script:
# install dependent binaries
- curl --fail -Lo kubectl "https://storage.googleapis.com/kubernetes-release/release/${KUBERNETES_VERSION}/bin/linux/amd64/kubectl" && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
- curl --fail -Lo minikube "https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-linux-amd64" && chmod +x minikube && sudo mv minikube /usr/local/bin/
- mkdir -p $HOME/.kube $HOME/.minikube
- touch $KUBECONFIG
- minikube config set driver docker
- ./local_dev/start_containerd.sh
- pip install -r requirements.txt
- pip install codecov
- python setup.py install
- sudo cp ${TRAVIS_BUILD_DIR}/nmap /usr/local/bin/nmap
script:
# run illuminatio e2e tests
- ./local_dev/run_e2e_tests.sh
after_success:
- codecov
- stage: "Test"
name: "docker - calico e2e Tests (py3.7)"
language: python
cache: pip
python: "3.7"
env:
- KUBECONFIG="$HOME/.kube/config"
# stable version in minikube v1.12.2
- KUBERNETES_VERSION=v1.18.3
- MINIKUBE_VERSION=v1.12.2
- CHANGE_MINIKUBE_NONE_USER=true
- MINIKUBE_WANTUPDATENOTIFICATION=false
- MINIKUBE_WANTREPORTERRORPROMPT=false
- MINIKUBE_HOME=$HOME
before_script:
# install dependent binaries
- curl --fail -Lo kubectl "https://storage.googleapis.com/kubernetes-release/release/${KUBERNETES_VERSION}/bin/linux/amd64/kubectl" && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
- curl --fail -Lo minikube "https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-linux-amd64" && chmod +x minikube && sudo mv minikube /usr/local/bin/
- mkdir -p $HOME/.kube $HOME/.minikube
- touch $KUBECONFIG
- minikube config set driver docker
- ./local_dev/start_docker.sh
- pip install -r requirements.txt
- pip install codecov
- python setup.py install
- sudo cp ${TRAVIS_BUILD_DIR}/nmap /usr/local/bin/nmap
script:
# run illuminatio e2e tests
- ./local_dev/run_e2e_tests.sh
after_success:
- codecov
- stage: "Test"
name: "containerd - calico e2e Tests (py3.7)"
language: python
cache: pip
python: "3.7"
env:
- KUBECONFIG="$HOME/.kube/config"
# stable version in minikube v1.12.2
- KUBERNETES_VERSION=v1.18.3
- MINIKUBE_VERSION=v1.12.2
- CHANGE_MINIKUBE_NONE_USER=true
- MINIKUBE_WANTUPDATENOTIFICATION=false
- MINIKUBE_WANTREPORTERRORPROMPT=false
- MINIKUBE_HOME=$HOME
before_script:
# install dependent binaries
- curl --fail -Lo kubectl "https://storage.googleapis.com/kubernetes-release/release/${KUBERNETES_VERSION}/bin/linux/amd64/kubectl" && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
- curl --fail -Lo minikube "https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-linux-amd64" && chmod +x minikube && sudo mv minikube /usr/local/bin/
- mkdir -p $HOME/.kube $HOME/.minikube
- touch $KUBECONFIG
- minikube config set driver docker
- ./local_dev/start_containerd.sh
- pip install -r requirements.txt
- pip install codecov
- python setup.py install
- sudo cp ${TRAVIS_BUILD_DIR}/nmap /usr/local/bin/nmap
script:
# run illuminatio e2e tests
- ./local_dev/run_e2e_tests.sh
after_success:
- codecov
# merely build the image for untagged commits
- stage: build
name: "build images"
if: (tag IS blank)
services:
- docker
script:
- docker build -t "${TRAVIS_REPO_SLUG}":latest .
- docker tag "${TRAVIS_REPO_SLUG}":latest "${TRAVIS_REPO_SLUG}"-runner:latest
# build and push the latest images for master commits
- stage: build
name: "push latest images"
if: (branch = master AND NOT type = pull_request)
services:
- docker
script:
- docker build -t "${TRAVIS_REPO_SLUG}":latest .
- docker tag "${TRAVIS_REPO_SLUG}":latest "${TRAVIS_REPO_SLUG}"-runner:latest
- echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
- docker push "${TRAVIS_REPO_SLUG}"-runner:latest
- docker push "${TRAVIS_REPO_SLUG}":latest
# build and push the tagged image for tagged commits
- stage: build
name: "push tagged images"
if: (tag IS present)
services:
- docker
script:
- docker build -t "${TRAVIS_REPO_SLUG}":"${TRAVIS_TAG}" .
- docker tag "${TRAVIS_REPO_SLUG}":"${TRAVIS_TAG}" "${TRAVIS_REPO_SLUG}"-runner:"${TRAVIS_TAG}"
- echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
- docker push "${TRAVIS_REPO_SLUG}"-runner:"${TRAVIS_TAG}"
- docker push "${TRAVIS_REPO_SLUG}":"${TRAVIS_TAG}"
# merely build the python package for untagged commits
- stage: build
name: "build python package"
if: (tag IS blank)
language: python
cache: pip
python: "3.8"
script:
- python3 setup.py bdist_wheel
- pip install -e .
- illuminatio --help
# build and upload the tagged python package for tagged commits
- stage: build
name: "upload python package"
if: (tag IS present)
language: python
cache: pip
python: "3.8"
script:
- python setup.py bdist_wheel
- pip install twine
- twine upload -u "${PYPI_USERNAME}" -p "${PYPI_PASSWORD}" --repository-url https://upload.pypi.org/legacy/ dist/*