--- image: python:3.11-bookworm stages: - test - coverage - build - deploy - upload before_script: - pip3 install coverage pycodestyle mypy aiosmtpd deepdiff - export MULTISCHLEUDER_VERSION=$(python -c 'import multischleuder; print(multischleuder.__version__)') test: stage: test script: - pip3 install -e . - python3 -m coverage run --rcfile=setup.cfg -m unittest discover multischleuder artifacts: paths: - ".coverage*" codestyle: stage: test script: - pip3 install -e . - pycodestyle multischleuder mypy: stage: test script: - pip3 install -e . - mypy --install-types --non-interactive multischleuder - mypy multischleuder sast: stage: test bandit-sast: before_script: [''] include: - template: Security/SAST.gitlab-ci.yml - template: Security/Dependency-Scanning.gitlab-ci.yml schleuder: stage: test script: - debconf-set-selections <<<"postfix postfix/mailname string example.org" - debconf-set-selections <<<"postfix postfix/main_mailer_type string 'Local only'" - apt update; apt install --yes schleuder schleuder-cli postfix - /usr/lib/postfix/configure-instance.sh - - echo "virtual_alias_maps = static:root" >> /etc/postfix/main.cf - /usr/sbin/postmulti -i - -p start - schleuder-cli lists list || true - export CERT_FPR=$(schleuder cert fingerprint | cut -d' ' -f4) - echo " - '00000000000000000000000000000000'" >> /etc/schleuder/schleuder.yml - | cat > ~/.schleuder-cli/schleuder-cli.yml <- /(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/ script: - python3 -m coverage combine - python3 -m coverage report --rcfile=setup.cfg build_wheel: stage: build script: - python3 setup.py egg_info bdist_wheel - cd dist - sha256sum *.whl > SHA256SUMS artifacts: paths: - "dist/*.whl" - dist/SHA256SUMS only: - tags build_debian: stage: build script: - apt update && apt install --yes lintian rsync sudo - echo -n > package/debian/multischleuder/usr/share/doc/multischleuder/changelog - | for version in "$(cat CHANGELOG.md | grep '" | grep -B 1000 "<"'!'"-- END CHANGES ${version} -->" | tail -n +2 | head -n -1 | sed -re 's/^-/ */g' >> package/debian/multischleuder/usr/share/doc/multischleuder/changelog echo "\n -- ${PACKAGE_AUTHOR} $(date -R)\n" >> package/debian/multischleuder/usr/share/doc/multischleuder/changelog done - gzip -9n package/debian/multischleuder/usr/share/doc/multischleuder/changelog - python3 setup.py egg_info install --root=package/debian/multischleuder/ --prefix=/usr --optimize=1 - cd package/debian - sed -re "s/__MULTISCHLEUDER_VERSION__/${MULTISCHLEUDER_VERSION}/g" -i multischleuder/DEBIAN/control - mv multischleuder/usr/lib/python3.11 multischleuder/usr/lib/python3 - find multischleuder/usr/lib/python3/dist-packages -name __pycache__ -exec rm -r {} \; 2>/dev/null || true - find multischleuder/usr/lib/python3/dist-packages -name '*.pyc' -exec rm {} \; - find multischleuder/usr/lib/python3/dist-packages -name '*.pyo' -exec rm {} \; - sed -re 's$#!/usr/local/bin/python3$#!/usr/bin/python3$' -i multischleuder/usr/bin/multischleuder - find multischleuder -type f -exec chmod 0644 {} \; - find multischleuder -type d -exec chmod 755 {} \; - chmod +x multischleuder/usr/bin/multischleuder multischleuder/DEBIAN/postinst multischleuder/DEBIAN/prerm multischleuder/DEBIAN/postrm - dpkg-deb --build multischleuder - mv multischleuder.deb "multischleuder_${MULTISCHLEUDER_VERSION}-1_all.deb" - sudo -u nobody lintian "multischleuder_${MULTISCHLEUDER_VERSION}-1_all.deb" - sha256sum *.deb > SHA256SUMS artifacts: paths: - "package/debian/*.deb" - package/debian/SHA256SUMS only: - tags release: stage: deploy script: - python3 package/release.py only: - tags repo: stage: upload trigger: s3lph/custom-packages variables: MULTIPROJECT_TRIGGER_JOBNAME: multischleuder only: - tags