Skip to content

Commit

Permalink
[CI] Fix AUR test and push
Browse files Browse the repository at this point in the history
Broke in a8e360c
  • Loading branch information
mxmlnkn committed May 21, 2024
1 parent 8c33da0 commit 07e506f
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 58 deletions.
58 changes: 0 additions & 58 deletions .github/workflows/publish-rapidgzip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,61 +58,3 @@ jobs:
python3 -m build -o . --sdist ..
mv rapidgzip-*.tar* src.tar
conda build --token "$ANACONDA_TOKEN" .
Deploy-AUR:
needs: Deploy-Wheels
runs-on: ubuntu-latest
container:
image: archlinux
steps:
- name: Set Up Non-Root User # Because makepkg is an ass and forbids root from using it
run: |
groupadd sudo
useradd -m -G sudo user
echo '%sudo ALL=(ALL:ALL) NOPASSWD: ALL' >> /etc/sudoers
- name: Install System Dependencies
run: |
pacman -Syu --noconfirm
pacman -Sy --noconfirm base-devel git python python-pip python-setuptools rhash openssh
- name: Clone Repository
env:
RAPIDGZIP_AUR_SSH: ${{ secrets.RAPIDGZIP_AUR_SSH }}
run: |
chmod a+rwx .
chown user .
su user -c 'mkdir -p "$HOME/.ssh/"'
su user -c 'echo "$RAPIDGZIP_AUR_SSH" > "$HOME/.ssh/aur"'
su user -c 'echo -e "Host aur.archlinux.org\n IdentityFile ~/.ssh/aur\n User mxmln\n StrictHostKeyChecking no" > "$HOME/.ssh/config"'
su user -c 'chmod 0600 "$HOME/.ssh/config" "$HOME/.ssh/aur"'
su user -c 'chmod 0700 "$HOME/.ssh/"'
su user -c 'git clone ssh://aur@aur.archlinux.org/python-rapidgzip.git .'
- name: Update PKGBUILD
run: |
# Annoyingly, --no-deps is not sufficient and building the wheels would still be triggered even
# just for downloading the source tarball! But, --no-build-isolation seems to avoid that:
# https://discuss.python.org/t/pip-download-just-the-source-packages-no-building-no-metadata-etc/4651/7
pip download --no-binary :all: --no-deps --no-build-isolation rapidgzip
pkgver=$( echo rapidgzip-*.tar.gz | sed -E 's|rapidgzip-([0-9.]*).*[.]tar.gz|\1|' )
blake2b=$( python3 -c 'import hashlib, sys; h=hashlib.blake2b(digest_size=256 // 8); h.update(open(sys.argv[1], "rb").read()); print(h.digest().hex())' rapidgzip-*.tar.gz )
# Update PKGBUILD
sed -i "s|pkgver=.*|pkgver=$pkgver|" PKGBUILD
sed -i "s|sha256sums=.*|sha256sums=('$( rhash -p"%x{sha-256}" rapidgzip-*.tar.gz )')|" PKGBUILD
sed -i -E "s|(.*pythonhosted.org/packages)/[0-9a-f]{2}/[0-9a-f]{2}/[0-9a-f]*/(.*)|\1/${blake2b:0:2}/${blake2b:2:2}/${blake2b:4}/\2|" PKGBUILD
su user -c 'makepkg --printsrcinfo > .SRCINFO'
su user -c 'git add -f PKGBUILD .SRCINFO'
su user -c 'git config --local user.email "mxmlnknp@gmail.com"'
su user -c 'git config --local user.name "Maximilian Knespel"'
su user -c "git commit -m 'Update to $pkgver'"
su user -c 'git show'
- name: Test PKGBUILD
run: |
su user -c 'makepkg -s --noconfirm'
su user -c 'makepkg --noconfirm --install python-rapidgzip-*.tar.zst'
- name: Push PKGBUILD
run: |
su user -c 'git push'
59 changes: 59 additions & 0 deletions .github/workflows/wheels-rapidgzip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,62 @@ jobs:
env:
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD_RAPIDGZIP }}
run: twine upload --skip-existing -u __token__ dist/*

Deploy-AUR:
needs: Build-Wheels
runs-on: ubuntu-latest
container:
image: archlinux
steps:
- name: Set Up Non-Root User # Because makepkg is an ass and forbids root from using it
run: |
groupadd sudo
useradd -m -G sudo user
echo '%sudo ALL=(ALL:ALL) NOPASSWD: ALL' >> /etc/sudoers
- name: Install System Dependencies
run: |
pacman -Syu --noconfirm
pacman -Sy --noconfirm base-devel git python python-pip python-setuptools rhash openssh
- name: Clone Repository
env:
RAPIDGZIP_AUR_SSH: ${{ secrets.RAPIDGZIP_AUR_SSH }}
run: |
chmod a+rwx .
chown user .
su user -c 'mkdir -p "$HOME/.ssh/"'
su user -c 'echo "$RAPIDGZIP_AUR_SSH" > "$HOME/.ssh/aur"'
su user -c 'echo -e "Host aur.archlinux.org\n IdentityFile ~/.ssh/aur\n User mxmln\n StrictHostKeyChecking no" > "$HOME/.ssh/config"'
su user -c 'chmod 0600 "$HOME/.ssh/config" "$HOME/.ssh/aur"'
su user -c 'chmod 0700 "$HOME/.ssh/"'
su user -c 'git clone ssh://aur@aur.archlinux.org/python-rapidgzip.git .'
- name: Update PKGBUILD
run: |
# Annoyingly, --no-deps is not sufficient and building the wheels would still be triggered even
# just for downloading the source tarball! But, --no-build-isolation seems to avoid that:
# https://discuss.python.org/t/pip-download-just-the-source-packages-no-building-no-metadata-etc/4651/7
pip download --no-binary :all: --no-deps --no-build-isolation rapidgzip
pkgver=$( echo rapidgzip-*.tar.gz | sed -E 's|rapidgzip-([0-9.]*).*[.]tar.gz|\1|' )
blake2b=$( python3 -c 'import hashlib, sys; h=hashlib.blake2b(digest_size=256 // 8); h.update(open(sys.argv[1], "rb").read()); print(h.digest().hex())' rapidgzip-*.tar.gz )
# Update PKGBUILD
sed -i "s|pkgver=.*|pkgver=$pkgver|" PKGBUILD
sed -i "s|sha256sums=.*|sha256sums=('$( rhash -p"%x{sha-256}" rapidgzip-*.tar.gz )')|" PKGBUILD
sed -i -E "s|(.*pythonhosted.org/packages)/[0-9a-f]{2}/[0-9a-f]{2}/[0-9a-f]*/(.*)|\1/${blake2b:0:2}/${blake2b:2:2}/${blake2b:4}/\2|" PKGBUILD
su user -c 'makepkg --printsrcinfo > .SRCINFO'
su user -c 'git add -f PKGBUILD .SRCINFO'
su user -c 'git config --local user.email "mxmlnknp@gmail.com"'
su user -c 'git config --local user.name "Maximilian Knespel"'
su user -c "git commit -m 'Update to $pkgver'"
su user -c 'git show'
- name: Test PKGBUILD
run: |
su user -c 'makepkg -s --noconfirm'
su user -c 'makepkg --noconfirm --install python-rapidgzip-*.tar.zst'
- name: Push PKGBUILD
if: startsWith(github.ref, 'refs/tags/')
run: |
su user -c 'git push'

0 comments on commit 07e506f

Please sign in to comment.