Skip to content

Commit c2d2857

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

File tree

4 files changed

+52
-50
lines changed

4 files changed

+52
-50
lines changed

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

+12-12
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,31 @@ 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"
3434
# "Downgrade" the desktop entry to version 1.0
35-
sed -i "/^Keywords\(\[[a-zA-Z_.@]\+\]\)\?=/d;/^Version=/cVersion=1.0" \
35+
${BUILD_CMD} sed -i "/^Keywords\(\[[a-zA-Z_.@]\+\]\)\?=/d;/^Version=/cVersion=1.0" \
3636
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" \
37+
${BUILD_CMD} install -Dm755 /usr/bin/ffmpeg Pencil2D/usr/plugins/ffmpeg
38+
${BUILD_CMD} install -Dm755 "/usr/lib/x86_64-linux-gnu/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner" \
3939
"Pencil2D/usr/lib/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner"
4040
local gst_executables="-executable=Pencil2D/usr/lib/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner"
4141
for plugin in adpcmdec alsa app audioconvert audioparsers audioresample \
4242
autodetect coreelements gsm id3demux jack mpg123 mulaw playback \
4343
pulse typefindfunctions wavparse apetag; do
44-
install -Dm755 "/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgst${plugin}.so" \
44+
${BUILD_CMD} install -Dm755 "/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgst${plugin}.so" \
4545
"Pencil2D/usr/lib/gstreamer-1.0/libgst${plugin}.so"
4646
gst_executables="${gst_executables} -executable=Pencil2D/usr/lib/gstreamer-1.0/libgst${plugin}.so"
4747
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
48+
${BUILD_CMD} curl -fsSLO https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage
49+
${BUILD_CMD} chmod 755 linuxdeployqt-continuous-x86_64.AppImage
5050
local update_info="" # Currently no appimageupdate support for nightly builds
5151
if [ $IS_RELEASE = "true" ]; then
5252
update_info="-updateinformation=gh-releases-zsync|${GITHUB_REPOSITORY/\//|}|latest|pencil2d-linux-amd64-*.AppImage.zsync"
5353
fi
54-
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/lib/x86_64-linux-gnu/pulseaudio" \
54+
${BUILD_CMD} bash -c "LD_LIBRARY_PATH=\"\${LD_LIBRARY_PATH}:/usr/lib/x86_64-linux-gnu/pulseaudio\" \
5555
./linuxdeployqt-continuous-x86_64.AppImage \
5656
Pencil2D/usr/share/applications/org.pencil2d.Pencil2D.desktop \
5757
-executable=Pencil2D/usr/plugins/ffmpeg \
@@ -60,12 +60,12 @@ create_package_linux() {
6060
platforms/libqwayland-xcomposite-egl.so,platforms/libqwayland-xcomposite-glx.so,\
6161
wayland-decoration-client,wayland-graphics-integration-client,wayland-shell-integration \
6262
${update_info} \
63-
-appimage
63+
-appimage"
6464
local qtsuffix="-qt${INPUT_QT}"
6565
local output_name="pencil2d${qtsuffix/-qt5/}-linux-$3"
66-
mv Pencil2D*.AppImage "$output_name.AppImage"
67-
mv Pencil2D*.AppImage.zsync "$output_name.AppImage.zsync" \
68-
&& sed -i '1,/^$/s/^\(Filename\|URL\): .*$/\1: '"$output_name.AppImage/" "$output_name.AppImage.zsync" \
66+
${BUILD_CMD} mv Pencil2D*.AppImage "$output_name.AppImage"
67+
${BUILD_CMD} mv Pencil2D*.AppImage.zsync "$output_name.AppImage.zsync" \
68+
&& ${BUILD_CMD} sed -i '1,/^$/s/^\(Filename\|URL\): .*$/\1: '"$output_name.AppImage/" "$output_name.AppImage.zsync" \
6969
|| true
7070
echo "output-basename=$output_name" >> "${GITHUB_OUTPUT}"
7171
echo "::endgroup::"

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

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,39 @@
11
#!/usr/bin/env bash
22

33
setup_linux() {
4+
echo "${GITHUB_WORKSPACE}"
5+
ls -l "${GITHUB_WORKSPACE}"
6+
file "${GITHUB_WORKSPACE}/env"
7+
cat "${GITHUB_WORKSPACE}/env"
48
# Because of how bare-bones our docker image is
59
echo "::group::Install prerequisites"
6-
apt-get -yq install software-properties-common
10+
${BUILD_CMD} apt-get -yq install software-properties-common
711
echo "::endgroup::"
812

913
echo "::group::Add APT sources"
1014
for ppa in ppa:ubuntu-toolchain-r/test ppa:ubuntu-sdk-team/ppa \
1115
ppa:git-core/ppa; do
12-
apt-add-repository -y "${ppa}"
16+
${BUILD_CMD} apt-add-repository -y "${ppa}"
1317
done
1418
if [ "${INPUT_QT}" -eq 5 ]; then
15-
apt-add-repository -y ppa:beineri/opt-qt-5.15.2-xenial
19+
${BUILD_CMD} apt-add-repository -y ppa:beineri/opt-qt-5.15.2-xenial
1620
fi
1721
echo "::endgroup::"
1822

1923
echo "::group::Fetch APT updates"
20-
apt-get update -yq
24+
${BUILD_CMD} apt-get update -yq
2125
echo "::endgroup::"
2226

2327
echo "::group::Install APT packages"
2428
if [ "${INPUT_QT}" -eq 5 ]; then
25-
apt-get install -yq --no-install-suggests --no-install-recommends \
29+
${BUILD_CMD} apt-get install -yq --no-install-suggests --no-install-recommends \
2630
build-essential qt515tools qt515base qt515multimedia qt515svg \
2731
qt515wayland libgl1-mesa-dev bsdtar ffmpeg gstreamer1.0-plugins-base \
2832
gstreamer1.0-plugins-good gstreamer1.0-plugins-bad \
2933
gstreamer1.0-plugins-ugly gstreamer1.0-alsa gstreamer1.0-pulseaudio git \
3034
curl libfuse2
3135
else
32-
apt-get install -yq --no-install-suggests --no-install-recommends \
36+
${BUILD_CMD} apt-get install -yq --no-install-suggests --no-install-recommends \
3337
build-essential qt6-l10n-tools qt6-base-dev qt6-multimedia-dev \
3438
libqt6svg6-dev qt6-wayland-dev libgl1-mesa-dev libarchive-tools ffmpeg \
3539
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_ENV}"
119
}
1210

