prometheus-tlsrpt-exporter/.woodpecker.yml

85 lines
4.4 KiB
YAML
Raw Normal View History

2023-07-23 20:19:37 +02:00
---
pipeline:
test:
image: python:3.11-bookworm
group: test
commands:
- pip3 install -e .[test]
2023-07-23 20:27:24 +02:00
- python3 -m coverage run --rcfile=setup.cfg -m unittest discover tlsrpt_exporter
- python3 -m coverage combine
- python3 -m coverage report --rcfile=setup.cfg
2023-07-23 20:19:37 +02:00
codestyle:
image: python:3.11-bookworm
group: test
commands:
- pip3 install -e .[test]
2023-07-23 20:22:56 +02:00
- pycodestyle tlsrpt_exporter
2023-07-23 20:19:37 +02:00
build_wheel:
image: python:3.11-bookworm
group: package
commands:
- python3 setup.py egg_info bdist_wheel
2023-07-24 23:26:32 +02:00
- mkdir -p "publish/prometheus-tlsrpt-exporter_$${EXPORTER_VERSION}"
2023-07-24 23:31:04 +02:00
- mv dist/*whl "publish/prometheus-tlsrpt-exporter_$${EXPORTER_VERSION}"
2023-07-24 23:26:32 +02:00
- cd "publish/prometheus-tlsrpt-exporter_$${EXPORTER_VERSION}"
2023-07-24 23:29:18 +02:00
- sha256sum *.whl >> SHA256SUMS
2023-07-24 23:26:32 +02:00
- cp *.whl ..
2023-07-23 20:19:37 +02:00
build_debian:
image: python:3.11-bookworm
group: package
2023-07-23 21:02:32 +02:00
environment:
- PACKAGE_AUTHOR=s3lph@kabelsalat.ch
2023-07-23 20:19:37 +02:00
commands:
2023-07-23 20:55:04 +02:00
- apt update; apt install -y lintian rsync sudo
2023-07-23 20:19:37 +02:00
- export EXPORTER_VERSION=$(python3 -c 'import tlsrpt_exporter; print(tlsrpt_exporter.__version__)')
2023-07-23 21:02:32 +02:00
- echo -n > package/debian/prometheus-tlsrpt-exporter/usr/share/doc/prometheus-tlsrpt-exporter/changelog
- |
for version in "$(cat CHANGELOG.md | grep '<!-- BEGIN CHANGES' | cut -d ' ' -f 4)"; do
2023-07-24 01:04:54 +02:00
echo -e "prometheus-tlsrpt-exporter ($${version}-1); urgency=medium\n" >> package/debian/prometheus-tlsrpt-exporter/usr/share/doc/prometheus-tlsrpt-exporter/changelog
cat CHANGELOG.md | grep -A 1000 "<"'!'"-- BEGIN CHANGES $${version} -->" | grep -B 1000 "<"'!'"-- END CHANGES $${version} -->" | tail -n +2 | head -n -1 | sed -re 's/^-/ */g' >> package/debian/prometheus-tlsrpt-exporter/usr/share/doc/prometheus-tlsrpt-exporter/changelog
echo -e "\n -- $${PACKAGE_AUTHOR} $(date -R)\n" >> package/debian/prometheus-tlsrpt-exporter/usr/share/doc/prometheus-tlsrpt-exporter/changelog
2023-07-23 21:02:32 +02:00
done
- gzip -9n package/debian/prometheus-tlsrpt-exporter/usr/share/doc/prometheus-tlsrpt-exporter/changelog
2023-07-23 20:19:37 +02:00
- mkdir -p package/debian/prometheus-tlsrpt-exporter/usr/share/prometheus-tlsrpt-exporter
- cp -r templates/ package/debian/prometheus-tlsrpt-exporter/usr/share/prometheus-tlsrpt-exporter/templates/
- python3 setup.py egg_info install --root=package/debian/prometheus-tlsrpt-exporter/ --prefix=/usr --optimize=1
- cd package/debian
- mkdir -p prometheus-tlsrpt-exporter/usr/lib/python3/dist-packages/
2023-07-23 20:43:08 +02:00
- rsync -a prometheus-tlsrpt-exporter/usr/lib/python3.11/site-packages/ prometheus-tlsrpt-exporter/usr/lib/python3/dist-packages/
2023-07-23 20:19:37 +02:00
- rm -rf prometheus-tlsrpt-exporter/usr/lib/python3.11/
- find prometheus-tlsrpt-exporter/usr/lib/python3/dist-packages -name __pycache__ -exec rm -r {} \; 2>/dev/null || true
- find prometheus-tlsrpt-exporter/usr/lib/python3/dist-packages -name '*.pyc' -exec rm {} \;
2023-07-23 21:02:32 +02:00
- sed -re 's$#!/usr/local/bin/python3$#!/usr/bin/python3$' -i prometheus-tlsrpt-exporter/usr/bin/prometheus-tlsrpt-exporter
2023-07-23 20:19:37 +02:00
- find prometheus-tlsrpt-exporter -type f -exec chmod 0644 {} \;
- find prometheus-tlsrpt-exporter -type d -exec chmod 755 {} \;
- chmod +x prometheus-tlsrpt-exporter/usr/bin/prometheus-tlsrpt-exporter prometheus-tlsrpt-exporter/DEBIAN/postinst prometheus-tlsrpt-exporter/DEBIAN/prerm
2023-07-23 20:53:08 +02:00
- sed -re "s/__VERSION__/$${EXPORTER_VERSION}-1/g" -i prometheus-tlsrpt-exporter/DEBIAN/control
2023-07-23 20:19:37 +02:00
- dpkg-deb --build prometheus-tlsrpt-exporter
2023-07-24 00:23:38 +02:00
- cd ../..
2023-07-24 23:26:32 +02:00
- mkdir -p "publish/prometheus-tlsrpt-exporter_$${EXPORTER_VERSION}"
- mv package/debian/prometheus-tlsrpt-exporter.deb "publish/prometheus-tlsrpt-exporter_$${EXPORTER_VERSION}/prometheus-tlsrpt-exporter_$${EXPORTER_VERSION}-1_all.deb"
- cd "publish/prometheus-tlsrpt-exporter_$${EXPORTER_VERSION}"
- sudo -u nobody lintian "prometheus-tlsrpt-exporter_$${EXPORTER_VERSION}-1_all.deb" || true
2023-07-24 23:29:18 +02:00
- sha256sum "prometheus-tlsrpt-exporter_$${EXPORTER_VERSION}-1_all.deb" >> SHA256SUMS
2023-07-24 23:26:32 +02:00
- cp "prometheus-tlsrpt-exporter_$${EXPORTER_VERSION}-1_all.deb" ..
2023-07-24 00:23:38 +02:00
upload:
image: woodpeckerci/plugin-s3
group: upload
settings:
2023-07-24 00:44:20 +02:00
endpoint: https://minio.kabelsalat.ch
bucket: s3lph-prometheus-tlsrpt-exporter
2023-07-24 00:30:04 +02:00
access_key:
2023-07-24 00:44:20 +02:00
from_secret: S3_ACCESS_KEY_ID
2023-07-24 00:30:04 +02:00
secret_key:
2023-07-24 00:44:20 +02:00
from_secret: S3_SECRET_ACCESS_KEY
2023-07-24 23:33:31 +02:00
source: publish/**/*
2023-07-24 00:23:38 +02:00
target: /artifacts
path_style: true
2023-07-24 00:44:20 +02:00
strip_prefix: true