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
25 changes: 10 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,18 @@ jobs:
fail-fast: false
matrix:
include:
# >= we can make C++-17 work on bionic with the ubuntu-toolchain-r PPA
# use a tool like, e.g., linuxdeploy-plugin-checkrt to bundle libstdc++ when building libappimage-based packages on bionic
- DIST: bionic
- RELEASE: latest
ARCH: x86_64
- DIST: bionic
ARCH: i386
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a technical necessity to drop this?


# CentOS 7 based Docker images can use devtoolset-9 to get a compatible compiler (as demonstrated by appimagebuild)
# (devtoolset compilers can build ABI compatible builds by embedding parts of libc/libstdc++, so ld-p-checkrt is not needed)
- DIST: appimagebuild
ARCH: x86_64
- DIST: appimagebuild
ARCH: i386
- RELEASE: latest
ARCH: armhf
- RELEASE: latest
ARCH: aarch64

# special builds
- DIST: bionic
- RELEASE: latest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pinning is recommended, because "latest" is a moving target and may break anytime.

ARCH: x86_64
BUILD_TYPE: coverage
- DIST: bionic
- RELEASE: latest
ARCH: x86_64
BUILD_TYPE: shared-only
LIBAPPIMAGE_SHARED_ONLY: 1
Expand All @@ -35,13 +28,15 @@ jobs:
runs-on: ubuntu-latest
env:
ARCH: ${{ matrix.ARCH }}
DIST: ${{ matrix.DIST }}
RELEASE: ${{ matrix.RELEASE }}
BUILD_TYPE: ${{ matrix.DIST }}
LIBAPPIMAGE_SHARED_ONLY: ${{ matrix.LIBAPPIMAGE_SHARED_ONLY }}
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: Build libappimage and run tests
run: bash -ex ci/build-in-docker.sh
env:
Expand Down
9 changes: 4 additions & 5 deletions ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# these args are available *only* for the FROM call
ARG DOCKER_ARCH
ARG DIST
ARG RELEASE

FROM $DOCKER_ARCH/ubuntu:$DIST
FROM ubuntu:$RELEASE

# we need to repeat all args from above which we need during build and runtime to make them available
ARG ARCH
Expand All @@ -12,9 +11,9 @@ ENV CI=1

COPY ./install-deps.sh /
# see above, for build time we need to pass the args manually (using ENV does not work)
RUN bash -xe install-deps.sh
RUN bash -xe /install-deps.sh

# create unprivileged user for non-build-script use of this image
# build-in-docker.sh will likely not use this one, as it enforces the caller's uid inside the container
RUN adduser --system --group build
RUN useradd build
USER build
4 changes: 2 additions & 2 deletions ci/build-and-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ cleanup () {
trap cleanup EXIT

# store repo root as variable
REPO_ROOT="$(readlink -f "$(dirname "$(dirname "$0")")")"
OLD_CWD="$(readlink -f .)"
REPO_ROOT="$(readlink -f "$(dirname "$(dirname "${BASH_SOURCE[0]}")")")"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always try to use POSIX instead of bashisms. (But then, I try to get away from GNU)

OLD_CWD="$(readlink -f "$PWD")"

pushd "$BUILD_DIR"

Expand Down
26 changes: 8 additions & 18 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 [[ "${ARCH:-}" == "" ]] || [[ "${RELEASE:-}" == "" ]]; then
echo "Usage: env ARCH=... RELEASE=... bash $0"
exit 1
fi

set -x
set -e
set -euo pipefail

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

case "$ARCH" in
x86_64)
export DOCKER_ARCH=amd64
;;
*)
export DOCKER_ARCH="$ARCH"
;;
esac

image=quay.io/appimage/libappimage-build:"$DIST"-"$ARCH"
image=quay.io/appimage/libappimage-build:"$RELEASE"

extra_build_args=()
if [[ "$NO_PULL" == "" ]]; then
if [[ "${NO_PULL:-}" == "" ]]; then
# 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
extra_build_args=(--cache-from "$image")
fi

