forked from proteneer/timemachine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
202 lines (190 loc) · 4.54 KB
/
.gitlab-ci.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
stages: # List of stages for jobs, and their order of execution
- build-docker
- lint
- test
variables:
# The default CI branch should slugify to the same name, such that $CI_COMMIT_REF_SLUG == $CI_DEFAULT_BRANCH
# which allows branches to use the default's branchs image as a cache
DOCKER_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
workflow:
rules:
# Only run the pipeline for a pull request or the default branch
# In the case of the default branch, we want to build the image so that
# other branches have a base image to cache from when possible.
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
- if: $CI_EXTERNAL_PULL_REQUEST_IID
- if: $NIGHTLY_TESTS
docker_build:
stage: build-docker
image: docker:20.10
tags:
- gpu
- docker
script:
- DOCKER_HOST=tcp://localhost:2375 docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY
# Prune images older than 2 days
- docker system prune --filter "until=48h" -f -a
# Pull the docker containers
- docker pull $CI_REGISTRY_IMAGE:$CI_DEFAULT_BRANCH || true
- docker pull $DOCKER_TAG || true
# Cache from default branch and most recent image to get most out of the caching
- docker build -t $DOCKER_TAG --cache-from $CI_REGISTRY_IMAGE:$CI_DEFAULT_BRANCH,$DOCKER_TAG --target timemachine_ci .
- docker push $DOCKER_TAG
lint:
stage: lint
image: $DOCKER_TAG
needs: ["docker_build"]
tags:
- timemachine
- gpu
rules:
- if: $CI_EXTERNAL_PULL_REQUEST_IID
- if: $NIGHTLY_TESTS
script:
- make verify
nocuda-tests:
stage: test
image: $DOCKER_TAG
needs: ["lint"]
tags:
- timemachine
- cpu
rules:
- if: $CI_EXTERNAL_PULL_REQUEST_IID
script:
- SKIP_CUSTOM_OPS=1 pip install .[test]
- make nocuda_tests
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME-nocuda-tests"
paths:
- coverage/
when: on_success
expire_in: 1 week
nogpu-tests:
stage: test
image: $DOCKER_TAG
needs: ["lint"]
tags:
- timemachine
- cpu
rules:
- if: $CI_EXTERNAL_PULL_REQUEST_IID
# Build custom ops with fixed cuda arch, to test C++ that is CPU only
variables:
CMAKE_ARGS: -DCUDA_ARCH=75
script:
- pip install .[test]
- make nogpu_tests
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME-nogpu-tests"
paths:
- coverage/
when: on_success
expire_in: 1 week
memory-tests:
stage: test
image: $DOCKER_TAG
needs: ["lint"]
tags:
- gpu
rules:
- if: $CI_EXTERNAL_PULL_REQUEST_IID
script:
- pip install .[test]
- make memcheck_tests
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME-memtests"
paths:
- coverage/
when: on_success
expire_in: 1 week
unit-tests:
stage: test
image: $DOCKER_TAG
needs: ["lint"]
tags:
- gpu
rules:
- if: $CI_EXTERNAL_PULL_REQUEST_IID
script:
- pip install .[test]
- make unit_tests
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME-tests"
paths:
- coverage/
when: on_success
expire_in: 1 week
nightly-tests:
stage: test
image: $DOCKER_TAG
needs: ["lint"]
tags:
- gpu
rules:
- if: $NIGHTLY_TESTS
script:
- pip install .[test]
- make nightly_tests
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME-nightly-tests"
paths:
- coverage/
when: on_success
expire_in: 1 week
nightly-memcheck-tests:
stage: test
image: $DOCKER_TAG
needs: ["lint"]
tags:
- gpu
rules:
- if: $NIGHTLY_TESTS
script:
- pip install .[test]
- make nightly_memcheck_tests
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME-nightly-memcheck-tests"
paths:
- coverage/
when: on_success
expire_in: 1 week
nightly-tests-nocuda:
stage: test
image: $DOCKER_TAG
needs: ["lint"]
tags:
- timemachine
- cpu
rules:
- if: $NIGHTLY_TESTS
script:
- SKIP_CUSTOM_OPS=1 pip install .[test]
- make nocuda_nightly_tests
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME-nocuda-nightly-tests"
paths:
- coverage/
when: on_success
expire_in: 1 week
nightly-tests-nogpu:
stage: test
image: $DOCKER_TAG
needs: ["lint"]
tags:
- timemachine
- cpu
rules:
- if: $NIGHTLY_TESTS
# Build custom ops with fixed cuda arch, to test C++ that is CPU only
variables:
CMAKE_ARGS: -DCUDA_ARCH=75
script:
- pip install .[test]
- make nogpu_nightly_tests
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME-nogpu-nightly-tests"
paths:
- coverage/
when: on_success
expire_in: 1 week