spaceapi-server/.woodpecker.yml
s3lph f0b6bc7d66
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
chore: migrate from gitlab-ci to woodpecker
2023-10-25 04:10:48 +02:00

83 lines
3.3 KiB
YAML

---
steps:
test:
image: python:3.11-bookworm
group: test
commands:
- pip3 install -e .[test]
- python3 -m coverage run --rcfile=setup.cfg -m unittest discover spaceapi_server
- python3 -m coverage combine
- python3 -m coverage report --rcfile=setup.cfg
codestyle:
image: python:3.11-bookworm
group: test
commands:
- pip3 install -e .[test]
- pycodestyle spaceapi_server
build_wheel:
image: python:3.11-bookworm
group: package
when:
- event: tag
secrets:
- GITEA_API_REPOSITORY_PYPI
- GITEA_API_USERNAME
- GITEA_API_PASSWORD
commands:
- pip3 install -e .[test]
- python3 setup.py egg_info bdist_wheel
- |
cat > ~/.pypirc <<EOF
[distutils]
index-servers = gitea
[gitea]
repository = $${GITEA_API_REPOSITORY_PYPI}
username = $${GITEA_API_USERNAME}
password = $${GITEA_API_PASSWORD}
EOF
- python3 -m twine upload --repository gitea dist/*.whl
build_debian:
image: python:3.11-bookworm
group: package
when:
- event: tag
secrets:
- GITEA_API_REPOSITORY_DEB
- GITEA_API_USERNAME
- GITEA_API_PASSWORD
commands:
- apt update; apt install -y lintian rsync sudo curl
- export SPACEAPI_SERVER_VERSION=$(python -c 'import spaceapi_server; print(spaceapi_server.__version__)')
- |
(for version in "$(cat CHANGELOG.md | grep '<!-- BEGIN CHANGES' | cut -d ' ' -f 4)"; do
echo "spaceapi-server ($${version}-1) stable; urgency=medium\n"
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'
echo "\n -- s3lph@kabelsalat.ch $(date -R)\n"
done) > package/debian/spaceapi-server/usr/share/doc/spaceapi-server/changelog
- gzip -9n package/debian/spaceapi-server/usr/share/doc/spaceapi-server/changelog
- python3 setup.py egg_info install --root=package/debian/spaceapi-server/ --prefix=/usr --optimize=1
- cd package/debian
- mkdir -p spaceapi-server/usr/lib/python3/dist-packages/
- rsync -a spaceapi-server/usr/lib/python3.11/site-packages/ spaceapi-server/usr/lib/python3/dist-packages/
- rm -rf spaceapi-server/usr/lib/python3.11/
- find spaceapi-server/usr/lib/python3/dist-packages -name __pycache__ -exec rm -r {} \; 2>/dev/null || true
- find spaceapi-server/usr/lib/python3/dist-packages -name '*.pyc' -exec rm {} \;
- rm spaceapi-server/usr/bin/spaceapi-server
- find spaceapi-server -type f -exec chmod 0644 {} \;
- find spaceapi-server -type d -exec chmod 755 {} \;
- chmod 0755 spaceapi-server/DEBIAN/postinst spaceapi-server/DEBIAN/prerm spaceapi-server/DEBIAN/postrm
- sed -re "s/__VERSION__/$${SPACEAPI_SERVER_VERSION}-1/g" -i spaceapi-server/DEBIAN/control
- dpkg-deb --build spaceapi-server
- mv spaceapi-server.deb "spaceapi-server_$${SPACEAPI_SERVER_VERSION}-1_all.deb"
- sudo -u nobody lintian "spaceapi-server_$${SPACEAPI_SERVER_VERSION}-1_all.deb" || true
- >-
curl
--user "$${GITEA_API_USERNAME}:$${GITEA_API_PASSWORD}"
--upload-file "spaceapi-server_$${SPACEAPI_SERVER_VERSION}-1_all.deb"
$${GITEA_API_REPOSITORY_DEB}