# if the image hasn't changed, this should be a no-op
docker build \
--platform "$platform" \
--pull \
--build-arg DOCKER_ARCH \
--build-arg ARCH \
--build-arg DIST \
--build-arg RELEASE \
-t "$image" \
"${extra_build_args[@]}" \
"$this_dir"
Expand All @@ -48,7 +38,7 @@ docker build \
# rebuilt anyway
# credentials shall only be available on (protected) master branch
set +x
if [[ "$DOCKER_USERNAME" != "" ]]; then
if [[ "${DOCKER_USERNAME:-}" != "" ]]; then
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin quay.io
docker push "$image"
fi
46 changes: 33 additions & 13 deletions ci/build-in-docker.sh
Original file line number Diff line number Diff line change
@@ -1,31 +1,51 @@
#! /bin/bash

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

set -x
set -e
set -euo pipefail

cd "$(readlink -f "$(dirname "$0")")"

if [[ "$DIST" != appimagebuild* ]]; then
# sets variables $image
source build-docker-image.sh
# the other script sources this script, therefore we have to support that use case
if [[ "${BASH_SOURCE[*]}" != "" ]]; then
this_dir="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")"
else
image=quay.io/appimage/appimagebuild:centos7-"$ARCH"
docker pull "$image"
this_dir="$(readlink -f "$(dirname "$0")")"
fi

case "$ARCH" in
x86_64)
platform=linux/amd64
;;
i686)
platform=linux/i386
;;
armhf)
platform=linux/arm/v7
;;
aarch64)
platform=linux/arm64/v8
;;
*)
echo "unknown architecture: $ARCH"
exit 2
;;
esac

cd "$(readlink -f "$(dirname "$0")")"

# sets variables $image
source build-docker-image.sh

DOCKER_OPTS=()
# fix for https://stackoverflow.com/questions/51195528/rcc-error-in-resource-qrc-cannot-find-file-png
if [ "$CI" != "" ]; then
if [ "${CI:-}" != "" ]; then
DOCKER_OPTS+=("--security-opt" "seccomp:unconfined")
fi

# only if there's more than 3G of free space in RAM, we can build in a RAM disk
if [[ "$GITHUB_ACTIONS" != "" ]]; then
if [[ "${GITHUB_ACTIONS:-}" != "" ]]; then
echo "Building on GitHub actions, which does not support --tmpfs flag -> building on regular disk"
elif [[ "$(free -m | grep "Mem:" | awk '{print $4}')" -gt 3072 ]]; then
echo "Host system has enough free memory -> building in RAM disk"
Expand Down
47 changes: 2 additions & 45 deletions ci/install-deps.sh
Original file line number Diff line number Diff line change
@@ -1,44 +1,20 @@
#! /bin/bash

set -e
set -euo pipefail

if [[ "$ARCH" == "" ]]; then
echo "Usage: env ARCH=... bash $0"
exit 2
fi

if [[ "$CI" == "" ]]; then
if [[ "${CI:-}" == "" ]]; then
echo "Caution: this script is supposed to run inside a (disposable) CI environment"
echo "It will alter a system, and should not be run on workstations or alike"
echo "You can export CI=1 to prevent this error from being shown again"
exit 3
fi

case "$ARCH" in
x86_64|i386|armhf|arm64)
;;
*)
echo "Error: unsupported architecture: $ARCH"
exit 4
;;
esac

case "$DIST" in
bionic|focal)
;;
*)
echo "Error: unsupported distribution: $DIST"
exit 5
;;
esac

set -x

packages=(
libfuse-dev
desktop-file-utils
ca-certificates
gcc-multilib
make
build-essential
git
Expand All @@ -60,27 +36,8 @@ packages=(
libboost-dev
)

# install gcc-10 (supports C++17 with std::filesystem properly)
if [[ "$DIST" == "bionic" ]]; then
apt-get update
apt-get install --no-install-recommends -y software-properties-common
add-apt-repository -y ppa:ubuntu-toolchain-r/test
packages+=(g++-10-multilib)
else
packages+=(g++-multilib)
fi

# make sure installation won't hang on GitHub actions
export DEBIAN_FRONTEND=noninteractive

apt-get update
apt-get -y --no-install-recommends install "${packages[@]}"

# install more recent CMake version
wget https://artifacts.assassinate-you.net/prebuilt-cmake/continuous/cmake-v3.24.1-ubuntu_"$DIST"-"$ARCH".tar.gz -qO- | \
tar xz -C/usr/local --strip-components=1

# g++-10 should be used by default
if [[ "$DIST" == "bionic" ]]; then
update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-10 9999
fi
Loading
Loading