-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
76 lines (67 loc) · 2.39 KB
/
.gitlab-ci.yml
File metadata and controls
76 lines (67 loc) · 2.39 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
image: docker.uib.gmbh/opsi/dev/pybuilder:deb9
stages:
- test
- doc
- publish
lint-and-test:
services:
- name: mysql:8.3
command:
- --max_connections=1000
- --default-authentication-plugin=mysql_native_password
variables:
MYSQL_ROOT_PASSWORD: "opsi"
MYSQL_DATABASE: "opsi"
OPSI_HOST_ID: "server.opsi.test"
stage: test
script: |
mkdir -p /etc/opsi/licenses
mkdir -p /var/log/opsi
# Installing opsi test license
[ -z "${OPSILICSRV_TOKEN}" ] && (echo "OPSILICSRV_TOKEN not set" 1>&2 ; exit 1)
wget --header="Authorization: Bearer ${OPSILICSRV_TOKEN}" "https://opsi-license-server.uib.gmbh/api/v1/licenses/test?usage=python-opsi-gitlab-ci" -O /etc/opsi/licenses/test.opsilic
cp tests/Backends/config.py.gitlabci tests/Backends/config.py
export UV_PYTHON="3.13"
export UV_PYTHON_PREFERENCE="only-managed"
uv self update
uv sync --frozen
uv run ruff check opsi_legacy tests
uv add mysqlclient==2.1.1
uv run pytest --tb=short -x -o junit_family=xunit2 --junitxml=testreport.xml --cov-append --cov-report term --cov-report xml -v tests
coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+)%/'
artifacts:
name: 'python-opsi_legacy_test'
paths:
- coverage.xml
- testreport.xml
reports:
junit: testreport.xml
expire_in: 14 days
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:
- export UV_PYTHON="3.13"
- export UV_PYTHON_PREFERENCE="only-managed"
- uv self update
- uv sync --frozen
- uv run opsi-dev-cli apidoc makehtml --output python-opsi-legacy
- 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-legacy "[email protected]:/var/lib/docker/volumes/docs_nginx_data/_data/python-docs/"
uibpypi:
stage: publish
script:
- export UV_PYTHON="3.13"
- export UV_PYTHON_PREFERENCE="only-managed"
- opsi-dev-cli self upgrade
- uv self update
- uv sync --frozen
- uv run opsi-dev-cli -l info pypi publish --url https://pypi.uib.gmbh --overwrite
only:
- tags