-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
55 lines (47 loc) · 1.44 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
image: docker:latest
services:
- docker:dind
stages:
- build
- test
- release
variables:
CONTAINER_TEST_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
CONTAINER_RELEASE_IMAGE_GITLAB: $CI_REGISTRY_IMAGE:latest
CONTAINER_RELEASE_IMAGE_GCR: $GCR_HOST/$GCS_PROJECTID/private/imperics:latest
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
build:
stage: build
script:
- docker pull $CI_REGISTRY_IMAGE:latest || true
- docker build --tag $CONTAINER_TEST_IMAGE .
- docker run $CONTAINER_TEST_IMAGE /bin/bash -c 'conda list -n impact-env'
- docker push $CONTAINER_TEST_IMAGE
test-cli:
stage: test
script:
- docker pull $CONTAINER_TEST_IMAGE
- docker run $CONTAINER_TEST_IMAGE imperics --help
test-pytest:
stage: test
script:
- docker pull $CONTAINER_TEST_IMAGE
- docker run $CONTAINER_TEST_IMAGE /bin/bash -c 'cd /opt/src/app; pytest -v -m "not imperics_shareddir" /opt/src/app'
release-docker-gitlab:
stage: release
script:
- docker pull $CONTAINER_TEST_IMAGE
- docker tag $CONTAINER_TEST_IMAGE $CONTAINER_RELEASE_IMAGE_GITLAB
- docker push $CONTAINER_RELEASE_IMAGE_GITLAB
only:
- master
release-docker-google:
stage: release
script:
- docker pull $CONTAINER_TEST_IMAGE
- cat $GCR_KEY | docker login -u _json_key --password-stdin https://$GCR_HOST
- docker tag $CONTAINER_TEST_IMAGE $CONTAINER_RELEASE_IMAGE_GCR
- docker push $CONTAINER_RELEASE_IMAGE_GCR
only:
- master