-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
146 lines (139 loc) · 5.39 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
image: docker.uib.gmbh/opsi/dev/pybuilder:deb9-py3.11
stages:
- test
- doc
- publish
pytest-darwin:
#when: manual
stage: test
tags:
- catalina-py311-x64
script:
- curl -o opsi-dev-tools.tar.gz "$OPSIDEVTOOLS_URL_DARWIN_X64"
- tar -xvf opsi-dev-tools.tar.gz
- poetry --version
- poetry env use 3.11
- poetry cache clear --all --quiet uibpypi
#- poetry lock --regenerate
- poetry install
- poetry run pytest --tb=short -x -o junit_family=xunit2 --junitxml=testreport_darwin1.xml --cov-append --cov opsicommon --cov-report term --cov-report xml -v --ignore=tests/test_logging.py tests
- poetry run pytest --tb=short -x -o junit_family=xunit2 --junitxml=testreport_darwin2.xml --cov-append --cov opsicommon --cov-report term --cov-report xml -v tests/test_logging.py
- ./opsi-dev-tool -l info --testreport-merge testreport_darwin1.xml testreport_darwin2.xml testreport_darwin.xml
- mv .coverage coverage_darwin
artifacts:
name: "python-opsi-common_test_darwin"
paths:
- coverage.xml
- testreport_darwin.xml
- coverage_darwin
expire_in: 3 days
pytest-windows:
#when: manual
stage: test
tags:
- win10-py311-x86
script:
- Invoke-WebRequest -UseBasicParsing -Uri "$OPSIDEVTOOLS_URL_WINDOWS_X86" -OutFile opsi-dev-tools.zip
- Expand-Archive opsi-dev-tools.zip -DestinationPath .
- .\opsi-dev-tool.exe --self-install
- $pythonPath = py -3.11 -c "import sys; print(sys.executable)"
- poetry --version
- poetry env use $pythonPath
- poetry cache clear --all --quiet uibpypi
#- poetry lock --regenerate
- poetry install
- poetry run pytest --tb=short -x -o junit_family=xunit2 --junitxml=testreport_windows1.xml --cov-append --cov opsicommon --cov-report term --cov-report xml -v --ignore=tests\\test_logging.py tests
- poetry run pytest --tb=short -x -o junit_family=xunit2 --junitxml=testreport_windows2.xml --cov-append --cov opsicommon --cov-report term --cov-report xml -v tests\\test_logging.py
- .\opsi-dev-tool.exe -l info --testreport-merge testreport_windows1.xml testreport_windows2.xml testreport_windows.xml
- Rename-Item -Path .coverage -NewName coverage_windows
artifacts:
name: "python-opsi-common_test_windows"
paths:
- coverage.xml
- testreport_windows.xml
- coverage_windows
expire_in: 3 days
pytest-linux:
#when: manual
stage: test
script:
- apt update
- apt --yes install zstd # need zstd for packaging tests
- poetry --version
- poetry env use 3.11
- poetry cache clear --all --quiet uibpypi
#- poetry lock --regenerate
- poetry install
- poetry run pytest --tb=short -x -o junit_family=xunit2 --junitxml=testreport_linux1.xml --cov-append --cov opsicommon --cov-report term --cov-report xml -v --ignore=tests/test_logging.py tests
- poetry run pytest --tb=short -x -o junit_family=xunit2 --junitxml=testreport_linux2.xml --cov-append --cov opsicommon --cov-report term --cov-report xml -v tests/test_logging.py
- opsi-dev-tool -l info --testreport-merge testreport_linux1.xml testreport_linux2.xml testreport_linux.xml
- mv .coverage coverage_linux
artifacts:
name: "python-opsi-common_test_linux"
paths:
- coverage.xml
- testreport_linux.xml
- coverage_linux
expire_in: 3 days
pylint-pytest:
#when: manual
stage: test
needs:
# We want to combine test coverage from all test jobs
- job: pytest-windows
artifacts: true
- job: pytest-darwin
artifacts: true
- job: pytest-linux
artifacts: true
script:
- apt-get update
- apt-get --yes --allow-downgrades install libsqlite3-0=3.16.2-5+deb9u1
- apt-get --yes install sqlite3
- poetry env use 3.11
#- poetry lock --regenerate
- poetry install
- poetry run ruff check opsicommon tests
- poetry run mypy opsicommon tests
- for db in coverage_*; do sqlite3 $db 'update file set path=replace(substr(path,instr(path,"opsicommon")),"\","/");'; done
- echo -e '[run]\nrelative_files = True\n' > .coveragerc
- poetry run coverage combine coverage_*
- poetry run coverage xml
- poetry run coverage report
- opsi-dev-tool -l info --testreport-merge testreport_*.xml testreport.xml
coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+)%/'
artifacts:
name: "python-opsi-common_test"
paths:
- coverage.xml
expire_in: 3 days
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
junit: testreport.xml
apidoc:
stage: doc
when: manual
before_script:
- "which ssh-agent || (apt update && apt -y install openssh-client)"
- "which rsync || (apt update && apt -y install rsync)"
- mkdir -p ~/.ssh
- eval $(ssh-agent -s)
- ssh-add <(echo "$BLOG_PUBLISH_PRIVATE_KEY")
script:
- poetry env use 3.11
#- poetry lock --regenerate
- poetry install
- poetry run poetry run opsi-dev-cli apidoc makehtml --output python-opsi-common
- ssh -o StrictHostKeyChecking=no "[email protected]" "mkdir -p /var/lib/docker/volumes/docs_nginx_data/_data/python-docs"
- rsync -e "ssh -o StrictHostKeyChecking=no" --delete -azv python-opsi-common "[email protected]:/var/lib/docker/volumes/docs_nginx_data/_data/python-docs/"
uibpypi:
stage: publish
script:
- poetry env use 3.11
#- poetry lock --regenerate
- poetry install
- opsi-dev-tool -l info --uib-pypi-publish
only:
- tags