From 7bd2e9da0e643cba8b9232abd211b568d532891d Mon Sep 17 00:00:00 2001 From: Martin Larralde <martin.larralde@embl.de> Date: Mon, 18 Jul 2022 15:09:38 +0200 Subject: [PATCH] Configure `package.yml` Actions workflow to release an Arch User Repository `PKGBUILD` --- .github/workflows/package.yml | 38 +++++++++++++++++++++++++++++++++++ pkg/aur/PKGBUILD.in | 35 ++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 pkg/aur/PKGBUILD.in diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index eaa4894..fcd0a40 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -296,3 +296,41 @@ jobs: uses: rasmus-saks/release-a-changelog-action@v1.0.1 with: github-token: '${{ secrets.GITHUB_TOKEN }}' + + aur: + environment: Arch Linux User Repository + runs-on: ubuntu-latest + name: Update AUR package + needs: + - sdist + - upload + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + submodules: true + - name: Set up Python 3.10 + uses: actions/setup-python@v2 + with: + python-version: '3.10' + - name: Download source distribution + uses: actions/download-artifact@v2 + with: + name: dist + path: dist + - name: Extract package version + run: echo PKGVER=$(python setup.py --version) >> $GITHUB_ENV + - name: Compute SHA256 of source distribution + run: echo SHA256=$(sha256sum dist/pyrodigal-${{ env.PKGVER }}.tar.gz | cut -f1 -d' ') >> $GITHUB_ENV + - name: Generate PKGBUILD + run: sed -e "s/%pkgver/${{ env.PKGVER }}/g" -e "s/%sha256sum/${{ env.SHA256 }}/g" pkg/aur/PKGBUILD.in > pkg/aur/PKGBUILD + - name: Update package + uses: KSXGitHub/github-actions-deploy-aur@v2.2.5 + with: + pkgname: python-pyrodigal + pkgbuild: pkg/aur/PKGBUILD + commit_username: ${{ secrets.AUR_USER }} + commit_email: ${{ secrets.AUR_EMAIL }} + ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} + commit_message: ${{ github.event.head_commit.message }} + ssh_keyscan_types: rsa,dsa,ecdsa,ed25519 diff --git a/pkg/aur/PKGBUILD.in b/pkg/aur/PKGBUILD.in new file mode 100644 index 0000000..b5888fd --- /dev/null +++ b/pkg/aur/PKGBUILD.in @@ -0,0 +1,35 @@ +# Maintainer: Martin Larralde <martin.larralde@embl.de> + +_name=pyfastani +pkgname=python-${_name} +pkgver=%pkgver +pkgrel=1 +pkgdesc="Cython bindings and Python interface to FastANI, a method for fast whole-genome similarity estimation" +url="https://github.com/althonos/${_name}" +arch=('i686' 'pentium4' 'x86_64' 'arm' 'armv6h' 'armv7h' 'aarch64') +license=("MIT") +groups=() +makedepends=('python-setuptools' 'cython' 'python-build' 'python-installer') +depends=('python') +source=("https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.tar.gz") +noextract=() +sha256sums=(%sha256sum) + +build() { + cd "${srcdir}/${_name}-${pkgver}" + python -m build --wheel --no-isolation +} + +check() { + local pyver=$(python -c 'import sys; print("{}.{}".format(*sys.version_info[:2]))') + local machine=$(python -c 'import platform; print(platform.machine())') + cd "${srcdir}/${_name}-${pkgver}/build/lib.linux-${machine}-${pyver}" + python -m unittest ${_name}.tests +} + +package() { + local abitag=$(python -c 'import sys; print(*sys.version_info[:2], sep="")') + local machine=$(python -c 'import platform; print(platform.machine())') + python -m installer --destdir="$pkgdir" "${srcdir}/${_name}-${pkgver}/dist/${_name}-${pkgver}-cp${abitag}-cp${abitag}-linux_${machine}.whl" + install -Dm644 ${srcdir}/${_name}-${pkgver}/COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING" +} -- GitLab