diff --git a/.forgejo/workflows/package.yml b/.forgejo/workflows/package.yml new file mode 100644 index 0000000..ddd8b73 --- /dev/null +++ b/.forgejo/workflows/package.yml @@ -0,0 +1,43 @@ +--- + +on: + push: + tags: + - "v*" + +jobs: + + build_wheel: + runs-on: docker + steps: + - uses: https://code.forgejo.org/actions/checkout@v4 + - name: Build Python wheel + run: | + apt update; apt install -y python3-pip + pip3 install --break-system-packages -e .[test] + python3 setup.py egg_info bdist_wheel + - uses: https://git.kabelsalat.ch/s3lph/forgejo-action-wheel-package-upload@v3 + with: + username: ${{ secrets.API_USERNAME }} + password: ${{ secrets.API_PASSWORD }} + + build_debian: + runs-on: docker + steps: + - uses: https://code.forgejo.org/actions/checkout@v4 + - name: Prepare package + run: | + find package/debian -name .gitkeep -delete + # Copy example plugin + install -m0644 examples/plugins/filestate.py package/debian/spaceapi-server/etc/spaceapi-server/plugins/filestate.py + - uses: https://git.kabelsalat.ch/s3lph/forgejo-action-python-debian-package@v4 + with: + python_module: spaceapi_server + package_name: spaceapi-server + package_root: package/debian/spaceapi-server + package_output_path: package/debian + - uses: https://git.kabelsalat.ch/s3lph/forgejo-action-debian-package-upload@v2 + with: + username: ${{ secrets.API_USERNAME }} + password: ${{ secrets.API_PASSWORD }} + deb: "package/debian/*.deb" diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml new file mode 100644 index 0000000..f7a2468 --- /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 --break-system-packages -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: + runs-on: docker + steps: + - uses: https://code.forgejo.org/actions/checkout@v4 + - name: codestyle + run: | + apt update; apt install --yes python3-pip + pip3 install --break-system-packages -e .[test] + pycodestyle spaceapi_server diff --git a/.woodpecker.yml b/.woodpecker.yml deleted file mode 100644 index 73602fa..0000000 --- a/.woodpecker.yml +++ /dev/null @@ -1,86 +0,0 @@ ---- - -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 <" | 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}