From 19cde329095b45b450fcd78b0bb7dd4234618fcb Mon Sep 17 00:00:00 2001 From: s3lph Date: Tue, 19 Dec 2023 07:29:11 +0100 Subject: [PATCH] feat: migrate from woodpecker to forgejo actions --- .forgejo/workflows/package.yml | 38 +++++++ .forgejo/workflows/test.yml | 74 ++++++++++++++ .woodpecker.yml | 137 -------------------------- CHANGELOG.md | 13 +++ easywks/__init__.py | 2 +- package/debian/easywks/DEBIAN/control | 2 +- 6 files changed, 127 insertions(+), 139 deletions(-) create mode 100644 .forgejo/workflows/package.yml create mode 100644 .forgejo/workflows/test.yml delete mode 100644 .woodpecker.yml diff --git a/.forgejo/workflows/package.yml b/.forgejo/workflows/package.yml new file mode 100644 index 0000000..394e6c5 --- /dev/null +++ b/.forgejo/workflows/package.yml @@ -0,0 +1,38 @@ +--- + +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 + - uses: https://git.kabelsalat.ch/s3lph/forgejo-action-python-debian-package@v5 + with: + python_module: easywks + package_name: easywks + package_root: package/debian/easywks + 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..8325149 --- /dev/null +++ b/.forgejo/workflows/test.yml @@ -0,0 +1,74 @@ +--- + +on: push + +jobs: + + test: + runs-on: docker + steps: + - uses: https://code.forgejo.org/actions/checkout@v4 + - name: Run unit tests + run: | + apt update; apt install -y python3-pip + pip3 install --break-system-packages -e .[test] + python3 -m coverage run --rcfile=setup.cfg -m unittest discover easywks + 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: pycodestyle + run: | + apt update; apt install -y python3-pip + pip3 install --break-system-packages -e .[test] + pycodestyle easywks + + easywksserver_gpgwksclient: + runs-on: docker + steps: + - uses: https://code.forgejo.org/actions/checkout@v4 + - name: Integration Test against gpg-wks-client + run: | + apt update; apt install --yes gnupg2 socat ca-certificates python3-pip + echo "openpgpkey" > /etc/hostname + echo "127.0.0.1 openpgpkey.example.org openpgpkey example.org" > /etc/hosts + pip3 install --break-system-packages -e .[test] + openssl req -x509 -newkey rsa:4096 -keyout /etc/ssl/key.pem -out /etc/ssl/cert.pem -sha256 -days 365 -nodes -subj '/CN=openpgpkey.example.org' + cp /etc/ssl/cert.pem /usr/local/share/ca-certificates/local.crt + update-ca-certificates + mkdir -p /tmp/easywks + cat > /tmp/easywks.yml < /etc/hostname - - echo "127.0.0.1 openpgpkey.example.org openpgpkey example.org" > /etc/hosts - - pip3 install -e .[test] - - apt update; apt install --yes gnupg2 socat ca-certificates - - openssl req -x509 -newkey rsa:4096 -keyout /etc/ssl/key.pem -out /etc/ssl/cert.pem -sha256 -days 365 -nodes -subj '/CN=openpgpkey.example.org' - - cp /etc/ssl/cert.pem /usr/local/share/ca-certificates/local.crt - - update-ca-certificates - - mkdir -p /tmp/easywks - - | - cat > /tmp/easywks.yml <- - export FINGERPRINT="$(gpg --with-colons --fingerprint alice@example.org | grep -A1 ^pub | grep ^fpr | cut -d: -f10)" - - /usr/lib/gnupg/gpg-wks-client --supported alice@example.org - - /usr/lib/gnupg/gpg-wks-client --check webkey@example.org - - PUBREQ="$(/usr/lib/gnupg/gpg-wks-client --create "$${FINGERPRINT}" alice@example.org)" - - CONFREQ="$(echo "$${PUBREQ}" | easywks --config /tmp/easywks.yml process)" - - CONFRESP="$(echo "$${CONFREQ}" | /usr/lib/gnupg/gpg-wks-client --receive --verbose)" - - PUBRESP="$(echo "$${CONFRESP}" | easywks --config /tmp/easywks.yml process)" - - echo "$${PUBRESP}" | gpg --batch --decrypt - - /usr/lib/gnupg/gpg-wks-client --check alice@example.org - - export GNUPGHOME=/tmp/gpg - - gpg --auto-key-locate=clear,wkd,nodefault --locate-keys alice@example.org - - kill %2 || true - - kill %1 || true - - coverage: - image: python:3.11-bookworm - group: integration - commands: - - pip3 install -e .[test] - - python3 -m coverage combine - - python3 -m coverage report --rcfile=setup.cfg - - 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/easywks/usr/share/doc/easywks/changelog - - gzip -9n package/debian/easywks/usr/share/doc/easywks/changelog - - python3 setup.py egg_info install --root=package/debian/easywks/ --prefix=/usr --optimize=1 - - cd package/debian - - sed -re "s/__EASYWKS_VERSION__/$${EASYWKS_VERSION}/g" -i easywks/DEBIAN/control - - mkdir -p easywks/usr/lib/python3/dist-packages/ - - rsync -a easywks/usr/lib/python3.11/site-packages/ easywks/usr/lib/python3/dist-packages/ - - rm -rf easywks/usr/lib/python3.11/site-packages - - find easywks/usr/lib/python3/dist-packages -name __pycache__ -exec rm -r {} \; 2>/dev/null || true - - find easywks/usr/lib/python3/dist-packages -name '*.pyc' -exec rm {} \; - - find easywks/usr/lib/python3/dist-packages -name '*.pyo' -exec rm {} \; - - sed -re 's$#!/usr/local/bin/python3$#!/usr/bin/python3$' -i easywks/usr/bin/easywks - - find easywks -type f -exec chmod 0644 {} \; - - find easywks -type d -exec chmod 755 {} \; - - chmod +x easywks/usr/bin/easywks easywks/DEBIAN/postinst easywks/DEBIAN/prerm easywks/DEBIAN/postrm - - dpkg-deb --build easywks - - mv easywks.deb "easywks_$${EASYWKS_VERSION}-1_all.deb" - - sudo -u nobody lintian "easywks_$${EASYWKS_VERSION}-1_all.deb" || true - - >- - curl - --user "$${GITEA_API_USERNAME}:$${GITEA_API_PASSWORD}" - --upload-file "easywks_$${EASYWKS_VERSION}-1_all.deb" - $${GITEA_API_REPOSITORY_DEB} diff --git a/CHANGELOG.md b/CHANGELOG.md index dd50ba3..828619d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # EasyWKS Changelog + +## Version 0.4.5 + +Migrate from Woodpecker CI to Forgejo Actions + +### Changes + + +- Migrate from Woodpecker CI to Forgejo Actions + + + + ## Version 0.4.4 diff --git a/easywks/__init__.py b/easywks/__init__.py index 64d60f8..7553f16 100644 --- a/easywks/__init__.py +++ b/easywks/__init__.py @@ -1,2 +1,2 @@ -__version__ = '0.4.4' +__version__ = '0.4.5' diff --git a/package/debian/easywks/DEBIAN/control b/package/debian/easywks/DEBIAN/control index 74adfcd..ee2e95d 100644 --- a/package/debian/easywks/DEBIAN/control +++ b/package/debian/easywks/DEBIAN/control @@ -1,5 +1,5 @@ Package: easywks -Version: __EASYWKS_VERSION__ +Version: __VERSION__ Maintainer: s3lph <1375407-s3lph@users.noreply.gitlab.com> Section: web Priority: optional