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
27 changes: 27 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: 2
updates:
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 5
groups:
kotlin:
patterns:
- "org.jetbrains.kotlin*"
compose:
patterns:
- "org.jetbrains.compose*"
- "androidx.compose*"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 5

- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 3
4 changes: 2 additions & 2 deletions .github/workflows/build-release-apk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to build and release (e.g. v0.25.5). APK is attached to this release.'
description: 'Tag to build and release (e.g. v0.26.0). APK is attached to this release.'
required: true
default: 'v0.25.5'
default: 'v0.26.0'

permissions:
contents: write
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,56 @@ jobs:

- name: Run JVM tests
run: ./gradlew :shared:jvmTest --stacktrace

linux-bundle:
# Builds the portable libVLC runtime and proves that the packaged app extracts and plays
# it on a machine that has no VLC installed. The runtime is built on Ubuntu 22.04, the
# oldest supported glibc, and the clean-container test runs on Ubuntu 24.04.
runs-on: ubuntu-22.04

permissions:
contents: read

steps:
- uses: actions/checkout@v6

- name: set up JDK
uses: actions/setup-java@v5
with:
java-version: 21
distribution: "temurin"
cache: 'gradle'

- name: Install libVLC build dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libvlc5 libvlccore9 vlc-plugin-base patchelf file ffmpeg
curl -fsSL -o /tmp/patchelf.tar.gz \
"https://github.com/NixOS/patchelf/releases/download/0.19.3/patchelf-0.19.3-x86_64.tar.gz"
mkdir -p /tmp/patchelf
tar -xzf /tmp/patchelf.tar.gz -C /tmp/patchelf
echo "/tmp/patchelf/bin" >> "$GITHUB_PATH"

- name: Build the portable libVLC runtime
run: packaging/linux/build-vlc-runtime.sh build/vlc-runtime

- name: Build the app image with the bundled runtime
run: |
./gradlew :desktopApp:createReleaseDistributable \
-PvlcPrefix="$PWD/build/vlc-runtime" --no-daemon

- name: Smoke test the bundled runtime
run: |
app=$(find desktopApp/build/compose/binaries/main-release/app -maxdepth 1 -mindepth 1 -type d | head -n 1)
packaging/linux/smoke-test-vlc.sh "$app"

- name: Smoke test in a clean Ubuntu container without VLC
run: |
app=$(find desktopApp/build/compose/binaries/main-release/app -maxdepth 1 -mindepth 1 -type d | head -n 1)
docker run --rm -v "$PWD:/work" -w /work ubuntu:24.04 bash -c "
set -e
apt-get update >/dev/null
apt-get install -y --no-install-recommends openjdk-21-jdk-headless ffmpeg >/dev/null
packaging/linux/smoke-test-vlc.sh '$app'
"
169 changes: 145 additions & 24 deletions .github/workflows/release-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to build and release (e.g. v0.25.5)'
description: 'Tag to build and release (e.g. v0.26.0)'
required: true
type: string

Expand All @@ -16,32 +16,60 @@ permissions:

env:
JAVA_VERSION: '21'
PATCHELF_VERSION: '0.19.3'

jobs:
build-linux:
name: Build Linux Deb and Portable Packages
runs-on: ubuntu-latest
name: Build Linux Deb, Portable and Flatpak Packages
# Ubuntu 22.04 keeps the bundled libVLC compatible with Debian 12, Ubuntu 22.04 and newer.
runs-on: ubuntu-22.04
env:
FLATPAK_GPG_PRIVATE_KEY: ${{ secrets.FLATPAK_GPG_PRIVATE_KEY }}
FLATPAK_GPG_KEY_ID: ${{ secrets.FLATPAK_GPG_KEY_ID }}
APP_ID: io.github.tauseef666_ctrl.NP_Desktop
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
ref: ${{ github.event.inputs.tag || github.ref }}
fetch-depth: 0

- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
uses: actions/setup-java@v6
with:
distribution: 'temurin'
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'

- name: Install the libVLC runtime build dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libvlc5 libvlccore9 vlc-plugin-base \
patchelf file ffmpeg flatpak
# Ubuntu 22.04 ships patchelf 0.14, which corrupts the RELR relocations of modern
# libraries. Use the current upstream static build for the runtime.
curl -fsSL -o /tmp/patchelf.tar.gz \
"https://github.com/NixOS/patchelf/releases/download/${PATCHELF_VERSION}/patchelf-${PATCHELF_VERSION}-x86_64.tar.gz"
mkdir -p /tmp/patchelf
tar -xzf /tmp/patchelf.tar.gz -C /tmp/patchelf
echo "/tmp/patchelf/bin" >> "$GITHUB_PATH"
/tmp/patchelf/bin/patchelf --version

