Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp packaging with linuxdeploy #686

Merged
merged 43 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
9fcc353
Start work on new build system
TheAssassin Nov 25, 2024
59b36dd
Deploy desktop files for ail-cli/appimagelauncherd
TheAssassin Nov 27, 2024
6821a4c
Remove hard dependency on modprobe
TheAssassin Nov 27, 2024
4aea364
Fix missing endl
TheAssassin Nov 27, 2024
fc69cf1
Improve warning
TheAssassin Nov 27, 2024
5a8030f
Install new libappimage dependency
TheAssassin Dec 14, 2024
fb0cb7e
New build system, mk. 3
TheAssassin Dec 14, 2024
1a4ee46
Fix GitHub actions build
TheAssassin Dec 14, 2024
e4cd62f
Drop obsolete i386 builds
TheAssassin Dec 14, 2024
726f57e
Fix deps installation
TheAssassin Dec 14, 2024
33598c4
Fix push to ghcr.io
TheAssassin Dec 14, 2024
da3044e
Improve and fix Docker build
TheAssassin Dec 14, 2024
2fadf23
Fix CMake installation on aarch64
TheAssassin Dec 14, 2024
d2b8e93
Work around lack of ARM ldnp AppImages
TheAssassin Dec 14, 2024
b846d2c
Add writable $HOME in Docker
TheAssassin Dec 25, 2024
2648ec6
Fix installation of linuxdeploy-plugin-native_packages
TheAssassin Dec 25, 2024
9cd35fd
Various fixes
TheAssassin Dec 26, 2024
e40e352
Update AppImageUpdate to support 32-bit ARM
TheAssassin Dec 26, 2024
47cefb1
Work around QEMU magic bytes incompatibility
TheAssassin Dec 26, 2024
f84dabc
Fix wget CA validation issue
TheAssassin Dec 26, 2024
bfe8c6f
Fix Docker build
TheAssassin Jan 2, 2025
614246b
Fix Debian architecture
TheAssassin Jan 2, 2025
fc4087a
Fix usage of Docker tags
TheAssassin Jan 2, 2025
89eeb85
Use the right image for building
TheAssassin Jan 2, 2025
b303e8e
Detect GitHub actions correctly
TheAssassin Jan 2, 2025
d5e6a57
Fix inline cache
TheAssassin Jan 2, 2025
f6d6e69
Properly push multi-arch image
TheAssassin Jan 2, 2025
769038c
Use separate tags for architectures
TheAssassin Jan 2, 2025
8725b01
Fix tag
TheAssassin Jan 2, 2025
52860c3
Old Docker registry secrets are obsolete
TheAssassin Jan 2, 2025
3b848d6
Fix Lite builds
TheAssassin Jan 2, 2025
d21fbe6
Debug ARM failure
TheAssassin Jan 3, 2025
05f3285
Check if downgrade to jammy fixes ldd on qemu
TheAssassin Jan 3, 2025
01b6d8b
Fix ARM package architectures
TheAssassin Jan 3, 2025
8c3280b
Don't rebuild Docker images when build scripts change
TheAssassin Jan 3, 2025
ec4dc60
Check if pinning noble fixes the qemu/ldd issue
TheAssassin Jan 3, 2025
47abf4d
Try another method of setting up QEMU
TheAssassin Jan 4, 2025
f5e4dc6
Use native GitHub ARM runners
TheAssassin Feb 10, 2025
fc8e87a
Remove obsolete debug code
TheAssassin Feb 10, 2025
1026db6
Allow pyuploadtool to run on latest Ubuntu
TheAssassin Feb 10, 2025
a6467fc
Add -t flag to Docker run command if possible
TheAssassin Feb 10, 2025
5c99a45
We don't have a tarball to upload anymore
TheAssassin Feb 10, 2025
8875fbf
Add arm lite builds
TheAssassin Feb 10, 2025
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
62 changes: 32 additions & 30 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,50 @@ jobs:
fail-fast: false
matrix:
include:
- NAME: bionic x86_64
ARCH: x86_64
DIST: bionic
- NAME: bionic i386
ARCH: i386
DIST: bionic
- NAME: bionic arm64
ARCH: arm64
DIST: bionic
- NAME: bionic armhf
ARCH: armhf
DIST: bionic
- NAME: Lite AppImage bionic x86_64
ARCH: x86_64
DIST: bionic
- NAME: Packages x86_64
RUNS_ON: ubuntu-24.04
DOCKER_PLATFORM: linux/amd64
- NAME: Packages aarch64
RUNS_ON: ubuntu-24.04-arm
DOCKER_PLATFORM: linux/arm64/v8
- NAME: Packages armhf
RUNS_ON: ubuntu-24.04-arm
DOCKER_PLATFORM: linux/arm/v7
- NAME: Lite AppImage x86_64
RUNS_ON: ubuntu-24.04
DOCKER_PLATFORM: linux/amd64
BUILD_LITE: 1
- NAME: Lite AppImage bionic i386
ARCH: i386
DIST: bionic
- NAME: Lite AppImage aarch64
RUNS_ON: ubuntu-24.04-arm
DOCKER_PLATFORM: linux/arm64/v8
BUILD_LITE: 1
- NAME: Lite AppImage armhf
RUNS_ON: ubuntu-24.04-arm
DOCKER_PLATFORM: linux/arm/v7
BUILD_LITE: 1

