File: .gitlab-ci.yml

package info (click to toggle)
python-debian 1.1.0
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,272 kB
  • sloc: python: 13,612; makefile: 239; sh: 25
file content (242 lines) | stat: -rw-r--r-- 5,813 bytes parent folder | download
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
default:
  image: debian:unstable

variables:
  PYTHON: python3

### Dependency installation

.depends-debian-minimal:
  # Mandatory run-time and test-time dependencies
  before_script:
  - apt-get update
  - apt-get -y install make dpkg-dev
  - apt-get -y install python3 python3-setuptools python3-pytest zstd $OPTIONAL_DEPS $JOB_DEPS
  variables:
    OPTIONAL_DEPS: ""
    JOB_DEPS: ""

.depends-debian-full:
  # Additional run-time and test-time dependencies for optional features
  extends:
    .depends-debian-minimal
  variables:
    OPTIONAL_DEPS: python3-apt gpgv binutils
    JOB_DEPS: python3-charset-normalizer

.depends-pip:
  before_script:
  - $PYTHON -m pip install charset-normalizer setuptools pytest $OPTIONAL_PIP_DEPS $JOB_PIP_DEPS
  variables:
    OPTIONAL_PIP_DEPS: ""
    JOB_PIP_DEPS: ""
    PIP_BREAK_SYSTEM_PACKAGES: 1

### Unit testing runners

.unit-tests-generic:
  script:
  - LC_ALL=C $PYTHON -m pytest $COVERAGE
  - LC_ALL=C.UTF-8 $PYTHON -m pytest $COVERAGE $COVERAGE_REPORT
  variables:
    # Only generate coverage data and a report once in the test matrix
    COVERAGE: ""
    COVERAGE_REPORT: ""
    # control whether missing tools result in test failures
    FORBID_MISSING_APT_PKG: ""
    FORBID_MISSING_CHARSET_NORMALIZER: ""
    FORBID_MISSING_GPGV: ""
    FORBID_MISSING_AR: ""
    FORBID_MISSING_DPKG_DEB: ""
    FORBID_MISSING_ZSTD: ""

.unit-tests-debian:
  extends:
  - .unit-tests-generic

### Unit testing configurations (Debian)

unit-tests:
  extends:
  - .depends-debian-full
  - .unit-tests-debian
  after_script:
  - python3-coverage html
  coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
  variables:
    # Omit --cov-report to generate a report that gitlab can pick up with its log parser
    COVERAGE: --cov --cov-branch --cov-append
    # Generate a coverage report for the pages
    COVERAGE_REPORT: --cov-report=
    JOB_DEPS: python3-pytest-cov python3-coverage python3-charset-normalizer
    # require optional dependencies to be installed at test time
    FORBID_MISSING_APT_PKG: "1"
    FORBID_MISSING_CHARSET_NORMALIZER: "1"
    FORBID_MISSING_GPGV: "1"
    FORBID_MISSING_AR: "1"
    FORBID_MISSING_DPKG_DEB: "1"
    FORBID_MISSING_ZSTD: "1"
  artifacts:
    paths:
      - htmlcov

unit-tests-minimal:
  extends:
  - .depends-debian-minimal
  - .unit-tests-debian

unit-tests-stable:
  image: debian:stable
  extends:
  - .depends-debian-full
  - .unit-tests-debian
  variables:
    # require optional dependencies to be installed at test time
    FORBID_MISSING_APT_PKG: "1"
    FORBID_MISSING_GPGV: "1"
    FORBID_MISSING_AR: "1"

unit-tests-oldstable:
  image: debian:oldstable
  extends:
  - .depends-debian-full
  - .unit-tests-debian

unit-tests-oldoldstable:
  image: debian:oldoldstable
  extends:
  - unit-tests-oldstable
  before_script:
  - !reference [.depends-debian-minimal, before_script]
  - dpkg -r python3-pytest
  - !reference [.depends-pip, before_script]
  variables:
    # require optional dependencies to be installed at test time
    FORBID_MISSING_APT_PKG: "1"
    FORBID_MISSING_GPGV: "1"
    FORBID_MISSING_AR: "1"
    JOB_DEPS: python3-pip python3-chardet
    JOB_PIP_DEPS: pytest

### Unit testing configurations (non-Debian)

unit-tests-truncated-debian:
  extends:
  - .depends-debian-minimal
  - .unit-tests-generic
  script:
  - rm -f /usr/bin/ar /usr/bin/gpgv
  - !reference [.unit-tests-generic, script]

unit-tests-alpine:
  image: python:alpine
  extends:
  - .depends-pip
  - .unit-tests-generic

unit-tests-fedora-minimal:
  image: fedora:latest
  extends:
  - .depends-pip
  - .unit-tests-generic
  before_script:
  - dnf install -y python3 python3-pip binutils
  - !reference [.depends-pip, before_script]

unit-tests-fedora:
  image: fedora:latest
  extends:
  - .unit-tests-generic
  before_script:
  - dnf install -y python3 python3-apt python3-charset-normalizer python3-setuptools python3-pytest zstd

unit-tests-wine:
  before_script:
  - apt-get update
  - apt-get -y install python3-pip wine
  - PATH=~/.local/bin/:$PATH
  - pip install --user wenv
  - export WENV_PYTHONVERSION=$(py3versions -v -d).0
  - wenv init
  - wenv python -m pip install charset-normalizer setuptools pytest
  script:
  - wenv python -m pytest
  variables:
    WENV_ARCH: win64
    WENV_WINE_BIN_WIN64: /usr/bin/wine
    WENV_NO_PTH_FILE: 1
    PIP_BREAK_SYSTEM_PACKAGES: 1

unit-tests-windows:
  tags:
  - shared-windows
  - windows
  - windows-1809
  rules:
  - if: $CI_SERVER_HOST !~ /debian.org$/
  extends:
  - .depends-pip
  before_script:
  - Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
  - choco install python3 --yes --force --no-progress
  - refreshenv
  - python -m pip install -U pip wheel
  - python -m pip install charset-normalizer setuptools pytest
  script:
  - python -m pytest
  variables:
    PYTHON: python
    PIP_BREAK_SYSTEM_PACKAGES: 1

### Installation test with pip

pip-install-test:
  extends:
  - .depends-debian-full
  script:
  - cp -a tests/ pyproject.toml /tmp
  - python3 -mvenv venv
  - . ./venv/bin/activate
  - pip install --verbose .
  - pip install -e ".[test]"
  - cd /tmp
  - python3 -m pytest tests
  variables:
    JOB_DEPS: git python3-pip python3-venv

### Coding style checks

style:
  extends: .depends-debian-full
  script:
  - ./debian/rules qa
  variables:
    JOB_DEPS: pylint mypy python3-charset-normalizer

### Documentation: build and deploy

docs:
  extends: .depends-debian-full
  script:
  - rm -f docs/api/*
  - ./debian/rules doc
  - mv build/sphinx/html/ docs/
  variables:
    JOB_DEPS: python3-sphinx
  artifacts:
    paths:
      - docs

pages:
  stage: deploy
  script:
  - mv docs public
  - mv htmlcov public/
  dependencies:
    - docs
    - unit-tests
  artifacts:
    paths:
    - public
  only:
  - master