Skip to content

Commit 62805de

Browse files
build(linux): add alpine package
1 parent 5364b00 commit 62805de

9 files changed

Lines changed: 343 additions & 63 deletions

File tree

.github/workflows/ci-alpine.yml

Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
1+
---
2+
name: CI-Alpine
3+
permissions: {}
4+
5+
on:
6+
workflow_call:
7+
inputs:
8+
release_commit:
9+
required: true
10+
type: string
11+
release_version:
12+
required: true
13+
type: string
14+
15+
jobs:
16+
build_alpine:
17+
name: ${{ matrix.name }}
18+
env:
19+
BUILD_DEPS_DIR: cmake-build-alpine-build-deps
20+
BUILD_DIR: cmake-build-alpine
21+
FFMPEG_PREPARED_BINARIES: ${{ github.workspace }}/cmake-build-alpine-build-deps/dist/ffmpeg
22+
permissions:
23+
contents: read
24+
runs-on: ${{ matrix.runner }}
25+
container:
26+
image: alpine:3.22
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
include:
31+
- name: Alpine-x86_64
32+
runner: ubuntu-latest
33+
- name: Alpine-aarch64
34+
runner: ubuntu-24.04-arm
35+
steps:
36+
- name: Fix arm64 Alpine container
37+
if: ${{ runner.arch == 'ARM64' }}
38+
uses: laverdet/alpine-arm64@7f0f72ee2f71eb2324e5888e8b6e42b1b53e6160 # v1.0.0
39+
40+
- name: Install dependencies
41+
run: |
42+
set -eux
43+
apk add --no-cache \
44+
appstream \
45+
appstream-glib \
46+
autoconf \
47+
automake \
48+
bash \
49+
build-base \
50+
cmake \
51+
curl \
52+
curl-dev \
53+
curl-static \
54+
desktop-file-utils \
55+
dpkg \
56+
file \
57+
freetype-dev \
58+
gcovr \
59+
git \
60+
glib-dev \
61+
glslang \
62+
gnutls-dev \
63+
lame-dev \
64+
libass-dev \
65+
libcap-dev \
66+
libcap-static \
67+
libdrm-dev \
68+
libevdev-dev \
69+
libtool \
70+
libva-dev \
71+
libvorbis-dev \
72+
libx11-dev \
73+
libxcb-dev \
74+
libxfixes-dev \
75+
libxtst-dev \
76+
linux-headers \
77+
meson \
78+
miniupnpc-dev \
79+
nasm \
80+
ninja-build \
81+
nodejs \
82+
npm \
83+
numactl-dev \
84+
openssl-dev \
85+
openssl-libs-static \
86+
opus-dev \
87+
pkgconf \
88+
pulseaudio-dev \
89+
py3-jinja2 \
90+
py3-pip \
91+
py3-setuptools \
92+
python3 \
93+
rpm \
94+
samurai \
95+
sdl2-dev \
96+
shaderc-dev \
97+
tar \
98+
texinfo \
99+
vulkan-loader-dev \
100+
wayland-dev \
101+
wayland-static \
102+
wget \
103+
xrandr \
104+
xvfb \
105+
xvfb-run \
106+
zlib-dev
107+
108+
- name: Checkout
109+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
110+
with:
111+
submodules: recursive
112+
113+
- name: Configure FFmpeg build-deps
114+
run: |
115+
set -eux
116+
cmake -B "${BUILD_DEPS_DIR}" -S third-party/build-deps -G Ninja \
117+
-DBUILD_ALL=OFF \
118+
-DBUILD_FFMPEG=ON \
119+
-DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}/${BUILD_DEPS_DIR}/dist"
120+
121+
- name: Build FFmpeg build-deps
122+
run: |
123+
set -eux
124+
cmake --build "${BUILD_DEPS_DIR}" --parallel
125+
test -f "${FFMPEG_PREPARED_BINARIES}/lib/libavcodec.a"
126+
test -f "${FFMPEG_PREPARED_BINARIES}/lib/libavutil.a"
127+
test -f "${FFMPEG_PREPARED_BINARIES}/lib/libswscale.a"
128+
129+
- name: Configure Alpine build
130+
run: |
131+
set -eux
132+
cmake -B "${BUILD_DIR}" -S . -G Ninja \
133+
-DBUILD_DOCS=OFF \
134+
-DCMAKE_INSTALL_PREFIX=/usr \
135+
-DFFMPEG_PREPARED_BINARIES="${FFMPEG_PREPARED_BINARIES}" \
136+
-DSUNSHINE_ASSETS_DIR=share/sunshine \
137+
-DSUNSHINE_ENABLE_CUDA=OFF \
138+
-DSUNSHINE_ENABLE_STATIC_LINK=ON \
139+
-DSUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine \
140+
-DSUNSHINE_LINUX_PACKAGE_RUNTIME_DEPS=OFF \
141+
-DSUNSHINE_PREFER_STATIC_LIBS=ON
142+
143+
- name: Validate desktop metadata
144+
working-directory: ${{ env.BUILD_DIR }}
145+
run: |
146+
set -eux
147+
appstreamcli validate dev.lizardbyte.app.Sunshine.metainfo.xml
148+
appstream-util validate dev.lizardbyte.app.Sunshine.metainfo.xml
149+
desktop-file-validate dev.lizardbyte.app.Sunshine.desktop
150+
desktop-file-validate dev.lizardbyte.app.Sunshine.terminal.desktop
151+
152+
- name: Build Alpine
153+
id: build
154+
run: |
155+
set -eux
156+
echo "::add-matcher::.github/matchers/gcc.json"
157+
cmake --build "${BUILD_DIR}" --parallel
158+
echo "::remove-matcher owner=gcc::"
159+
160+
- name: Verify static binaries
161+
run: |
162+
set -eux
163+
file "${BUILD_DIR}/sunshine"
164+
file "${BUILD_DIR}/tests/test_sunshine"
165+
ldd "${BUILD_DIR}/sunshine" 2>&1 | tee "${BUILD_DIR}/sunshine-ldd.txt"
166+
ldd "${BUILD_DIR}/tests/test_sunshine" 2>&1 | tee "${BUILD_DIR}/tests/test_sunshine-ldd.txt"
167+
grep -Eq "not a dynamic executable|statically linked" "${BUILD_DIR}/sunshine-ldd.txt"
168+
grep -Eq "not a dynamic executable|statically linked" "${BUILD_DIR}/tests/test_sunshine-ldd.txt"
169+
170+
- name: Package Alpine
171+
id: package
172+
run: |
173+
set -eux
174+
cpack -G DEB --config "${BUILD_DIR}/CPackConfig.cmake"
175+
cpack -G RPM --config "${BUILD_DIR}/CPackConfig.cmake"
176+
ls -la "${BUILD_DIR}/cpack_artifacts"
177+
dpkg-deb --info "${BUILD_DIR}/cpack_artifacts/"*.deb
178+
rpm -qip "${BUILD_DIR}/cpack_artifacts/"*.rpm
179+
180+
- name: Copy build artifacts
181+
if: steps.package.outcome == 'success'
182+
run: |
183+
set -eux
184+
mkdir -p artifacts
185+
cp "${BUILD_DIR}/sunshine" "artifacts/sunshine-${{ matrix.name }}"
186+
cp "${BUILD_DIR}/cpack_artifacts/"*.deb artifacts/
187+
cp "${BUILD_DIR}/cpack_artifacts/"*.rpm artifacts/
188+
189+
- name: Run tests
190+
id: test
191+
working-directory: ${{ env.BUILD_DIR }}/tests
192+
run: |
193+
set -eux
194+
xvfb-run -a ./test_sunshine --gtest_color=yes --gtest_output=xml:test_results.xml
195+
196+
- name: Generate gcov report
197+
id: test_report
198+
if: >-
199+
always() &&
200+
(steps.test.outcome == 'success' || steps.test.outcome == 'failure')
201+
working-directory: ${{ env.BUILD_DIR }}
202+
run: |
203+
set -eux
204+
gcovr --gcov-executable gcov . -r ../src \
205+
--exclude-noncode-lines \
206+
--exclude-throw-branches \
207+
--exclude-unreachable-branches \
208+
--verbose \
209+
--xml-pretty \
210+
-o coverage.xml
211+
212+
- name: Upload coverage artifact
213+
if: >-
214+
always() &&
215+
(steps.test_report.outcome == 'success')
216+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
217+
with:
218+
name: coverage-${{ matrix.name }}
219+
path: |
220+
${{ env.BUILD_DIR }}/coverage.xml
221+
${{ env.BUILD_DIR }}/tests/test_results.xml
222+
if-no-files-found: error
223+
224+
- name: Upload Artifacts
225+
if: >-
226+
always() &&
227+
(steps.package.outcome == 'success')
228+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
229+
with:
230+
name: build-${{ matrix.name }}
231+
path: artifacts/
232+
if-no-files-found: error