name: ${{ matrix.NAME }}
env:
ARCH: ${{ matrix.ARCH }}
DOCKER_PLATFORM: ${{ matrix.DOCKER_PLATFORM }}
DIST: ${{ matrix.DIST }}
BUILD_LITE: ${{ matrix.BUILD_LITE }}
runs-on: ubuntu-latest
runs-on: ${{ matrix.RUNS_ON }}
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Set up QEMU integration for Docker
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build in Docker
run: bash -ex ci/build-in-docker.sh
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- name: Archive artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: build
name: build ${{ matrix.NAME }}
path: |
appimagelauncher*.deb*
appimagelauncher*.rpm*
Expand All @@ -63,7 +65,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4.1.7
uses: actions/download-artifact@v4
- name: Inspect directory after downloading artifacts
run: ls -alFR
- name: Create release and upload artifacts
Expand All @@ -72,8 +74,8 @@ jobs:
WEBDAV_URL: ${{ secrets.WEBDAV_URL }}
WEBDAV_USER: ${{ secrets.WEBDAV_USER }}
WEBDAV_PASSWORD: ${{ secrets.WEBDAV_PASSWORD }}
APPIMAGE_EXTRACT_AND_RUN: 1
run: |
env | grep GITHUB_ | grep -v GITHUB_TOKEN
wget -q https://github.com/TheAssassin/pyuploadtool/releases/download/continuous/pyuploadtool-x86_64.AppImage
chmod +x pyuploadtool-x86_64.AppImage
./pyuploadtool-x86_64.AppImage **/appimagelauncher*.{deb,rpm,tar*,AppImage*}
./pyuploadtool-x86_64.AppImage **/appimagelauncher*.{deb,rpm,AppImage*}
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "lib/AppImageUpdate"]
path = lib/AppImageUpdate
url = https://github.com/AppImageCommunity/AppImageUpdate.git
36 changes: 22 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ include(cmake/reproducible_builds.cmake)

# support for ccache
# call CMake with -DUSE_CCACHE=ON to make use of it
set(USE_CCACHE OFF CACHE BOOL "")
option(USE_CCACHE OFF)
if(USE_CCACHE)
find_program(CCACHE ccache)
if(CCACHE)
Expand All @@ -29,34 +29,42 @@ endif()
include(GNUInstallDirs)

# if there's a system libappimage package on the system, we can use that directly
set(USE_SYSTEM_LIBAPPIMAGE OFF CACHE BOOL "")
option(USE_SYSTEM_LIBAPPIMAGE OFF)

# if the system version should be used, import globally _before_ including third-party stuff and own executables/libs
if(USE_SYSTEM_LIBAPPIMAGE)
find_package(libappimage REQUIRED)
endif()

# optional; if AppImageUpdate dependency is not viable, the update helper can be disabled
set(ENABLE_UPDATE_HELPER ON CACHE BOOL "")
include(FetchContent)

# AppImageUpdate is needed for the updater UI (and libappimage)
FetchContent_Declare(AppImageUpdate
GIT_REPOSITORY https://github.com/AppImageCommunity/AppImageUpdate.git
GIT_TAG 2.0.0-alpha-1-20241225
EXCLUDE_FROM_ALL
)

# work around Wimplicit-function-declaration in ancient squashfuse code
set(DEPENDENCIES_CFLAGS "-Wno-implicit-function-declaration" CACHE STRING "" FORCE)

option(ENABLE_UPDATE_HELPER ON)
if(ENABLE_UPDATE_HELPER)
# instruct AppImageUpdate to build the Qt UI
set(BUILD_QT_UI ON CACHE BOOL "" FORCE)
endif()

# note: for the time being, we require AppImageUpdate to be fetched during build, even if only to make libappimage available
FetchContent_MakeAvailable(AppImageUpdate)

# install resources, bundle libraries privately, etc.
# initializes important installation destination variables, therefore must be included before adding subdirectories
include(cmake/install.cmake)

add_subdirectory(lib)
add_subdirectory(src)

# contains install configs for resource files
add_subdirectory(resources)

# translation management
add_subdirectory(i18n)

# packaging
include(cmake/cpack_general.cmake)
include(cmake/cpack_source.cmake)
include(cmake/cpack_deb.cmake)
include(cmake/cpack_rpm.cmake)

# must be the last instruction
include(CPack)
2 changes: 2 additions & 0 deletions ci/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!install-deps.sh
17 changes: 17 additions & 0 deletions ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ubuntu:focal

