/
.gitlab-ci.yml
116 lines (108 loc) · 4.1 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
image: docker.uib.gmbh/opsi/dev/pybuilder:uib-python-3.11
stages:
- test
- build
- publish
.prepare_tests: &prepare_tests |
bash /entrypoint.sh &
apt update
apt --yes install --no-install-recommends curl build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev
wget https://www.python.org/ftp/python/3.11.1/Python-3.11.1.tgz
tar -xvf Python-3.11.1.tgz
cd Python-3.11.1
./configure > /dev/null
make -j 2 build_all > /dev/null
make EXTRATESTOPTS=--list-tests altinstall
cd ..
python3.11 -m pip install certifi
curl -sSL https://install.python-poetry.org | SSL_CERT_FILE=$(python3.11 -c "import certifi;print(certifi.where())") python3.11 -
ln -s /root/.local/bin/poetry /usr/local/bin/poetry
while ! nc -v -z -w3 localhost 4447 > /dev/null 2>&1; do sleep 1; done
source /entrypoint.sh set_environment_vars # to set hosts for redis/grafana
poetry install
poetry run opsipxeconfd setup
.pytest: &pytest |
poetry run opsipxeconfd start --log-level 6 &
sleep 10
echo "---------------------------------------"
echo "Run tests"
echo "---------------------------------------"
poetry run pytest --tb=short -o junit_family=xunit2 --junitxml=testreport.xml --cov-append --cov opsipxeconfd --cov-report term --cov-report xml -v tests
.pylint: &pylint |
echo "---------------------------------------"
echo "Run linters"
echo "---------------------------------------"
poetry run ruff check opsipxeconfd tests
poetry run mypy opsipxeconfd tests
pylint-pytest:
image:
name: docker.uib.gmbh/opsi/opsi-server:4.3-stable
entrypoint: [""]
services:
- name: mysql:latest
command:
- --max_connections=1000
- --default-authentication-plugin=mysql_native_password
alias: mysql
- name: redislabs/redistimeseries:latest
alias: redis
variables:
REDIS_HOST: redis
OPSI_ADMIN_PASSWORD: vhahd8usaz # also hardcoded in tests/utils.py
OPSI_HOST_ROLE: configserver
OPSI_HOST_ID: "opsi-server.uib.gmbh" # "test.uib.gmbh"
OPSI_HOST_KEY: "550b759aedd834f2c41bf3d843779099"
OPSI_TFTPBOOT: "false"
MYSQL_HOST: mysql
MYSQL_ROOT_PASSWORD: "opsi"
MYSQL_DATABASE: "opsi"
MYSQL_USER: "opsi"
MYSQL_PASSWORD: "opsi"
#OPSICONFD_RESTORE_BACKUP_URL: "http://binaryindex.uib.gmbh/development/testbackup/all/all/testbackup_all_all_1.1.tar.gz"
stage: test
script:
- *prepare_tests
- *pylint
- *pytest
build:linux-pyinstaller:
stage: build
script:
- poetry install
- poetry run opsi-dev-cli -l info pyinstaller build
- mv opsipxeconfd opsipxeconfd.src
- mv dist/opsipxeconfd ./opsipxeconfd-amd64
# Check if binary is working
- ./opsipxeconfd-amd64/opsipxeconfd --version
- '[ "$CI_COMMIT_TAG" = "" ] && opsi-dev-cli -l info binary push opsipxeconfd-amd64 --prerelease="$CI_JOB_ID"'
- '[ "$CI_COMMIT_TAG" = "" ] || opsi-dev-cli -l info binary push opsipxeconfd-amd64'
artifacts:
name: "opsipxeconfd-linux-pyinstaller"
paths:
- opsipxeconfd-amd64
expire_in: 2 day
build:arm64-pyinstaller:
stage: build
tags:
- arm64
script:
- poetry install
- poetry run opsi-dev-cli -l info pyinstaller build
- mv dist/opsipxeconfd ./opsipxeconfd-arm64
# Check if binary is working
- ./opsipxeconfd-arm64/opsipxeconfd --version
- '[ "$CI_COMMIT_TAG" = "" ] && opsi-dev-cli -l info binary push opsipxeconfd-arm64 --prerelease="$CI_JOB_ID"'
- '[ "$CI_COMMIT_TAG" = "" ] || opsi-dev-cli -l info binary push opsipxeconfd-arm64'
artifacts:
name: "opsipxeconfd-arm64-pyinstaller"
paths:
- opsipxeconfd-arm64
expire_in: 2 day
publish:obs_ext:
stage: publish
script:
- opsi-dev-tool -l info --obs-update-package https://build.opensuse.org home:uibmz:opsi:4.3:development
- opsi-dev-cli -l 5 changelog from-git output
- opsi-dev-cli release-service register-package-version opsipxeconfd SERVER_PACKAGE --changelog-file output/changelog.md
- opsi-dev-cli release-service push-repository-state opsipxeconfd SERVER_PACKAGE SERVER_PACKAGE-4.3-development
only:
- tags