diff --git a/.github/workflows/arch.yml b/.github/workflows/arch.yml new file mode 100644 index 0000000..a9f86b9 --- /dev/null +++ b/.github/workflows/arch.yml @@ -0,0 +1,81 @@ +name: Make Arch Package + +on: + push: + pull_request: + workflow_dispatch: + +permissions: + contents: write + +jobs: + build-pkg: + runs-on: ubuntu-latest + container: + image: archlinux:base-devel + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install build dependencies + run: | + pacman -Syu --noconfirm + pacman -S --noconfirm \ + python \ + python-build \ + python-installer \ + python-wheel \ + python-poetry-core \ + python-click \ + python-requests \ + python-gitpython \ + python-yaml \ + python-tabulate \ + python-matplotlib \ + namcap + + - name: Update PKGBUILD version from pyproject.toml + working-directory: packaging/arch + run: | + VERSION=$(grep '^version = ' ../../pyproject.toml | sed 's/version = "\(.*\)"/\1/') + sed -i "s/^pkgver=.*/pkgver=${VERSION}/" PKGBUILD + echo "Building version: ${VERSION}" + + - name: Validate PKGBUILD + working-directory: packaging/arch + run: namcap PKGBUILD + + - name: Build package + working-directory: packaging/arch + run: | + # makepkg cannot run as root, create a build user + useradd -m builder + chown -R builder:builder . + su builder -c "makepkg --printsrcinfo > .SRCINFO" + su builder -c "makepkg -s --noconfirm" + + - name: Validate built package + working-directory: packaging/arch + run: namcap *.pkg.tar.zst + + - name: Collect artifacts + run: | + mkdir -p artifacts + mv packaging/arch/*.pkg.tar.zst artifacts/ + cp packaging/arch/PKGBUILD artifacts/ + cp packaging/arch/.SRCINFO artifacts/ + + - name: Upload Arch package artifact + uses: actions/upload-artifact@v4 + with: + name: kci-dev-arch-package + path: artifacts/ + + - name: Upload Arch package to GitHub Release on new tag + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref_name }} + files: artifacts/*.pkg.tar.zst diff --git a/packaging/arch/.SRCINFO b/packaging/arch/.SRCINFO new file mode 100644 index 0000000..12feecf --- /dev/null +++ b/packaging/arch/.SRCINFO @@ -0,0 +1,24 @@ +pkgbase = kci-dev + pkgdesc = Stand alone tool for Linux Kernel developers and maintainers to interact with KernelCI + pkgver = 0.1.9 + pkgrel = 1 + url = https://github.com/kernelci/kci-dev + arch = any + license = LGPL-2.1-or-later + makedepends = python-build + makedepends = python-installer + makedepends = python-wheel + makedepends = python-poetry-core + depends = python>=3.10 + depends = python-click + depends = python-requests + depends = python-gitpython + depends = python-yaml + depends = python-tabulate + depends = python-matplotlib + optdepends = python-mplcursors: interactive cursor support for plots (AUR) + optdepends = bash-completion: bash completion support + source = kci-dev-0.1.9.tar.gz::https://github.com/kernelci/kci-dev/archive/refs/tags/v0.1.9.tar.gz + sha256sums = SKIP + +pkgname = kci-dev diff --git a/packaging/arch/PKGBUILD b/packaging/arch/PKGBUILD new file mode 100644 index 0000000..77d678c --- /dev/null +++ b/packaging/arch/PKGBUILD @@ -0,0 +1,53 @@ +# Maintainer: Ben Copeland +# https://github.com/kernelci/kci-dev + +pkgname=kci-dev +pkgver=0.1.9 +pkgrel=1 +pkgdesc='Stand alone tool for Linux Kernel developers and maintainers to interact with KernelCI' +arch=('any') +url='https://github.com/kernelci/kci-dev' +license=('LGPL-2.1-or-later') +depends=( + 'python>=3.10' + 'python-click' + 'python-requests' + 'python-gitpython' + 'python-yaml' + 'python-tabulate' + 'python-matplotlib' +) +makedepends=( + 'python-build' + 'python-installer' + 'python-wheel' + 'python-poetry-core' +) +optdepends=( + 'python-mplcursors: interactive cursor support for plots (AUR)' + 'bash-completion: bash completion support' +) +source=("${pkgname}-${pkgver}.tar.gz::https://github.com/kernelci/kci-dev/archive/refs/tags/v${pkgver}.tar.gz") +sha256sums=('SKIP') + +build() { + cd "${pkgname}-${pkgver}" + python -m build --wheel --no-isolation +} + +package() { + cd "${pkgname}-${pkgver}" + python -m installer --destdir="${pkgdir}" dist/*.whl + + # Shell completions + install -Dm644 completions/kci-dev-completion.bash \ + "${pkgdir}/usr/share/bash-completion/completions/kci-dev" + install -Dm644 completions/_kci-dev \ + "${pkgdir}/usr/share/zsh/site-functions/_kci-dev" + install -Dm644 completions/kci-dev.fish \ + "${pkgdir}/usr/share/fish/vendor_completions.d/kci-dev.fish" + + # License and documentation + install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" + install -Dm644 README.md "${pkgdir}/usr/share/doc/${pkgname}/README.md" +}