1311
setup_macos() {

.github/workflows/ci.yml

+27-27
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,21 +66,27 @@ 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
83-
if: runner.os == 'Linux'
84-
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
9071
- name: Check out repository
9172
uses: actions/checkout@v3
73+
- name: Set up container (Linux)
74+
if: runner.os == 'Linux'
75+
# XXX: --privileged is sort of a brute-force solution to get FUSE
76+
# working inside Docker, however so far I haven’t been able to
77+
# figure out precisely *which* privileges are needed.
78+
run: |
79+
ls -l / /home /home/runner /home/runner/work /home/runner/work/pencil2d "${{github.workspace}}"
80+
touch "${{github.workspace}}/env"
81+
ls -l "${{github.workspace}}"
82+
docker run --detach --privileged --workdir /workspace --volume "${{github.workspace}}:/workspace" --name "ci_${{github.sha}}" --entrypoint "tail" "${{matrix.container}}" -f /dev/null
83+
file "${{github.workspace}}/env"
84+
cat "${{github.workspace}}/env"
85+
echo '#!/usr/bin/env bash' > "${{github.workspace}}/build-cmd"
86+
echo 'exec docker exec --env-file <(cat "${{github.workspace}}/env") "ci_${{github.sha}}" \"$@\"' >> "${{github.workspace}}/build-cmd"
87+
chmod +x "${{github.workspace}}/build-cmd"
88+
echo 'BUILD_CMD="${{github.workspace}}/build-cmd"' >> "${GITHUB_ENV}"
89+
ls -l "${{github.workspace}}"
9290
- name: Install dependencies
9391
uses: ./.github/actions/install-dependencies
9492
with:
@@ -101,18 +99,16 @@ jobs:
10199
arch: ${{matrix.arch}}
102100

103101
- name: Configure build
104-
run: mkdir build; ${{runner.os == 'Linux' && matrix.qt == 6 && 'qmake6' || 'qmake'}}
102+
run: ${BUILD_CMD} mkdir build; ${BUILD_CMD} ${{runner.os == 'Linux' && matrix.qt == 6 && 'qmake6' || 'qmake'}}
105103
-o build PREFIX=/usr CONFIG-=debug_and_release CONFIG+=release CONFIG+=GIT
106104
CONFIG+=PENCIL2D_${{ startsWith(github.ref, 'refs/heads/release/') && 'RELEASE' || 'NIGHTLY' }}
107105
VERSION=${{ env.VERSION_NUMBER }}
108106

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

113110
- name: Run tests
114-
env: { QT_QPA_PLATFORM: minimal }
115-
run: build/tests/tests
111+
run: ${BUILD_CMD} env QT_QPA_PLATFORM=minimal build/tests/tests
116112

117113
- name: Create package
118114
id: package
@@ -131,3 +127,7 @@ jobs:
131127
- name: Generate summary
132128
shell: bash
133129
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}"
130+
131+
- name: Stop container (Linux)
132+
if: runner.os == 'Linux'
133+
run: docker stop "ci_{{github.sha}}"

0 commit comments

Comments
 (0)