-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
177 lines (164 loc) · 4.3 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
stages:
- test
- docker
- integration-test
- publish
default:
image: python:3.10
interruptible: true
before_script:
- export PATH=$HOME/.local/bin:$PATH
- apt-get update && apt-get install -y git-lfs
.only:
only: &only_changes
changes:
- "*.py"
- "git_cdn/**/*"
- "poetry.*"
- "pyproject*"
- "Makefile*"
- "Dockerfile"
- "*.yml"
- ".*"
checks:
extends: .only
stage: test
variables:
WORKING_DIRECTORY: /tmp
script:
- make dev
- make check
parallel:
matrix:
- IMAGE :
- python:3.10
- python:3.11
build:
extends: .only
stage: test
variables:
WORKING_DIRECTORY: /tmp
script:
- python --version
- git --version
- git lfs --version
- git lfs install
- make dev
- make set-version
- make build
- make export
artifacts:
paths:
- dist/
- Dockerfile
- config.py
- requirements.txt
tests:
extends: .only
stage: test
variables:
WORKING_DIRECTORY: /tmp
script:
- git --version
- git lfs --version
- git lfs install
- git config --global uploadpack.allowfilter true
- make dev
- make test
parallel:
matrix:
- IMAGE :
- python:3.10
- python:3.11
# markdownlint:
# stage: test
# image: ruby
# before_script:
# - gem install gitlab-markup redcarpet
# script:
# - gitlab-markup README.md
coverage:
extends: .only
stage: test
variables:
WORKING_DIRECTORY: /tmp
script:
- git --version
- git lfs --version
- git lfs install
- git config --global uploadpack.allowfilter true
- make dev
- poetry run pip install coveralls
- make test-coverage
# - pipenv run coveralls
artifacts:
paths:
- coverage_html/
reports:
junit: testresults.xml
coverage: '/^TOTAL.*\s+(\d+\%)$/'
dockerbuild:
extends: .only
image: docker:20.10.12
stage: docker
variables:
GIT_STRATEGY: none
needs: [build]
dependencies: [build]
services:
- docker:20.10.12-dind
before_script: [] # remove default
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $CI_REGISTRY/$CI_PROJECT_PATH:i-$CI_COMMIT_SHA-$CI_PIPELINE_ID .
- docker push $CI_REGISTRY/$CI_PROJECT_PATH:i-$CI_COMMIT_SHA-$CI_PIPELINE_ID
# test the docker image with the integration tests
integration_tests:
extends: .only
stage: integration-test
needs: [dockerbuild]
services:
- name: $CI_REGISTRY/$CI_PROJECT_PATH:i-$CI_COMMIT_SHA-$CI_PIPELINE_ID
alias: gitcdn
variables:
WORKING_DIRECTORY: /tmp
GITSERVER_UPSTREAM: https://gitlab.com/
UNDER_TEST_APP: http://gitcdn:8000
# fix me: send patch to gitlab-runner so that services can be linked together..
# right now, we can't test proxy support by runnering a simple squid proxy as a gitlabci service
# BUNDLE_PROXY: $BUNDLE_PROXY
# PROXY: $PROXY
script:
- make dev
- unset https_proxy
- until curl $UNDER_TEST_APP ; do sleep 1; done
- make integration-test
pages:
extends: .only
stage: publish
only:
<<: *only_changes
refs:
- master
artifacts:
paths:
- public
script:
- mkdir -p public/coverage
- mv -v coverage_html/* public/coverage
publish_docker:
extends: .only
image: docker:20.10.12
stage: publish
only:
<<: *only_changes
refs:
- master
- tags
services:
- docker:20.10.12-dind
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker pull $CI_REGISTRY/$CI_PROJECT_PATH:i-$CI_COMMIT_SHA-$CI_PIPELINE_ID
- docker tag $CI_REGISTRY/$CI_PROJECT_PATH:i-$CI_COMMIT_SHA-$CI_PIPELINE_ID $CI_REGISTRY/$CI_PROJECT_PATH:latest
- docker push $CI_REGISTRY/$CI_PROJECT_PATH:latest