diff --git a/.github/APKBUILD.template b/.github/APKBUILD.template new file mode 100644 index 0000000..43d3726 --- /dev/null +++ b/.github/APKBUILD.template @@ -0,0 +1,59 @@ +# Contributor: Frederic Laing +# Maintainer: Frederic Laing +pkgname=camera +pkgver=@@VERSION@@ +pkgrel=0 +pkgdesc="Camera application for the COSMIC Desktop Environment" +url="https://github.com/cosmic-utils/camera" +arch="all" +license="GPL-3.0-only" +depends=" + cosmic-icons + gst-plugins-base + gst-plugins-bad +" +makedepends=" + cargo + clang-libclang + cmake + eudev-dev + glib-dev + gst-plugins-bad-dev + gst-plugins-base-dev + gstreamer-dev + just + libcamera-dev + libinput-dev + libseat-dev + libxkbcommon-dev + nasm + samurai + pkgconf + wayland-dev +" +options="net !check" # fetch dependencies, no tests +source="$pkgname-$pkgver.tar.gz::https://github.com/cosmic-utils/camera/archive/refs/tags/v$pkgver.tar.gz" + +prepare() { + default_prepare + cargo fetch --target="$CTARGET" --locked +} + +build() { + export VERGEN_GIT_COMMIT_DATE="$(date -d @"$SOURCE_DATE_EPOCH" '+%Y-%m-%d')" + export VERGEN_GIT_SHA="unknown" + + just build-release --frozen +} + +check() { + cargo test --release --frozen +} + +package() { + just rootdir="$pkgdir" install +} + +sha512sums=" +@@CHECKSUM@@ camera-@@VERSION@@.tar.gz +" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab4b99d..8cca755 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -107,6 +107,7 @@ jobs: - name: Run checks run: just check + # Cross-compiled debug builds to verify compilation on all target architectures build: name: Build (${{ matrix.arch }}) @@ -214,6 +215,78 @@ jobs: just build-debug --target ${{ matrix.target }} fi + apkbuild: + name: APKBUILD + runs-on: ubuntu-latest + needs: check + container: + image: alpine:edge + steps: + - name: Install build dependencies + run: | + apk add --no-cache \ + alpine-sdk sudo git atools \ + cargo \ + clang-libclang \ + cmake \ + cosmic-icons \ + eudev-dev \ + glib-dev \ + gst-plugins-bad-dev \ + gst-plugins-base-dev \ + gstreamer-dev \ + just \ + libcamera-dev \ + libinput-dev \ + libseat-dev \ + libxkbcommon-dev \ + nasm \ + pkgconf \ + samurai \ + wayland-dev + + - name: Set up abuild + run: | + adduser -D builder + addgroup builder abuild + echo "builder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers + sudo -Hu builder abuild-keygen -a -n + cp /home/builder/.abuild/*.rsa.pub /etc/apk/keys/ + + - name: Checkout repository + uses: actions/checkout@v6 + with: + fetch-tags: true + + - name: Generate APKBUILD and source tarball + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/') + + # Create source tarball matching GitHub's archive format + git archive --format=tar.gz --prefix=camera-$VERSION/ HEAD > /tmp/camera-$VERSION.tar.gz + CHECKSUM=$(sha512sum /tmp/camera-$VERSION.tar.gz | awk '{print $1}') + + # Place tarball in distfiles cache where abuild expects it + mkdir -p /var/cache/distfiles + cp /tmp/camera-$VERSION.tar.gz /var/cache/distfiles/camera-$VERSION.tar.gz + chmod 644 /var/cache/distfiles/camera-$VERSION.tar.gz + + # Generate APKBUILD from template + mkdir -p /home/builder/apkbuild + sed -e "s/@@VERSION@@/$VERSION/g" \ + -e "s/@@CHECKSUM@@/$CHECKSUM/g" \ + .github/APKBUILD.template > /home/builder/apkbuild/APKBUILD + chown -R builder:builder /home/builder/apkbuild + + - name: Lint APKBUILD + run: apkbuild-lint /home/builder/apkbuild/APKBUILD + + - name: Build package + run: | + cd /home/builder/apkbuild + sudo -Hu builder abuild -r + flatpak-x86_64: name: Flatpak (x86_64) runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 28e7f53..bae4cca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -302,6 +302,23 @@ jobs: fi git archive --format=zip --prefix=camera-${{ github.ref_name }}/ -o release-assets/camera-${{ github.ref_name }}-source.zip HEAD + - name: Generate Alpine Linux APKBUILD + run: | + TAG="${{ github.ref_name }}" + VERSION="${TAG#v}" + + # Download the source tarball that Alpine will use and compute checksum + curl -sL -o /tmp/source.tar.gz \ + "https://github.com/${{ github.repository }}/archive/refs/tags/${TAG}.tar.gz" + CHECKSUM=$(sha512sum /tmp/source.tar.gz | awk '{print $1}') + + # Generate APKBUILD from template + sed -e "s/@@VERSION@@/${VERSION}/g" \ + -e "s/@@CHECKSUM@@/${CHECKSUM}/g" \ + .github/APKBUILD.template > release-assets/APKBUILD + + echo "Generated APKBUILD for camera ${VERSION}" + - name: Generate release notes run: | cat << 'EOF' > release_notes_footer.md @@ -331,6 +348,7 @@ jobs: | `camera-x86_64-musl-linux.tar.gz` | Linux binary for x86_64 (musl/static) | | `camera-aarch64-musl-linux.tar.gz` | Linux binary for ARM64 (musl/static) | | `camera-${{ github.ref_name }}-source.zip` | Source code | + | `APKBUILD` | Alpine Linux package build recipe | EOF # Add aarch64 flatpak to release notes if it was built if [ -f "release-assets/camera-aarch64.flatpak" ]; then diff --git a/README.md b/README.md index d6902c9..08094ce 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ flatpak install camera-x86_64.flatpak #### Dependencies - Rust (stable) +- [cosmic-icons](https://github.com/pop-os/cosmic-icons) - GStreamer 1.0 with plugins (base, good, bad, ugly) - libcamera (>= 0.4.0) - cmake (for building embedded libjpeg-turbo) diff --git a/RELEASE.md b/RELEASE.md index 528f838..7af20d3 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -39,8 +39,9 @@ This triggers the **Release** workflow, which: 1. **Builds binaries** - For x86_64, aarch64, and riscv64 2. **Builds Flatpak bundles** - For x86_64 and aarch64 -3. **Creates GitHub Release** - With all artifacts and release notes -4. **Publishes to Flathub** - Updates the Flathub repository (if `FLATHUB_TOKEN` is configured) +3. **Generates APKBUILD** - Alpine Linux package recipe with correct sha512sum +4. **Creates GitHub Release** - With all artifacts and release notes +5. **Publishes to Flathub** - Updates the Flathub repository (if `FLATHUB_TOKEN` is configured) ## Version Numbering @@ -112,7 +113,11 @@ Each release includes: |----------|-------------| | `camera-x86_64-linux.tar.gz` | Linux binary for x86_64 | | `camera-aarch64-linux.tar.gz` | Linux binary for ARM64 | +| `camera-armhf-linux.tar.gz` | Linux binary for armhf (32-bit) | | `camera-riscv64-linux.tar.gz` | Linux binary for RISC-V 64 | +| `camera-x86_64-musl-linux.tar.gz` | Linux binary for x86_64 (musl/static) | +| `camera-aarch64-musl-linux.tar.gz` | Linux binary for ARM64 (musl/static) | | `camera-x86_64.flatpak` | Flatpak bundle for x86_64 | | `camera-aarch64.flatpak` | Flatpak bundle for ARM64 | | `camera-vX.Y.Z-source.zip` | Source code archive | +| `APKBUILD` | Alpine Linux package build recipe |