Skip to content

Commit 5811370

Browse files
committed
Run actions outside container to fix Linux build failure
1 parent b6c8b3a commit 5811370

File tree

4 files changed

+41
-49
lines changed

4 files changed

+41
-49
lines changed

.github/actions/create-package/create-package.sh

+10-13
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,28 @@ harvest_files() {
2727

2828
create_package_linux() {
2929
echo "::group::Set up AppImage contents"
30-
make install INSTALL_ROOT="${PWD}/Pencil2D"
30+
${BUILD_CMD} make -C build install INSTALL_ROOT="/workspace/Pencil2D"
3131
echo "::endgroup::"
3232

3333
echo "::group::Create AppImage"
34-
# "Downgrade" the desktop entry to version 1.0
35-
sed -i "/^Keywords\(\[[a-zA-Z_.@]\+\]\)\?=/d;/^Version=/cVersion=1.0" \
36-
Pencil2D/usr/share/applications/org.pencil2d.Pencil2D.desktop
37-
install -Dm755 /usr/bin/ffmpeg Pencil2D/usr/plugins/ffmpeg
38-
install -Dm755 "/usr/lib/x86_64-linux-gnu/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner" \
34+
${BUILD_CMD} install -Dm755 /usr/bin/ffmpeg Pencil2D/usr/plugins/ffmpeg
35+
${BUILD_CMD} install -Dm755 "/usr/lib/x86_64-linux-gnu/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner" \
3936
"Pencil2D/usr/lib/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner"
4037
local gst_executables="-executable=Pencil2D/usr/lib/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner"
4138
for plugin in adpcmdec alsa app audioconvert audioparsers audioresample \
4239
autodetect coreelements gsm id3demux jack mpg123 mulaw playback \
4340
pulse typefindfunctions wavparse apetag; do
44-
install -Dm755 "/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgst${plugin}.so" \
41+
${BUILD_CMD} install -Dm755 "/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgst${plugin}.so" \
4542
"Pencil2D/usr/lib/gstreamer-1.0/libgst${plugin}.so"
4643
gst_executables="${gst_executables} -executable=Pencil2D/usr/lib/gstreamer-1.0/libgst${plugin}.so"
4744
done
48-
curl -fsSLO https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage
49-
chmod 755 linuxdeployqt-continuous-x86_64.AppImage
45+
${BUILD_CMD} curl -fsSLO https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage
46+
${BUILD_CMD} chmod 755 linuxdeployqt-continuous-x86_64.AppImage
5047
local update_info="" # Currently no appimageupdate support for nightly builds
5148
if [ $IS_RELEASE = "true" ]; then
5249
update_info="-updateinformation=gh-releases-zsync|${GITHUB_REPOSITORY/\//|}|latest|pencil2d-linux-amd64-*.AppImage.zsync"
5350
fi
54-
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/lib/x86_64-linux-gnu/pulseaudio" \
51+
${BUILD_CMD} bash -c "LD_LIBRARY_PATH=\"\${LD_LIBRARY_PATH}:/usr/lib/x86_64-linux-gnu/pulseaudio\" \
5552
./linuxdeployqt-continuous-x86_64.AppImage \
5653
Pencil2D/usr/share/applications/org.pencil2d.Pencil2D.desktop \
5754
-executable=Pencil2D/usr/plugins/ffmpeg \
@@ -60,11 +57,11 @@ create_package_linux() {
6057
platforms/libqwayland-xcomposite-egl.so,platforms/libqwayland-xcomposite-glx.so,\
6158
wayland-decoration-client,wayland-graphics-integration-client,wayland-shell-integration \
6259
${update_info} \
63-
-appimage
60+
-appimage"
6461
local qtsuffix="-qt${INPUT_QT}"
6562
local output_name="pencil2d${qtsuffix/-qt5/}-linux-$3"
66-
mv Pencil2D*.AppImage "$output_name.AppImage"
67-
mv Pencil2D*.AppImage.zsync "$output_name.AppImage.zsync" \
63+
mv "${GITHUB_WORKSPACE}"/Pencil2D*.AppImage "$output_name.AppImage"
64+
mv "${GITHUB_WORKSPACE}"/Pencil2D*.AppImage.zsync "$output_name.AppImage.zsync" \
6865
&& sed -i '1,/^$/s/^\(Filename\|URL\): .*$/\1: '"$output_name.AppImage/" "$output_name.AppImage.zsync" \
6966
|| true
7067
echo "output-basename=$output_name" >> "${GITHUB_OUTPUT}"

.github/actions/install-dependencies/install-dependencies.sh

+7-6
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,34 @@
33
setup_linux() {
44
# Because of how bare-bones our docker image is
55
echo "::group::Install prerequisites"
6-
apt-get -yq install software-properties-common
6+
${BUILD_CMD} apt-get -yq update
7+
${BUILD_CMD} apt-get -yq install software-properties-common
78
echo "::endgroup::"
89

910
echo "::group::Add APT sources"
1011
for ppa in ppa:ubuntu-toolchain-r/test ppa:ubuntu-sdk-team/ppa \
1112
ppa:git-core/ppa; do
12-
apt-add-repository -y "${ppa}"
13+
${BUILD_CMD} apt-add-repository -y "${ppa}"
1314
done
1415
if [ "${INPUT_QT}" -eq 5 ]; then
15-
apt-add-repository -y ppa:beineri/opt-qt-5.15.2-xenial
16+
${BUILD_CMD} apt-add-repository -y ppa:beineri/opt-qt-5.15.2-xenial
1617
fi
1718
echo "::endgroup::"
1819

1920
echo "::group::Fetch APT updates"
20-
apt-get update -yq
21+
${BUILD_CMD} apt-get update -yq
2122
echo "::endgroup::"
2223

2324
echo "::group::Install APT packages"
2425
if [ "${INPUT_QT}" -eq 5 ]; then
25-
apt-get install -yq --no-install-suggests --no-install-recommends \
26+
${BUILD_CMD} apt-get install -yq --no-install-suggests --no-install-recommends \
2627
build-essential qt515tools qt515base qt515multimedia qt515svg \
2728
qt515wayland libgl1-mesa-dev bsdtar ffmpeg gstreamer1.0-plugins-base \
2829
gstreamer1.0-plugins-good gstreamer1.0-plugins-bad \
2930
gstreamer1.0-plugins-ugly gstreamer1.0-alsa gstreamer1.0-pulseaudio git \
3031
curl libfuse2
3132
else
32-
apt-get install -yq --no-install-suggests --no-install-recommends \
33+
${BUILD_CMD} apt-get install -yq --no-install-suggests --no-install-recommends \
3334
build-essential qt6-l10n-tools qt6-base-dev qt6-multimedia-dev \
3435
libqt6svg6-dev qt6-wayland-dev libgl1-mesa-dev libarchive-tools ffmpeg \
3536
gstreamer1.0-plugins-base gstreamer1.0-plugins-good \

.github/actions/setup-environment/setup-environment.sh

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
#!/usr/bin/env bash
22

33
setup_linux() {
4-
echo "MAKEFLAGS=-j2" >> "${GITHUB_ENV}"
4+
echo "MAKEFLAGS=-j2" >> "${GITHUB_WORKSPACE}/env"
55
# Our container image uses the non-Unicode C locale by default
6-
echo "LANG=C.UTF-8" >> "${GITHUB_ENV}"
6+
echo "LANG=C.UTF-8" >> "${GITHUB_WORKSPACE}/env"
77
# Set up Qt environment variables and export them to the GitHub Actions workflow
8-
if [ -f /opt/qt515/bin/qt515-env.sh ]; then
9-
(printenv; (. /opt/qt515/bin/qt515-env.sh; printenv)) | sort -st= -k1,1 | uniq -u >> "${GITHUB_ENV}"
10-
fi
8+
${BUILD_CMD} bash -c 'if [ -f /opt/qt515/bin/qt515-env.sh ]; then (printenv; (. /opt/qt515/bin/qt515-env.sh; printenv)); fi' | sort -st= -k1,1 | uniq -u >> "${GITHUB_WORKSPACE}/env"
119
}
1210

1311
setup_macos() {

.github/workflows/ci.yml

+21-25
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,8 @@ jobs:
2626
include:
2727
- name: Qt 5 / Linux x86_64
2828
os: ubuntu-latest
29-
# XXX: --privileged is sort of a brute-force solution to get FUSE
30-
# working inside Docker, however so far I haven’t been able to
31-
# figure out precisely *which* privileges are needed.
32-
container: { image: "ubuntu:16.04", options: --privileged }
29+
container: "ubuntu:16.04"
3330
qt: 5
34-
env:
35-
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
3631
- name: Qt 5 / macOS x86_64
3732
os: macos-13
3833
container:
@@ -53,10 +48,7 @@ jobs:
5348
qt: 5
5449
- name: Qt 6 / Linux x86_64
5550
os: ubuntu-latest
56-
# XXX: --privileged is sort of a brute-force solution to get FUSE
57-
# working inside Docker, however so far I haven’t been able to
58-
# figure out precisely *which* privileges are needed.
59-
container: { image: "ubuntu:22.04", options: --privileged }
51+
container: "ubuntu:22.04"
6052
qt: 6
6153
- name: Qt 6 / macOS x86_64
6254
os: macos-13
@@ -74,19 +66,20 @@ jobs:
7466

7567
name: ${{matrix.name}}
7668
runs-on: ${{matrix.os}}
77-
container: ${{matrix.container}}
78-
env: {ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true}
69+
env: { CONTAINER: "${{matrix.container}}", BUILD_CMD: "" }
7970
steps:
80-
- name: Install git (Linux)
81-
# GitHub runners come with git pre-installed, but our "custom" Linux
82-
# container image does not
71+
- name: Set up container (Linux)
8372
if: runner.os == 'Linux'
73+
# XXX: --privileged is sort of a brute-force solution to get FUSE
74+
# working inside Docker, however so far I haven’t been able to
75+
# figure out precisely *which* privileges are needed.
8476
run: |
85-
apt-get update -yq
86-
apt-get -yq install software-properties-common
87-
apt-add-repository -y ppa:git-core/ppa
88-
apt-get update -yq
89-
apt-get install -yq --no-install-suggests --no-install-recommends git
77+
touch "${{github.workspace}}/env"
78+
docker run --detach --privileged --workdir /workspace --volume "${{github.workspace}}:/workspace" --name "ci_${{github.sha}}" --entrypoint "tail" "${{matrix.container}}" -f /dev/null
79+
echo '#!/usr/bin/env bash' > "${{github.workspace}}/build-cmd"
80+
echo 'exec docker exec --env-file <(cat "${{github.workspace}}/env") "ci_${{github.sha}}" "$@"' >> "${{github.workspace}}/build-cmd"
81+
chmod +x "${{github.workspace}}/build-cmd"
82+
echo 'BUILD_CMD=${{github.workspace}}/build-cmd' >> "${GITHUB_ENV}"
9083
- name: Check out repository
9184
uses: actions/checkout@v3
9285
- name: Install dependencies
@@ -101,18 +94,17 @@ jobs:
10194
arch: ${{matrix.arch}}
10295

10396
- name: Configure build
104-
run: mkdir build; ${{runner.os == 'Linux' && matrix.qt == 6 && 'qmake6' || 'qmake'}}
97+
run: mkdir build; ${{runner.os == 'Linux' && '${BUILD_CMD}' || ''}}
98+
${{runner.os == 'Linux' && matrix.qt == 6 && 'qmake6' || 'qmake'}}
10599
-o build PREFIX=/usr CONFIG-=debug_and_release CONFIG+=release CONFIG+=GIT
106100
CONFIG+=PENCIL2D_${{ startsWith(github.ref, 'refs/heads/release/') && 'RELEASE' || 'NIGHTLY' }}
107101
VERSION=${{ env.VERSION_NUMBER }}
108102

109103
- name: Build Pencil2D
110-
working-directory: build
111-
run: ${{runner.os != 'Windows' && 'make' || 'nmake'}}
104+
run: ${{runner.os != 'Windows' && '${BUILD_CMD} make -C build' || 'cd build; nmake'}}
112105

113106
- name: Run tests
114-
env: { QT_QPA_PLATFORM: minimal }
115-
run: build/tests/tests
107+
run: ${{runner.os == 'Linux' && '${BUILD_CMD}' || ''}} env QT_QPA_PLATFORM=minimal build/tests/tests
116108

117109
- name: Create package
118110
id: package
@@ -131,3 +123,7 @@ jobs:
131123
- name: Generate summary
132124
shell: bash
133125
run: echo "Build will be available for download [here](https://get.pencil2d.org/@${{github.repository_owner}}/${{github.run_id}}/${{steps.package.outputs.output-basename}}) once the run is finished." > "${GITHUB_STEP_SUMMARY}"
126+
127+
- name: Stop container (Linux)
128+
if: runner.os == 'Linux'
129+
run: docker stop "ci_${{github.sha}}"

0 commit comments

Comments
 (0)