feat: migrate from woodpecker to forgejo actions
This commit is contained in:
parent
c7e3a79244
commit
4435ec6dcf
3 changed files with 70 additions and 86 deletions
43
.forgejo/workflows/package.yml
Normal file
43
.forgejo/workflows/package.yml
Normal file
|
@ -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"
|
27
.forgejo/workflows/test.yml
Normal file
27
.forgejo/workflows/test.yml
Normal file
|
@ -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
|
|
@ -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 <<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__)')
|
|
||||||
- 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
|
|
||||||
- |
|
|
||||||
(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}
|
|
Loading…
Reference in a new issue