mirror of
https://github.com/greenart7c3/Amber.git
synced 2026-10-05 19:08:23 +00:00
- desktop-release.yml: on v* tags, builds every desktop installer with the tag's version (via desktop.yml, now also a reusable workflow) and attaches them to the tag's GitHub release. - desktop/packaging/linux.sh: builds a distro-independent .tar.xz and an .AppImage from the createDistributable image; CI smoke-tests the AppImage. - Installers are named Amber-<version>-<platform>.<ext> so the arm64 and x64 DMGs no longer collide. - packageVersion can be overridden with -PdesktopVersion. - Inside an AppImage, use $APPIMAGE for the nostrconnect:// handler and the start-on-boot unit: the binary's own path is a per-launch mount. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
177 lines
5.4 KiB
YAML
177 lines
5.4 KiB
YAML
name: Test/Build Desktop
|
|
|
|
# Lints, tests and packages the Compose for Desktop signer (:desktop) on every
|
|
# OS it ships for, and uploads the installers so each change can be tried out.
|
|
# desktop-release.yml calls it with the release version.
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [master]
|
|
paths: &desktop-paths
|
|
- 'desktop/**'
|
|
- 'gradle/**'
|
|
- '*.gradle.kts'
|
|
- 'gradle.properties'
|
|
- '.github/workflows/desktop.yml'
|
|
push:
|
|
# Branches only: tag pushes are built by desktop-release.yml.
|
|
branches: ['**']
|
|
paths: *desktop-paths
|
|
workflow_dispatch:
|
|
workflow_call:
|
|
inputs:
|
|
version:
|
|
description: 'Package version (X.Y.Z); defaults to the one in desktop/build.gradle.kts'
|
|
type: string
|
|
default: ''
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: desktop-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
env:
|
|
VERSION_ARG: ${{ inputs.version && format('-PdesktopVersion={0}', inputs.version) || '' }}
|
|
RELEASE_VERSION: ${{ inputs.version }}
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- name: Set up JDK 21
|
|
uses: actions/setup-java@v6
|
|
with:
|
|
distribution: 'temurin'
|
|
java-version: 21
|
|
|
|
- name: Cache Gradle
|
|
uses: actions/cache@v6
|
|
with:
|
|
path: |
|
|
~/.gradle/caches
|
|
~/.gradle/wrapper
|
|
key: ${{ runner.os }}-desktop-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'gradle/libs.versions.toml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-desktop-gradle-
|
|
|
|
- name: Create keystore.properties
|
|
run: touch keystore.properties
|
|
|
|
- name: Linter (gradle)
|
|
run: ./gradlew :desktop:ktlintCheck --no-daemon
|
|
|
|
build:
|
|
name: build (${{ matrix.name }})
|
|
needs: lint
|
|
runs-on: ${{ matrix.os }}
|
|
timeout-minutes: 45
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- name: linux-x86_64
|
|
os: ubuntu-latest
|
|
- name: windows-x64
|
|
os: windows-latest
|
|
- name: macos-arm64
|
|
os: macos-latest
|
|
- name: macos-x64
|
|
os: macos-15-intel
|
|
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- name: Set up JDK 21
|
|
uses: actions/setup-java@v6
|
|
with:
|
|
distribution: 'temurin'
|
|
java-version: 21
|
|
|
|
- name: Cache Gradle
|
|
uses: actions/cache@v6
|
|
with:
|
|
path: |
|
|
~/.gradle/caches
|
|
~/.gradle/wrapper
|
|
key: ${{ runner.os }}-${{ runner.arch }}-desktop-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'gradle/libs.versions.toml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-${{ runner.arch }}-desktop-gradle-
|
|
|
|
- name: Create keystore.properties
|
|
run: touch keystore.properties
|
|
|
|
# Names the installers: the release version, or the commit for CI builds.
|
|
- name: Set installer version
|
|
run: echo "DIST_VERSION=${RELEASE_VERSION:-dev-${GITHUB_SHA::7}}" >> "$GITHUB_ENV"
|
|
|
|
- name: Install Linux packaging tools
|
|
if: runner.os == 'Linux'
|
|
run: sudo apt-get update -qq && sudo apt-get install -y -qq rpm xvfb
|
|
|
|
- name: Test (gradle)
|
|
run: ./gradlew :desktop:test --no-daemon
|
|
|
|
# .deb/.rpm on Linux, .msi/.exe on Windows (WiX is fetched by the
|
|
# Compose plugin), .dmg on macOS (unsigned).
|
|
- name: Package (gradle)
|
|
run: ./gradlew :desktop:packageDistributionForCurrentOs $VERSION_ARG --no-daemon
|
|
|
|
# Distro-independent bundles from the standalone app image (packageDeb/Rpm
|
|
# build from a temporary one).
|
|
- name: Package AppImage and tar.xz
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
./gradlew :desktop:createDistributable $VERSION_ARG --no-daemon
|
|
desktop/packaging/linux.sh "$DIST_VERSION" dist
|
|
|
|
# Start the AppImage on a virtual display and make sure it is still alive
|
|
# after a while, i.e. it doesn't crash on startup. HOME points at an
|
|
# empty dir so it boots like a first launch.
|
|
- name: Smoke test AppImage
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
export HOME="$RUNNER_TEMP/amber-home" AMBER_DISABLE_TRAY=1 APPIMAGE_EXTRACT_AND_RUN=1
|
|
mkdir -p "$HOME"
|
|
xvfb-run -a dist/Amber-*.AppImage > "$RUNNER_TEMP/amber.log" 2>&1 &
|
|
sleep 30
|
|
cat "$RUNNER_TEMP/amber.log"
|
|
pgrep -f 'usr/lib/amber/bin/Amber' > /dev/null || { echo "::error::Amber exited during startup"; exit 1; }
|
|
pkill -f 'usr/lib/amber/bin/Amber' || true
|
|
|
|
# Name every installer Amber-<version>-<platform>.<ext>: the macOS DMGs
|
|
# of both architectures would otherwise collide in the release.
|
|
- name: Collect installers
|
|
run: |
|
|
mkdir -p dist
|
|
for f in desktop/build/compose/binaries/main/*/*.{deb,rpm,msi,exe,dmg}; do
|
|
[ -e "$f" ] || continue
|
|
cp "$f" "dist/Amber-$DIST_VERSION-${{ matrix.name }}.${f##*.}"
|
|
done
|
|
ls -l dist
|
|
|
|
- name: Upload installers
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: amber-desktop-${{ matrix.name }}
|
|
path: dist/*
|
|
retention-days: 14
|
|
if-no-files-found: error
|
|
|
|
- name: Upload test reports
|
|
if: failure()
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: desktop-test-reports-${{ matrix.name }}
|
|
path: desktop/build/reports
|