.github/workflows/ci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,16 @@ jobs:
129129
release_commit: ${{ needs.release-setup.outputs.release_commit }}
130130
release_version: ${{ needs.release-setup.outputs.release_version }}
131131

132+
build-alpine:
133+
name: Alpine
134+
needs: release-setup
135+
permissions:
136+
contents: read
137+
uses: ./.github/workflows/ci-alpine.yml
138+
with:
139+
release_commit: ${{ needs.release-setup.outputs.release_commit }}
140+
release_version: ${{ needs.release-setup.outputs.release_version }}
141+
132142
build-linux-copr:
133143
name: Linux Copr
134144
if: github.event_name != 'push' # releases are handled directly in ci-copr.yml
@@ -188,6 +198,7 @@ jobs:
188198
- build-freebsd
189199
- build-linux
190200
- build-archlinux
201+
- build-alpine
191202
- build-linux-flatpak
192203
- build-macos
193204
- build-homebrew
@@ -211,6 +222,12 @@ jobs:
211222
- name: Archlinux
212223
coverage: true
213224
pr: true
225+
- name: Alpine-x86_64
226+
coverage: true
227+
pr: true
228+
- name: Alpine-aarch64
229+
coverage: true
230+
pr: true
214231
- name: macOS-arm64
215232
coverage: true
216233
pr: true
@@ -290,6 +307,7 @@ jobs:
290307
needs:
291308
- release-setup
292309
- build-archlinux
310+
- build-alpine
293311
- build-docker
294312
- build-freebsd
295313
- build-homebrew

