-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitlab-ci.yml
86 lines (74 loc) · 2 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
stages:
- test
- build
- deploy
variables:
PROJECT_VERSION: "0.5"
build docker:
stage: build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$PROJECT_VERSION --build-arg project_version=$PROJECT_VERSION
unit tests:
stage: test
tags: [gitlab-org-docker]
image: python:3-slim
script:
- pip install --no-cache-dir -r requirements.txt
- coverage run --source pipeline_mermaid -m unittest discover tests "*test*"
- coverage xml # for merge request
- coverage html # for pages
- coverage report # for badge and analytics --> repository
artifacts:
paths:
- htmlcov/
reports:
cobertura: coverage.xml
coverage: '/^TOTAL.*\s+(\d+\%)$/'
build package:
tags: [ gitlab-org-docker ]
image: python:3-slim
stage: build
script:
- python setup.py sdist bdist_wheel
artifacts:
paths:
- dist/*
pages:
stage: deploy
dependencies:
- unit tests
script:
- mv htmlcov/ public/
artifacts:
paths:
- public
expire_in: 30 days
only:
- master
notify merge request:
stage: deploy
tags: [ gitlab-org-docker ]
image: $CI_REGISTRY_IMAGE:$PROJECT_VERSION
dependencies: []
script:
- pipeline-mermaid show_pipeline
- pipeline-mermaid show_pipeline 190875422
- pipeline-mermaid show_pipeline 192204962 journey
- pipeline-mermaid show_pipeline 249125838 gantt 3 "test for ${PROJECT_VERSION} version"
upload to pypi:
environment:
name: pypi
stage: deploy
dependencies:
- build package
tags: [ gitlab-org-docker ]
image: python:3-slim
when: manual
script:
- pip install twine
- twine upload dist/* --non-interactive -u __token__ -p $PYPI_TOKEN --verbose