# tell scripts that we're building in an automated release scenario
ENV CI=1

# we re-use the DOCKER_PLATFORM to tell the build scripts about the build target architecture without the need to use uname
# the build scripts will have to map the architecture to names Debian/RPM/AppImage support
ARG DOCKER_PLATFORM
ENV DOCKER_PLATFORM="${DOCKER_PLATFORM}"

# we need to provide some writable $HOME for the (random) used ID we use in the build script
RUN install -d -m 0777 /home/user
ENV HOME=/home/user

# let the install script do the heavy lifting (easier than replicating the complex behavior in a Dockerfile)
COPY install-deps.sh /
RUN bash -xe install-deps.sh
11 changes: 0 additions & 11 deletions ci/Dockerfile.bionic-arm64

This file was deleted.

11 changes: 0 additions & 11 deletions ci/Dockerfile.bionic-armhf

This file was deleted.

11 changes: 0 additions & 11 deletions ci/Dockerfile.bionic-i386

This file was deleted.

13 changes: 0 additions & 13 deletions ci/Dockerfile.bionic-i386-lite

This file was deleted.

11 changes: 0 additions & 11 deletions ci/Dockerfile.bionic-x86_64

This file was deleted.

13 changes: 0 additions & 13 deletions ci/Dockerfile.bionic-x86_64-lite

This file was deleted.

79 changes: 52 additions & 27 deletions ci/build-docker-image.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#! /bin/bash

if [[ "$DIST" == "" ]] || [[ "$ARCH" == "" ]]; then
echo "Usage: env ARCH=... DIST=... bash $0"
if [[ "$DOCKER_PLATFORM" == "" ]]; then
echo "Usage: env $DOCKER_PLATFORM=... bash $0"
exit 1
fi

set -x
set -eo pipefail
set -euo pipefail

# the other script sources this script, therefore we have to support that use case
if [[ "${BASH_SOURCE[*]}" != "" ]]; then
Expand All @@ -15,31 +14,57 @@ else
this_dir="$(readlink -f "$(dirname "$0")")"
fi

# needed to keep user ID in and outside Docker in sync to be able to write to workspace directory
image=quay.io/appimagelauncher/build:"$DIST"-"$ARCH"
dockerfile="$this_dir"/Dockerfile."$DIST"-"$ARCH"

if [[ "$BUILD_LITE" != "" ]]; then
image="$image"-lite
dockerfile="$dockerfile"-lite
# we need a "docker-container" type builder to make use of all the buildx features regarding caching and multi-arch
# support
builder_name="appimagelauncher-builder"
if ! docker buildx inspect "$builder_name" &>/dev/null; then
echo "Docker builder $builder_name not found, creating"
docker buildx create --name="$builder_name" --driver=docker-container --bootstrap
else
echo "Using existing Docker builder $builder_name found"
fi

if [ ! -f "$dockerfile" ]; then
echo "Error: $dockerfile could not be found"
exit 1
image=ghcr.io/theassassin/appimagelauncher-build
branch="$(git rev-parse --abbrev-ref HEAD)"
# append platform to Docker image tag since we can't push separate (multi-arch) images to the same name without
# creating the manifest manually
# see https://github.com/docker/build-push-action/issues/671
platform_suffix="$(echo -n "$DOCKER_PLATFORM" | tr -c 'A-Za-z0-9-' '_')"

current_branch_tag="${image}:${branch}_${platform_suffix}"
master_branch_tag="${image}:master_${platform_suffix}"

docker_command=(
docker buildx build
--builder "$builder_name"
--load # --output=type=docker
--pull
--platform "$DOCKER_PLATFORM"
--build-arg DOCKER_PLATFORM="$DOCKER_PLATFORM"

# cache from the current branch's image
--cache-from type=registry,ref="$current_branch_tag"

# we can always cache from the master branch's image
--cache-from type=registry,ref="$master_branch_tag"

--tag "$current_branch_tag"
)

# if we are building on GitHub actions, we can also push the resulting image
if [[ "${GITHUB_ACTIONS:-}" != "" ]]; then
echo "Going to push built image"
docker_command+=(
--cache-to type=inline
--push
)
fi

# speed up build by pulling last built image from quay.io and building the docker file using the old image as a base
docker pull "$image" || true
docker_command+=(
"$this_dir"
)

# using inline cache to speed up builds by fetching the image from the GitHub registry first
# this should speed up local builds as well
# if the image hasn't changed, this should be a no-op
docker build --pull --cache-from "$image" -t "$image" -f "$dockerfile" "$this_dir"

# push built image as cache for future builds to registry
# we can do that immediately once the image has been built successfully; if its definition ever changes it will be
# rebuilt anyway
# credentials shall only be available on (protected) master branch
set +x
if [[ "$DOCKER_USERNAME" != "" ]]; then
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin quay.io
docker push "$image"
fi
"${docker_command[@]}"
Loading