cmake/FindLIBCAP.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ pkg_check_modules(PC_LIBCAP libcap)
1414
set(LIBCAP_DEFINITIONS ${PC_LIBCAP_CFLAGS})
1515

1616
find_path(LIBCAP_INCLUDE_DIRS sys/capability.h PATHS ${PC_LIBCAP_INCLUDEDIR} ${PC_LIBCAP_INCLUDE_DIRS})
17-
find_library(LIBCAP_LIBRARIES NAMES libcap.so PATHS ${PC_LIBCAP_LIBDIR} ${PC_LIBCAP_LIBRARY_DIRS})
17+
find_library(LIBCAP_LIBRARIES NAMES ${PC_LIBCAP_LIBRARIES} cap libcap
18+
PATHS ${PC_LIBCAP_LIBDIR} ${PC_LIBCAP_LIBRARY_DIRS})
1819
mark_as_advanced(LIBCAP_INCLUDE_DIRS LIBCAP_LIBRARIES)
1920

2021
include(FindPackageHandleStandardArgs)

cmake/FindLIBDRM.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ pkg_check_modules(PC_LIBDRM libdrm)
1414
set(LIBDRM_DEFINITIONS ${PC_LIBDRM_CFLAGS})
1515

1616
find_path(LIBDRM_INCLUDE_DIRS drm.h PATHS ${PC_LIBDRM_INCLUDEDIR} ${PC_LIBDRM_INCLUDE_DIRS} PATH_SUFFIXES libdrm)
17-
find_library(LIBDRM_LIBRARIES NAMES libdrm.so PATHS ${PC_LIBDRM_LIBDIR} ${PC_LIBDRM_LIBRARY_DIRS})
17+
find_library(LIBDRM_LIBRARIES NAMES ${PC_LIBDRM_LIBRARIES} drm libdrm
18+
PATHS ${PC_LIBDRM_LIBDIR} ${PC_LIBDRM_LIBRARY_DIRS})
1819
mark_as_advanced(LIBDRM_INCLUDE_DIRS LIBDRM_LIBRARIES)
1920

2021
include(FindPackageHandleStandardArgs)

cmake/dependencies/libevdev_Sunshine.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ if(PC_EVDEV_FOUND)
1010
find_path(EVDEV_INCLUDE_DIR libevdev/libevdev.h
1111
HINTS ${PC_EVDEV_INCLUDE_DIRS} ${PC_EVDEV_INCLUDEDIR})
1212
find_library(EVDEV_LIBRARY
13-
NAMES evdev libevdev)
13+
NAMES ${PC_EVDEV_LIBRARIES} evdev libevdev
14+
HINTS ${PC_EVDEV_LIBRARY_DIRS} ${PC_EVDEV_LIBDIR})
1415
else()
1516
include(ExternalProject)
1617

0 commit comments

Comments
 (0)