Skip to content

Commit 3a6dcf4

Browse files
committed
Add APKBUILD CI job and apkbuild-lint to checks
1 parent d613822 commit 3a6dcf4

1 file changed

Lines changed: 75 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,16 @@ jobs:
107107
- name: Run checks
108108
run: just check
109109

110+
- name: Lint APKBUILD
111+
run: |
112+
VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')
113+
tar czf /tmp/camera-$VERSION.tar.gz --transform "s,^,camera-$VERSION/," .
114+
CHECKSUM=$(sha512sum /tmp/camera-$VERSION.tar.gz | awk '{print $1}')
115+
sed -e "s/@@VERSION@@/$VERSION/g" -e "s/@@CHECKSUM@@/$CHECKSUM/g" \
116+
.github/APKBUILD.template > /tmp/APKBUILD
117+
docker run --rm -v /tmp/APKBUILD:/work/APKBUILD alpine:edge \
118+
sh -c "apk add --no-cache atools > /dev/null 2>&1 && apkbuild-lint /work/APKBUILD"
119+
110120
# Cross-compiled debug builds to verify compilation on all target architectures
111121
build:
112122
name: Build (${{ matrix.arch }})
@@ -214,6 +224,71 @@ jobs:
214224
just build-debug --target ${{ matrix.target }}
215225
fi
216226
227+
apkbuild:
228+
name: APKBUILD
229+
runs-on: ubuntu-latest
230+
needs: check
231+
container:
232+
image: alpine:edge
233+
steps:
234+
- name: Install build dependencies
235+
run: |
236+
apk add --no-cache \
237+
alpine-sdk sudo git \
238+
cargo \
239+
clang-libclang \
240+
cmake \
241+
eudev-dev \
242+
glib-dev \
243+
gst-plugins-bad-dev \
244+
gst-plugins-base-dev \
245+
gstreamer-dev \
246+
just \
247+
libcamera-dev \
248+
libinput-dev \
249+
libseat-dev \
250+
libxkbcommon-dev \
251+
nasm \
252+
pkgconf \
253+
wayland-dev
254+
255+
- name: Set up abuild
256+
run: |
257+
adduser -D builder
258+
addgroup builder abuild
259+
echo "builder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
260+
su builder -c "abuild-keygen -a -n"
261+
262+
- name: Checkout repository
263+
uses: actions/checkout@v6
264+
with:
265+
fetch-tags: true
266+
267+
- name: Generate APKBUILD and source tarball
268+
run: |
269+
VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')
270+
271+
# Create source tarball matching GitHub's archive format
272+
mkdir -p /tmp/src/camera-$VERSION
273+
cp -a . /tmp/src/camera-$VERSION/
274+
cd /tmp/src
275+
tar czf camera-$VERSION.tar.gz camera-$VERSION
276+
CHECKSUM=$(sha512sum camera-$VERSION.tar.gz | awk '{print $1}')
277+
278+
# Generate APKBUILD from template with local file source
279+
mkdir -p /tmp/apkbuild
280+
sed -e "s/@@VERSION@@/$VERSION/g" \
281+
-e "s/@@CHECKSUM@@/$CHECKSUM/g" \
282+
$GITHUB_WORKSPACE/.github/APKBUILD.template > /tmp/apkbuild/APKBUILD
283+
sed -i "s|source=.*|source=\"camera-$VERSION.tar.gz::file:///tmp/src/camera-$VERSION.tar.gz\"|" /tmp/apkbuild/APKBUILD
284+
285+
chown -R builder:builder /tmp/apkbuild /tmp/src
286+
287+
- name: Build package
288+
run: |
289+
cd /tmp/apkbuild
290+
su builder -c "abuild -r"
291+
217292
flatpak-x86_64:
218293
name: Flatpak (x86_64)
219294
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)