From 9cb7aad32cb3de656043dfffacfa4259d058fbf3 Mon Sep 17 00:00:00 2001 From: itmodulo Date: Tue, 1 Jul 2025 16:53:31 +0200 Subject: [PATCH] optimize ci, add Notify test1 --- .gitea/workflows/release_arm64v8-edge.yml | 118 +++++++++++++++------- edge/Notify/APKBUILD | 44 ++++++++ 2 files changed, 126 insertions(+), 36 deletions(-) create mode 100755 edge/Notify/APKBUILD diff --git a/.gitea/workflows/release_arm64v8-edge.yml b/.gitea/workflows/release_arm64v8-edge.yml index 75ce368..c14640f 100755 --- a/.gitea/workflows/release_arm64v8-edge.yml +++ b/.gitea/workflows/release_arm64v8-edge.yml @@ -8,50 +8,96 @@ on: jobs: compilation-arm64v8: runs-on: aarch-64-alpine-edge + env: + REPO_URL: "https://alpine.sakamoto.pl/alpine/edge/testing/aarch64" + REMOTE_SSH: "${{ secrets.SERVER_LOGIN_AND_ADDRESS }}" + REMOTE_PORT: "${{ secrets.LOGIN_PORT }}" + REMOTE_PATH: "${{ secrets.SERVER_REPO_PATH }}/edge/main/aarch64" steps: - - name: Select faster mirror and add tools + - name: Install base tools shell: sh run: | - echo "https://alpine.sakamoto.pl/alpine/$(cat /etc/os-release | grep PRETT | cut -d ' ' -f 3 | cut -d '"' -f 1)/main" > /etc/apk/repositories - echo "https://alpine.sakamoto.pl/alpine/$(cat /etc/os-release | grep PRETT | cut -d ' ' -f 3 | cut -d '"' -f 1)/community" >> /etc/apk/repositories - echo "https://alpine.sakamoto.pl/alpine/$(cat /etc/os-release | grep PRETT | cut -d ' ' -f 3 | cut -d '"' -f 1)/testing" >> /etc/apk/repositories - apk -U upgrade - apk add bash git wget curl nodejs sshfs alpine-sdk abuild sudo shadow - - name: Checkout + # faster mirror + essential build tools + echo "https://alpine.sakamoto.pl/alpine/$(. /etc/os-release; echo $PRETTY_NAME|cut -d '"' -f2)/main" > /etc/apk/repositories + echo "https://alpine.sakamoto.pl/alpine/$(. /etc/os-release; echo $PRETTY_NAME|cut -d '"' -f2)/community" >> /etc/apk/repositories + echo "https://alpine.sakamoto.pl/alpine/$(. /etc/os-release; echo $PRETTY_NAME|cut -d '"' -f2)/testing" >> /etc/apk/repositories + apk update && apk upgrade + apk add bash git curl alpine-sdk abuild sudo shadow fuse sshfs + + - name: Checkout sources uses: actions/checkout@v4 - - name: Set up environment and users + + - name: Prepare runner user run: | echo "user_allow_other" >> /etc/fuse.conf - adduser runner -u 1003 -D -s /bin/bash -G wheel addgroup -g 1003 runner - addgroup runner abuild - addgroup runner runner - chmod 660 /etc/sudoers - echo "%wheel ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers + adduser -u 1003 -D -s /bin/bash -G wheel,abuild runner + echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers chmod 440 /etc/sudoers - mkdir -p /var/cache/distfiles - chmod a+w /var/cache/distfiles - chsh -s /bin/bash - su - runner -c 'mkdir ~/.abuild' - echo "setup done" - - name: Set up keys + mkdir -p /var/cache/distfiles && chmod a+w /var/cache/distfiles + + - name: Fetch remote index and parse existing pkgs + id: get_remote + shell: bash run: | - wget -q https://static.itmodulo.eu/dl/repo/public_keys/alpine/itmodulo%40disroot.org-65b4f779.rsa.pub -P /etc/apk/keys - su - runner -c 'wget -q https://static.itmodulo.eu/dl/repo/public_keys/alpine/itmodulo%40disroot.org-65b4f779.rsa.pub -P ~/.abuild/' - echo "${{ secrets.REPO_PRIVKEY }}" > /home/runner/.abuild/${{ secrets.REPO_PRIVKEY_FILENAME }} && chown runner:runner /home/runner/.abuild/${{ secrets.REPO_PRIVKEY_FILENAME }} - su - runner -c "echo 'PACKAGER_PRIVKEY="/home/runner/.abuild/${{ secrets.REPO_PRIVKEY_FILENAME }}"' >> ~/.abuild/abuild.conf" - - name: Compile in sequence + mkdir -p remote_index + curl -sfL "${REPO_URL}/APKINDEX.tar.gz" -o remote_index/APKINDEX.tar.gz + tar -xzf remote_index/APKINDEX.tar.gz -C remote_index + # Extract P: and V: fields into a list of "name-version-pkgrel" + awk ' + /^P:/ { pkg=$2 } + /^V:/ { ver=$2 } + /^PR:/ { pr=$2; print pkg "-" ver "-" pr } + ' remote_index/APKINDEX > remote_index/list.txt + echo "::set-output name=existing::$(sort remote_index/list.txt | paste -sd, -)" + + - name: Build only missing packages + shell: bash run: | - ls srcpkgs | tr ' ' '\n' - mv edge /home/runner/srcpkgs && chown -R runner:runner /home/runner/srcpkgs - echo "/home/runner/packages/srcpkgs" >> /etc/apk/repositories - su - runner -c 'export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"; cd srcpkgs; for i in $(ls ./ ); do cd $i && abuild -r -c; cd .. ; done' - - name: Mount and upload + EXISTING="$(echo "${{ steps.get_remote.outputs.existing }}" | tr ',' '\n')" + mkdir -p built newpkgs + for d in srcpkgs/*; do + cd "$d" + # source the APKBUILD so we get PKGNAME, PKGVER, PKGREL + . APKBUILD + ident="${PKGNAME}-${PKGVER}-${PKGREL}" + if echo "$EXISTING" | grep -qx "$ident"; then + echo "Skipping $ident (already in repo)" + else + echo "Building $ident..." + abuild -r -c + # collect the resulting .apk + mv /home/runner/packages/srcpkgs/aarch64/${PKGNAME}-*.apk ../../newpkgs/ || true + fi + cd - >/dev/null + done + + - name: Sync new pkgs, clean old versions, rebuild & sign index + shell: bash run: | - su - runner -c 'mkdir hole' - echo "${{ secrets.REPO_LOGIN }}" > /home/runner/id_ecdsa && chown runner:runner /home/runner/id_ecdsa && chmod 600 /home/runner/id_ecdsa - su - runner -c 'sshfs -p "${{ secrets.LOGIN_PORT }}" -o StrictHostKeyChecking=accept-new -o default_permissions,allow_other -o IdentityFile=/home/runner/id_ecdsa "${{ secrets.SERVER_LOGIN_AND_ADDRESS }}":"${{ secrets.SERVER_REPO_PATH }}" /home/runner/hole' - su - runner -c 'ls -lah /home/runner/hole/edge/main/aarch64/' - su - runner -c 'rm -rf hole/edge/main/aarch64/*' - su - runner -c 'cp packages/srcpkgs/aarch64/* hole/edge/main/aarch64/' - su - runner -c 'ls -lah /home/runner/hole/edge/main/aarch64/' + # prepare SSH key for sshfs + echo "${{ secrets.REPO_LOGIN }}" > /home/runner/id_ecdsa + chmod 600 /home/runner/id_ecdsa + mkdir -p /home/runner/remote + sshfs -p "${REMOTE_PORT}" -o StrictHostKeyChecking=accept-new \ + -o IdentityFile=/home/runner/id_ecdsa \ + "${REMOTE_SSH}:${REMOTE_PATH}" /home/runner/remote + + cd /home/runner/remote + + # For each newly-built package, remove older versions + for pkg in /home/runner/newpkgs/*.apk; do + base=$(basename "$pkg" | sed -E 's/(-[0-9]+\.[0-9]+.*)//') + rm -f ${base}-*.apk || true + done + + # Copy over the truly new files + cp /home/runner/newpkgs/*.apk . + + # Rebuild the index + apk index -o APKINDEX.tar.gz *.apk + + # Sign it + abuild-sign APKINDEX.tar.gz + + fusermount -u /home/runner/remote diff --git a/edge/Notify/APKBUILD b/edge/Notify/APKBUILD new file mode 100755 index 0000000..da91356 --- /dev/null +++ b/edge/Notify/APKBUILD @@ -0,0 +1,44 @@ +pkgname=Notify +pkgver=0.1.6 +pkgrel=0 +pkgdesc="Linux client for https://ntfy.sh pub-sub unifiedpush compatible server" +url="https://github.com/ranfdev/Notify" +arch="all" +license="GPL-3.0-or-later" +depends="capnproto sqlite" +makedepends=" + gnome-desktop-dev + libadwaita-dev + meson + gtk4.0-dev + gobject-introspection-dev + desktop-file-utils + appstream + rust + cargo + openssl-dev + pkgconf + gcc + musl-dev + sqlite-dev + gtksourceview5-dev + blueprint-compiler + capnproto-dev + " +source="$pkgname-$pkgver.tar.gz::https://github.com/ranfdev/Notify/archive/refs/tags/v$pkgver.tar.gz" + +options="!check" + +build() { + abuild-meson \ + --buildtype=release \ + . output + meson compile -C output +} + +package() { + DESTDIR="$pkgdir" meson install --no-rebuild -C output +} +sha512sums=" +595b1e584e04204b4295092092a3f2249d402b43fa3d51ef24f69d3a51657ad9e73bc3ef27b8f38792d507891a44d302c52aa4ab9ff2184116dffe6dcf87b7fa Notify-0.1.6.tar.gz +"