- name: Grant execute permission for gradlew
run: chmod +x gradlew
shell: bash

- name: Build the portable libVLC runtime
shell: bash
run: packaging/linux/build-vlc-runtime.sh build/vlc-runtime

- name: Build Deb package and portable app image
run: ./gradlew :desktopApp:packageReleaseDeb :desktopApp:createReleaseDistributable --no-daemon
shell: bash
run: |
./gradlew :desktopApp:packageReleaseDeb :desktopApp:createReleaseDistributable \
-PvlcPrefix="$PWD/build/vlc-runtime" --no-daemon

- name: Locate artifacts
id: locate
Expand All @@ -57,6 +85,11 @@ jobs:
echo "No app image found in build output" >&2
exit 1
fi
# The package must not depend on a system VLC anymore.
if dpkg-deb -f "$deb" Depends | tr ',' '\n' | grep -qE '^ *vlc( |$)'; then
echo "The Debian package still depends on the system VLC" >&2
exit 1
fi
echo "Found deb: $deb ($(du -h "$deb" | cut -f1))"
echo "Found app image: $app ($(du -sh "$app" | cut -f1))"
echo "DEB_PATH=$deb" >> "$GITHUB_OUTPUT"
Expand All @@ -70,44 +103,127 @@ jobs:
tag="${{ github.event.inputs.tag || github.ref_name }}"
version="${tag#v}"
tarball="np-desktop-${version}-linux-x64.tar.gz"
tar -czf "$tarball" -C "${{ steps.locate.outputs.APP_DIR }}" .
# Reproducible tar metadata: sort entries, pin mtimes and ownership, and use the
# commit timestamp as SOURCE_DATE_EPOCH so rebuilding a tag yields the same archive.
export SOURCE_DATE_EPOCH=$(git log -1 --format=%ct)
tar --sort=name --mtime="@$SOURCE_DATE_EPOCH" --owner=0 --group=0 \
--numeric-owner -czf "$tarball" -C "${{ steps.locate.outputs.APP_DIR }}" .
echo "Found tarball: $tarball ($(du -h "$tarball" | cut -f1))"
echo "VERSION=$version" >> "$GITHUB_OUTPUT"
echo "TARBALL_PATH=$tarball" >> "$GITHUB_OUTPUT"
echo "TARBALL_NAME=$tarball" >> "$GITHUB_OUTPUT"

- name: Add VLC runtime dependency
- name: Generate a CycloneDX SBOM
uses: anchore/sbom-action@v0
with:
path: ${{ steps.locate.outputs.APP_DIR }}
format: cyclonedx-json
output-file: np-desktop-${{ steps.portable.outputs.VERSION }}-linux-x86_64.cyclonedx.json
upload-artifact: false
upload-release-assets: false

- name: Smoke test the bundled runtime
shell: bash
run: packaging/linux/smoke-test-vlc.sh "${{ steps.locate.outputs.APP_DIR }}"

- name: Smoke test in a clean Ubuntu container without VLC
shell: bash
run: |
deb="${{ steps.locate.outputs.DEB_PATH }}"
work=$(mktemp -d)
dpkg-deb -R "$deb" "$work"
if grep -q '^Depends:' "$work/DEBIAN/control"; then
sed -i 's/^Depends: /Depends: vlc, /' "$work/DEBIAN/control"
else
sed -i '/^Package:/a Depends: vlc' "$work/DEBIAN/control"
fi
dpkg-deb -b "$work" "$deb"
rm -rf "$work"
docker run --rm -v "$PWD:/work" -w /work ubuntu:24.04 bash -c '
set -e
apt-get update >/dev/null
apt-get install -y --no-install-recommends openjdk-21-jdk-headless ffmpeg >/dev/null
packaging/linux/smoke-test-vlc.sh "${{ steps.locate.outputs.APP_DIR }}"
'

- name: Import the Flatpak signing key
if: env.FLATPAK_GPG_PRIVATE_KEY != ''
shell: bash
run: |
export FLATPAK_GPG_HOME="$PWD/.gnupg"
mkdir -p "$FLATPAK_GPG_HOME"
chmod 700 "$FLATPAK_GPG_HOME"
printf '%s\n' "$FLATPAK_GPG_PRIVATE_KEY" | \
gpg --homedir "$FLATPAK_GPG_HOME" --batch --import
echo "FLATPAK_GPG_HOME=$FLATPAK_GPG_HOME" >> "$GITHUB_ENV"

