-
Notifications
You must be signed in to change notification settings - Fork 5
/
.gitlab-ci.yml
64 lines (57 loc) · 1.79 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
stages:
- build
- test
- release
variables:
GIT_DEPTH: "3"
PYLINT_TARGET: phoenix
IMAGE_LABELS: >
--label vcs-url=$CI_PROJECT_URL
--label com.skypicker.gitlab.ci.builder=$GITLAB_USER_EMAIL
--label com.skypicker.gitlab.ci.pipeline=$CI_PROJECT_URL/pipelines/$CI_PIPELINE_ID
--label com.skypicker.gitlab.ci.ref=$CI_BUILD_REF_NAME
--label com.skypicker.gitlab.ci.build=$CI_PROJECT_URL/builds/$CI_BUILD_ID
image: docker:18.06
services:
- docker:dind
before_script:
- export CI_BUILD_REF_SLUG=${CI_BUILD_REF_NAME/\//-}
- docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY || true
include:
- 'https://ci-files.skypicker.com/templates/build/black.yml'
- 'https://ci-files.skypicker.com/templates/test/pylint.yml'
- 'https://ci-files.skypicker.com/templates/release/release_latest.yml'
black:
tags: []
docker_build:
stage: build
dependencies: []
script:
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG || true
- docker pull $CI_REGISTRY_IMAGE:master || true
- >
docker build .
--cache-from $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
--cache-from $CI_REGISTRY_IMAGE:master
--build-arg package_version=git-$CI_COMMIT_SHA
--label build-date=`date -Iseconds`
$IMAGE_LABELS
--tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
--tag $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
pytest:
stage: test
variables:
GIT_STRATEGY: none
services:
- postgres:10.0
- redis:latest
- docker:dind
script:
- >
docker run
-e TEST_DATABASE_URL=postgres://postgres:postgres@postgres:5432/postgres
-e REDIS_URL=redis://redis:6379/0
$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
pytest -v --cov phoenix