-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
206 lines (171 loc) · 4.01 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
206 lines (171 loc) · 4.01 KB
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
---
#
# CI configuration for Onionbalance
#
#
# General
#
# Variables
variables:
# Use full clone so "./onionbalance.py --version" works
# https://docs.gitlab.com/ci/runners/configure_runners/#git-strategy
GIT_STRATEGY: clone
GIT_DEPTH: 0
# CI Templates
include:
# Onion MkDocs
- project: tpo/web/onion-mkdocs
file: .gitlab-ci-base.yml
# APT configuration
- project: tpo/tpa/ci-templates
file: scripts/apt.yml
# Debian packaging
- project: tpo/onion-services/ci-templates
file: onion-services/debian.yml
# Python packaging
- project: tpo/onion-services/ci-templates
file: onion-services/python.yml
# GitLab releases
- project: tpo/onion-services/ci-templates
file: onion-services/release.yml
# Default image
image: containers.torproject.org/tpo/tpa/base-images/python:sid
# Base build procedure
.base:
before_script:
- !reference [.apt-init]
- apt-get install
python3
python3-pip
python3-venv
python3-setuptools
- python3 -m venv $HOME/venv
- source $HOME/venv/bin/activate
- pip3 install -r requirements.txt
- pip3 install -r test-requirements.txt
- python3 -m pip install .
#
# Basic build
#
install:
stage: build
extends: .base
script:
- /bin/true
#
# Python
#
# Needs Git installed so "./onionbalance.py --version" works
python:
!reference [.python]
#
# Tests
#
functional_tests:
stage: test
extends: .base
script:
- apt-get update
- apt-get install -y wget gnupg git
- ./test/scripts/install-tor.sh
- source test/scripts/install-chutney-v3.sh
- pytest --cov-report=term-missing --cov=onionbalance test/functional/
unit_tests:
stage: test
extends: .base
script:
- pytest --cov-report=term-missing --cov=onionbalance --ignore=test/functional/
static_tests:
stage: test
extends: .base
script:
- pylint onionbalance --disable=R,C,W
style_tests:
stage: test
extends: .base
script:
- flake8 onionbalance
config_tests:
stage: test
extends: .base
script:
- ./onionbalance-config.py --no-interactive
- ls config/*.key
- cat config/config.yaml
#
# Debian
#
debian_stable:
!reference [.debian-stable]
debian_sid:
!reference [.debian-sid]
ubuntu_lts:
!reference [.ubuntu-lts]
lintian:
!reference [.lintian]
piuparts:
!reference [.piuparts]
#
# Run tests
#
run_source:
stage: test
extends: .base
script:
# Needs Git installed so "./onionbalance.py --version" works
- apt-get install -y git
- git describe --tags --dirty --always --long
- ./onionbalance.py --version
run_python:
image: containers.torproject.org/tpo/tpa/base-images/debian:sid
stage: test
# Retry twice, since onionbalance might fail due to Tor bootrapping/network errors
retry: 2
needs:
- job: python
artifacts: true
before_script:
- !reference [.apt-init]
script:
- apt-get update
- apt-get install -y python3-pip tor
- pip install --break-system-packages dist/onionbalance*.whl
- pip show onionbalance
- onionbalance-config --no-interactive
- onionbalance --version
run_sid:
image: containers.torproject.org/tpo/tpa/base-images/debian:sid
stage: test
needs:
- job: debian_sid
artifacts: true
before_script:
# Add sources, so apt-get build-dep works; then initialize APT
- echo "deb-src https://deb.debian.org/debian sid main" >> /etc/apt/sources.list
- !reference [.apt-init]
script:
# Install dependencies
- apt-get update
- apt-get install -y onionbalance
- apt-get remove onionbalance
# Install the built package
- apt-get build-dep onionbalance
- dpkg -i dist/onionbalance_*.deb
# Test
- onionbalance-config --no-interactive
- onionbalance --version
#
# Documentation
#
pages:
stage: deploy
extends: .onion-mkdocs-clone
after_script:
- $ONION_MKDOCS_LOCATION/scripts/onion-mkdocs-provision-build
- $ONION_MKDOCS_LOCATION/scripts/onion-mkdocs-build
- scripts/docs-preserve-historic-urls
#
# Release
#
release:
!reference [.release-gitlab]