Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/APKBUILD.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Contributor: Frederic Laing <dev@fredfunk.tech>
# Maintainer: Frederic Laing <dev@fredfunk.tech>
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
"
73 changes: 73 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }})
Expand Down Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 7 additions & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 |
Loading