diff --git a/.forgejo/workflows/package.yml b/.forgejo/workflows/package.yml new file mode 100644 index 0000000..79af25d --- /dev/null +++ b/.forgejo/workflows/package.yml @@ -0,0 +1,72 @@ +--- + +on: + push: tags + +jobs: + + build_wheel: + runs-on: docker + env: + API_USERNAME: "${{ secrets.API_USERNAME }}" + API_PASSWORD: "${{ secrets.API_PASSWORD }}" + API_REPOSITORY_PYPI: "${{ secrets.API_REPOSITORY_PYPI }}" + steps: + - uses: https://code.forgejo.org/actions/checkout@v4 + - name: build_debian + run: | + apt update; apt install -y python3-pip + pip3 install -e .[test] + python3 setup.py egg_info bdist_wheel + cat > ~/.pypirc <" + API_USERNAME: "${{ secrets.API_USERNAME }}" + API_PASSWORD: "${{ secrets.API_PASSWORD }}" + API_REPOSITORY_DEB: "${{ secrets.API_REPOSITORY_DEB }}" + steps: + - uses: https://code.forgejo.org/actions/checkout@v4 + - name: build_debian + run: | + apt update; apt install -y python3-pip lintian rsync sudo curl + export EXPORTER_VERSION=$(python3 -c 'import tlsrpt_exporter; print(tlsrpt_exporter.__version__)') + echo -n > package/debian/prometheus-tlsrpt-exporter/usr/share/doc/prometheus-tlsrpt-exporter/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/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 + done + gzip -9n package/debian/prometheus-tlsrpt-exporter/usr/share/doc/prometheus-tlsrpt-exporter/changelog + 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/ + rsync -a prometheus-tlsrpt-exporter/usr/lib/python3.11/site-packages/ prometheus-tlsrpt-exporter/usr/lib/python3/dist-packages/ + 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 {} \; + sed -re 's$#!/usr/local/bin/python3$#!/usr/bin/python3$' -i prometheus-tlsrpt-exporter/usr/bin/prometheus-tlsrpt-exporter + 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 + sed -re "s/__VERSION__/${EXPORTER_VERSION}-1/g" -i prometheus-tlsrpt-exporter/DEBIAN/control + dpkg-deb --build prometheus-tlsrpt-exporter + mv "prometheus-tlsrpt-exporter.deb" "prometheus-tlsrpt-exporter_${EXPORTER_VERSION}-1_all.deb" + sudo -u nobody lintian "prometheus-tlsrpt-exporter_${EXPORTER_VERSION}-1_all.deb" || true + curl \ + --user "${API_USERNAME}:${API_PASSWORD}" + --upload-file "prometheus-tlsrpt-exporter_${EXPORTER_VERSION}-1_all.deb" + ${API_REPOSITORY_DEB} diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml new file mode 100644 index 0000000..171e778 --- /dev/null +++ b/.forgejo/workflows/test.yml @@ -0,0 +1,27 @@ +--- + +on: push + +jobs: + + test: + runs-on: docker + steps: + - uses: https://code.forgejo.org/actions/checkout@v4 + - name: test + run: | + - apt update; apt install --yes python3-pip + - pip3 install -e .[test] + - python3 -m coverage run --rcfile=setup.cfg -m unittest discover tlsrpt_exporter + - python3 -m coverage combine + - python3 -m coverage report --rcfile=setup.cfg + + codestyle: + runs-on: docker + steps: + - uses: https://code.forgejo.org/actions/checkout@v4 + - name: codestyle + run: | + - apt update; apt install --yes python3-pip + - pip3 install -e .[test] + - pycodestyle tlsrpt_exporter diff --git a/.woodpecker.yml b/.woodpecker.yml deleted file mode 100644 index 3fa93ba..0000000 --- a/.woodpecker.yml +++ /dev/null @@ -1,86 +0,0 @@ ---- - -pipeline: - - test: - image: python:3.11-bookworm - group: test - commands: - - pip3 install -e .[test] - - python3 -m coverage run --rcfile=setup.cfg -m unittest discover tlsrpt_exporter - - 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 tlsrpt_exporter - - 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 < package/debian/prometheus-tlsrpt-exporter/usr/share/doc/prometheus-tlsrpt-exporter/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/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 - done - - gzip -9n package/debian/prometheus-tlsrpt-exporter/usr/share/doc/prometheus-tlsrpt-exporter/changelog - - 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/ - - rsync -a prometheus-tlsrpt-exporter/usr/lib/python3.11/site-packages/ prometheus-tlsrpt-exporter/usr/lib/python3/dist-packages/ - - 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 {} \; - - sed -re 's$#!/usr/local/bin/python3$#!/usr/bin/python3$' -i prometheus-tlsrpt-exporter/usr/bin/prometheus-tlsrpt-exporter - - 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 - - sed -re "s/__VERSION__/$${EXPORTER_VERSION}-1/g" -i prometheus-tlsrpt-exporter/DEBIAN/control - - dpkg-deb --build prometheus-tlsrpt-exporter - - mv "prometheus-tlsrpt-exporter.deb" "prometheus-tlsrpt-exporter_$${EXPORTER_VERSION}-1_all.deb" - - sudo -u nobody lintian "prometheus-tlsrpt-exporter_$${EXPORTER_VERSION}-1_all.deb" || true - - >- - curl - --user "$${GITEA_API_USERNAME}:$${GITEA_API_PASSWORD}" - --upload-file "prometheus-tlsrpt-exporter_$${EXPORTER_VERSION}-1_all.deb" - $${GITEA_API_REPOSITORY_DEB}