Skip to content

Commit 860eb1f

Browse files
committed
Fix i386 builds
1 parent 6da40e5 commit 860eb1f

File tree

3 files changed

+80
-19
lines changed

3 files changed

+80
-19
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,25 @@ on:
1111
jobs:
1212
appimage:
1313
strategy:
14+
fail-fast: false
1415
matrix:
15-
arch: ['x86_64', 'i386']
16+
ARCH: [x86_64, i386]
1617

17-
name: AppImage ${{ matrix.arch }}
18+
name: AppImage ${{ matrix.ARCH }}
1819
runs-on: ubuntu-20.04
1920
env:
2021
ARCH: ${{ matrix.ARCH }}
22+
APPIMAGE_EXTRACT_AND_RUN: 1
2123
steps:
22-
- uses: actions/checkout@v2
24+
- uses: actions/checkout@v3
2325
with:
2426
submodules: recursive
25-
- name: Install dependencies
26-
if: ${{ matrix.ARCH == 'i386' }}
27-
run: |
28-
sudo dpkg --add-architecture i386
29-
sudo apt-get update
30-
sudo apt-get install -y g++-multilib libc6-dev:i386 libstdc++-5-dev:i386 zlib1g:i386 libfuse2:i386
31-
- name: Build AppImage
32-
run: bash -ex ci/build-appimage.sh
27+
- name: Set up QEMU integration for Docker
28+
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
29+
- name: Run build in Docker
30+
run: bash -euxo pipefail ci/build-in-docker.sh
3331
- name: Archive artifacts
34-
uses: actions/upload-artifact@v2
32+
uses: actions/upload-artifact@v3
3533
with:
3634
name: AppImage ${{ matrix.ARCH }}
3735
path: linuxdeploy-plugin-appimage*.AppImage*

ci/build-appimage.sh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
#! /bin/bash
22

3-
set -e
4-
set -x
3+
set -euxo pipefail
54

65
# use RAM disk if possible
7-
if [ "$CI" == "" ] && [ -d /dev/shm ]; then
8-
TEMP_BASE=/dev/shm
6+
if [ "${CI:-}" == "" ] && [ -d /docker-ramdisk ]; then
7+
TEMP_BASE=/docker-ramdisk
98
else
109
TEMP_BASE=/tmp
1110
fi
1211

1312
BUILD_DIR=$(mktemp -d -p "$TEMP_BASE" linuxdeploy-plugin-appimage-build-XXXXXX)
1413

15-
cleanup () {
14+
cleanup() {
1615
if [ -d "$BUILD_DIR" ]; then
1716
rm -rf "$BUILD_DIR"
1817
fi
@@ -51,7 +50,6 @@ chmod +x linuxdeploy-"$ARCH".AppImage
5150
wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-"$AIK_ARCH".AppImage
5251

5352
chmod +x appimagetool-"$AIK_ARCH".AppImage
54-
dd if=/dev/zero of=appimagetool-"$AIK_ARCH".AppImage bs=1 count=3 seek=8 conv=notrunc
5553

5654
./appimagetool-"$AIK_ARCH".AppImage --appimage-extract
5755
mv squashfs-root/ AppDir/appimagetool-prefix/
@@ -60,7 +58,6 @@ ln -s ../../appimagetool-prefix/AppRun AppDir/usr/bin/appimagetool
6058
export UPD_INFO="gh-releases-zsync|linuxdeploy|linuxdeploy-plugin-appimage|continuous|linuxdeploy-plugin-appimage-$ARCH.AppImage"
6159

6260
# deploy linuxdeploy-plugin-appimage
63-
dd if=/dev/zero of=linuxdeploy-x86_64.AppImage bs=1 count=3 seek=8 conv=notrunc
6461
./linuxdeploy-"$ARCH".AppImage --appimage-extract-and-run \
6562
--appdir AppDir -d "$REPO_ROOT"/resources/linuxdeploy-plugin-appimage.desktop \
6663
-i "$REPO_ROOT"/resources/linuxdeploy-plugin-appimage.svg

ci/build-in-docker.sh

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#! /bin/bash
2+
3+
set -euxo pipefail
4+
5+
if [[ "${ARCH:-}" == "" ]]; then
6+
echo "Usage: env ARCH=... bash $0"
7+
exit 1
8+
fi
9+
10+
case "$ARCH" in
11+
x86_64)
12+
image_prefix=amd64
13+
platform=linux/amd64
14+
;;
15+
i386)
16+
image_prefix=i386
17+
platform=linux/i386
18+
;;
19+
armhf)
20+
image_prefix=arm32v7
21+
platform=linux/arm/v7
22+
;;
23+
aarch64)
24+
image_prefix=arm64v8
25+
platform=linux/arm64/v8
26+
;;
27+
*)
28+
echo "unknown architecture: $ARCH"
29+
exit 2
30+
;;
31+
esac
32+
33+
image="$image_prefix"/debian:stable
34+
35+
repo_root="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")"/..)"
36+
37+
# run the build with the current user to
38+
# a) make sure root is not required for builds
39+
# b) allow the build scripts to "mv" the binaries into the /out directory
40+
uid="$(id -u)"
41+
42+
# make sure Docker image is up to date
43+
docker pull "$image"
44+
45+
docker run \
46+
--platform "$platform" \
47+
--rm \
48+
-i \
49+
-e ARCH \
50+
-e GITHUB_ACTIONS \
51+
-e GITHUB_RUN_NUMBER \
52+
-e OUT_UID="$uid" \
53+
-v "$repo_root":/source:ro \
54+
-v "$PWD":/out \
55+
-w /out \
56+
--tmpfs /docker-ramdisk:exec,mode=777 \
57+
"$image" \
58+
bash -exo pipefail \
59+
<<\EOF
60+
61+
apt-get update
62+
apt-get install -y gcc g++ cmake git wget file curl
63+
64+
bash -euxo pipefail ci/build-appimage.sh
65+
66+
EOF

0 commit comments

Comments
 (0)