- name: Build the Flatpak bundle
shell: bash
env:
FLATPAK_GPG_KEY_ID: ${{ secrets.FLATPAK_GPG_KEY_ID }}
FLATPAK_GPG_HOME: ${{ github.workspace }}/.gnupg
run: |
packaging/flatpak/build-flatpak.sh \
"${{ steps.locate.outputs.APP_DIR }}" \
"${{ steps.portable.outputs.VERSION }}" \
build/flatpak

- name: Install the Flatpak runtime
shell: bash
run: |
flatpak remote-add --user --if-not-exists flathub \
https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak install --user -y --noninteractive flathub \
org.freedesktop.Platform//26.08

- name: Smoke test the Flatpak bundle
shell: bash
run: |
bundle=$(find build/flatpak -maxdepth 1 -name '*.flatpak' | head -n 1)
test -n "$bundle"
flatpak install --user -y --noninteractive "$bundle"
flatpak info io.github.tauseef666_ctrl.NP_Desktop >/dev/null
# The desktop file, icon and AppStream metadata are exported next to the deployment,
# not into /app. The app image itself is mounted at /app.
location=$(flatpak info --user --show-location io.github.tauseef666_ctrl.NP_Desktop)
test -f "$location/export/share/applications/io.github.tauseef666_ctrl.NP_Desktop.desktop"
test -f "$location/export/share/metainfo/io.github.tauseef666_ctrl.NP_Desktop.metainfo.xml"
test -f "$location/export/share/icons/hicolor/256x256/apps/io.github.tauseef666_ctrl.NP_Desktop.png"
# The launcher and the bundled jars must be present; this runs without a display or
# audio server.
flatpak run --command=sh io.github.tauseef666_ctrl.NP_Desktop -c '
set -e
test -x /app/bin/np-desktop
test -x /app/bin/NP-Desktop
ls /app/lib/app/*.jar >/dev/null
'
flatpak uninstall --user -y io.github.tauseef666_ctrl.NP_Desktop

- name: Generate SHA-256 checksums
id: checksum
shell: bash
run: |
deb="${{ steps.locate.outputs.DEB_PATH }}"
tarball="${{ steps.portable.outputs.TARBALL_PATH }}"
version="${{ steps.portable.outputs.VERSION }}"
flatpak="build/flatpak/np-desktop-${version}-x86_64.flatpak"
sbom="np-desktop-${version}-linux-x86_64.cyclonedx.json"
{
echo "$(sha256sum "$deb" | cut -d' ' -f1) $(basename "$deb")"
echo "$(sha256sum "$tarball" | cut -d' ' -f1) $(basename "$tarball")"
if [ -f "$flatpak" ]; then
echo "$(sha256sum "$flatpak" | cut -d' ' -f1) $(basename "$flatpak")"
fi
if [ -f "build/flatpak/$APP_ID.gpg" ]; then
echo "$(sha256sum "build/flatpak/$APP_ID.gpg" | cut -d' ' -f1) $APP_ID.gpg"
fi
if [ -f "$sbom" ]; then
echo "$(sha256sum "$sbom" | cut -d' ' -f1) $(basename "$sbom")"
fi
} > checksums-linux-sha256.txt
cat checksums-linux-sha256.txt

- name: Upload Linux artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: desktop-linux
path: |
${{ steps.locate.outputs.DEB_PATH }}
${{ steps.portable.outputs.TARBALL_PATH }}
build/flatpak/*.flatpak
build/flatpak/*.flatpakrepo
build/flatpak/*.gpg
np-desktop-${{ steps.portable.outputs.VERSION }}-linux-x86_64.cyclonedx.json
checksums-linux-sha256.txt
retention-days: 7

Expand All @@ -121,10 +237,15 @@ jobs:
gh release create "$tag" --title "NP Desktop $tag" \
--notes "Automated build for $tag" || true
fi
gh release upload "$tag" \
"${{ steps.locate.outputs.DEB_PATH }}" \
"${{ steps.portable.outputs.TARBALL_PATH }}" \
checksums-linux-sha256.txt \
--clobber
assets=(
"${{ steps.locate.outputs.DEB_PATH }}"
"${{ steps.portable.outputs.TARBALL_PATH }}"
"np-desktop-${{ steps.portable.outputs.VERSION }}-linux-x86_64.cyclonedx.json"
checksums-linux-sha256.txt
)
for file in build/flatpak/*.flatpak build/flatpak/*.flatpakrepo build/flatpak/*.gpg; do
[ -f "$file" ] && assets+=("$file")
done
gh release upload "$tag" "${assets[@]}" --clobber
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading
Loading