Skip to content
Draft
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
218 changes: 218 additions & 0 deletions .github/workflows/ci-alpine.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
---
name: CI-Alpine
permissions: {}

on:
workflow_call:
inputs:
release_commit:
required: true
type: string
release_version:
required: true
type: string

jobs:
build_alpine:
name: ${{ matrix.name }}
env:
BUILD_DEPS_DIR: cmake-build-alpine-build-deps
BUILD_DIR: cmake-build-alpine
permissions:
contents: read
runs-on: ${{ matrix.runner }}
container:
image: alpine:3.22
strategy:
fail-fast: false
matrix:
include:
- name: Alpine-x86_64
asset_name: Alpine-x86_64-ffmpeg.tar.gz
runner: ubuntu-latest
- name: Alpine-aarch64
asset_name: Alpine-aarch64-ffmpeg.tar.gz
runner: ubuntu-24.04-arm
steps:
- name: Fix arm64 Alpine container
if: runner.arch == 'ARM64'
uses: laverdet/alpine-arm64@7f0f72ee2f71eb2324e5888e8b6e42b1b53e6160 # v1.0.0

- name: Install dependencies
run: |
set -eux
apk add --no-cache \
appstream \
appstream-glib \
autoconf \
automake \
bash \
build-base \
cmake \
curl \
curl-dev \
curl-static \
desktop-file-utils \
dpkg \
file \
freetype-dev \
gcovr \
git \
glib-dev \
glslang \
gnutls-dev \
lame-dev \
libass-dev \
libcap-dev \
libcap-static \
libdrm-dev \
libevdev-dev \
libtool \
libva-dev \
libvorbis-dev \
libx11-dev \
libxcb-dev \
libxfixes-dev \
libxrandr-dev \
libxtst-dev \
linux-headers \
meson \
miniupnpc-dev \
nasm \
ninja-build \
nodejs \
npm \
numactl-dev \
openssl-dev \
openssl-libs-static \
opus-dev \
pkgconf \
pulseaudio-dev \
py3-jinja2 \
py3-pip \
py3-setuptools \
python3 \
rpm \
samurai \
sdl2-dev \
shaderc-dev \
tar \
texinfo \
vulkan-loader-dev \
wayland-dev \
wayland-static \
wget \
xrandr \
xvfb \
xvfb-run \
zlib-dev

- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: recursive

- name: Configure Alpine build
run: |
set -eux
cmake -B "${BUILD_DIR}" -S . -G Ninja \
-DBUILD_DOCS=OFF \
-DCMAKE_INSTALL_PREFIX=/usr \
-DFFMPEG_RELEASE_ASSET_NAME="${{ matrix.asset_name }}" \
-DSUNSHINE_ASSETS_DIR=share/sunshine \
-DSUNSHINE_ENABLE_CUDA=OFF \
-DSUNSHINE_ENABLE_STATIC_LINK=ON \
-DSUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine \
-DSUNSHINE_LINUX_PACKAGE_RUNTIME_DEPS=OFF \
-DSUNSHINE_PREFER_STATIC_LIBS=ON

- name: Validate desktop metadata
working-directory: ${{ env.BUILD_DIR }}
run: |
set -eux
appstreamcli validate dev.lizardbyte.app.Sunshine.metainfo.xml
appstream-util validate dev.lizardbyte.app.Sunshine.metainfo.xml
desktop-file-validate dev.lizardbyte.app.Sunshine.desktop
desktop-file-validate dev.lizardbyte.app.Sunshine.terminal.desktop

- name: Build Alpine
id: build
run: |
set -eux
echo "::add-matcher::.github/matchers/gcc.json"
cmake --build "${BUILD_DIR}" --parallel
echo "::remove-matcher owner=gcc::"

- name: Verify static binaries
run: |
set -eux
file "${BUILD_DIR}/sunshine"
file "${BUILD_DIR}/tests/test_sunshine"
ldd "${BUILD_DIR}/sunshine" 2>&1 | tee "${BUILD_DIR}/sunshine-ldd.txt"
ldd "${BUILD_DIR}/tests/test_sunshine" 2>&1 | tee "${BUILD_DIR}/tests/test_sunshine-ldd.txt"
grep -Eq "not a dynamic executable|statically linked" "${BUILD_DIR}/sunshine-ldd.txt"
grep -Eq "not a dynamic executable|statically linked" "${BUILD_DIR}/tests/test_sunshine-ldd.txt"

- name: Package Alpine
id: package
run: |
set -eux
cpack -G DEB --config "${BUILD_DIR}/CPackConfig.cmake"
cpack -G RPM --config "${BUILD_DIR}/CPackConfig.cmake"
ls -la "${BUILD_DIR}/cpack_artifacts"
dpkg-deb --info "${BUILD_DIR}/cpack_artifacts/"*.deb
rpm -qip "${BUILD_DIR}/cpack_artifacts/"*.rpm

- name: Copy build artifacts
if: steps.package.outcome == 'success'
run: |
set -eux
mkdir -p artifacts
cp "${BUILD_DIR}/sunshine" "artifacts/sunshine-${{ matrix.name }}"
cp "${BUILD_DIR}/cpack_artifacts/"*.deb artifacts/
cp "${BUILD_DIR}/cpack_artifacts/"*.rpm artifacts/

- name: Run tests
id: test
working-directory: ${{ env.BUILD_DIR }}/tests
run: |
set -eux
xvfb-run -a ./test_sunshine --gtest_color=yes --gtest_output=xml:test_results.xml

- name: Generate gcov report
id: test_report
if: >-
always() &&
(steps.test.outcome == 'success' || steps.test.outcome == 'failure')
working-directory: ${{ env.BUILD_DIR }}
run: |
set -eux
gcovr --gcov-executable gcov . -r ../src \
--exclude-noncode-lines \
--exclude-throw-branches \
--exclude-unreachable-branches \
--verbose \
--xml-pretty \
-o coverage.xml

- name: Upload coverage artifact
if: >-
always() &&
(steps.test_report.outcome == 'success')
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: coverage-${{ matrix.name }}
path: |
${{ env.BUILD_DIR }}/coverage.xml
${{ env.BUILD_DIR }}/tests/test_results.xml
if-no-files-found: error

- name: Upload Artifacts
if: >-
always() &&
(steps.package.outcome == 'success')
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: build-${{ matrix.name }}
path: artifacts/
if-no-files-found: error
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,16 @@ jobs:
release_commit: ${{ needs.release-setup.outputs.release_commit }}
release_version: ${{ needs.release-setup.outputs.release_version }}

build-alpine:
name: Alpine
needs: release-setup
permissions:
contents: read
uses: ./.github/workflows/ci-alpine.yml
with:
release_commit: ${{ needs.release-setup.outputs.release_commit }}
release_version: ${{ needs.release-setup.outputs.release_version }}

build-linux-copr:
name: Linux Copr
if: github.event_name != 'push' # releases are handled directly in ci-copr.yml
Expand Down Expand Up @@ -188,6 +198,7 @@ jobs:
- build-freebsd
- build-linux
- build-archlinux
- build-alpine
- build-linux-flatpak
- build-macos
- build-homebrew
Expand All @@ -211,6 +222,12 @@ jobs:
- name: Archlinux
coverage: true
pr: true
- name: Alpine-x86_64
coverage: true
pr: true
- name: Alpine-aarch64
coverage: true
pr: true
- name: macOS-arm64
coverage: true
pr: true
Expand Down Expand Up @@ -290,6 +307,7 @@ jobs:
needs:
- release-setup
- build-archlinux
- build-alpine
- build-docker
- build-freebsd
- build-homebrew
Expand Down
3 changes: 2 additions & 1 deletion cmake/FindLIBCAP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ pkg_check_modules(PC_LIBCAP libcap)
set(LIBCAP_DEFINITIONS ${PC_LIBCAP_CFLAGS})

find_path(LIBCAP_INCLUDE_DIRS sys/capability.h PATHS ${PC_LIBCAP_INCLUDEDIR} ${PC_LIBCAP_INCLUDE_DIRS})
find_library(LIBCAP_LIBRARIES NAMES libcap.so PATHS ${PC_LIBCAP_LIBDIR} ${PC_LIBCAP_LIBRARY_DIRS})
find_library(LIBCAP_LIBRARIES NAMES ${PC_LIBCAP_LIBRARIES} cap libcap
PATHS ${PC_LIBCAP_LIBDIR} ${PC_LIBCAP_LIBRARY_DIRS})
mark_as_advanced(LIBCAP_INCLUDE_DIRS LIBCAP_LIBRARIES)

include(FindPackageHandleStandardArgs)
Expand Down
3 changes: 2 additions & 1 deletion cmake/FindLIBDRM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ pkg_check_modules(PC_LIBDRM libdrm)
set(LIBDRM_DEFINITIONS ${PC_LIBDRM_CFLAGS})

find_path(LIBDRM_INCLUDE_DIRS drm.h PATHS ${PC_LIBDRM_INCLUDEDIR} ${PC_LIBDRM_INCLUDE_DIRS} PATH_SUFFIXES libdrm)
find_library(LIBDRM_LIBRARIES NAMES libdrm.so PATHS ${PC_LIBDRM_LIBDIR} ${PC_LIBDRM_LIBRARY_DIRS})
find_library(LIBDRM_LIBRARIES NAMES ${PC_LIBDRM_LIBRARIES} drm libdrm
PATHS ${PC_LIBDRM_LIBDIR} ${PC_LIBDRM_LIBRARY_DIRS})
mark_as_advanced(LIBDRM_INCLUDE_DIRS LIBDRM_LIBRARIES)

include(FindPackageHandleStandardArgs)
Expand Down
6 changes: 5 additions & 1 deletion cmake/dependencies/ffmpeg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ if(NOT DEFINED FFMPEG_PREPARED_BINARIES)
set(FFMPEG_PREPARED_BINARIES "${FFMPEG_EXTRACT_DIR}/ffmpeg")

# Set the archive filename based on architecture
set(FFMPEG_ARCHIVE_NAME "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}-ffmpeg.tar.gz")
if(NOT DEFINED FFMPEG_RELEASE_ASSET_NAME)
set(FFMPEG_ARCHIVE_NAME "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}-ffmpeg.tar.gz")
else()
set(FFMPEG_ARCHIVE_NAME "${FFMPEG_RELEASE_ASSET_NAME}")
endif()
set(FFMPEG_ARCHIVE_PATH "${FFMPEG_VERSION_DIR}/${FFMPEG_ARCHIVE_NAME}")
set(FFMPEG_DOWNLOAD_URL "${FFMPEG_RELEASE_URL}/${FFMPEG_ARCHIVE_NAME}")

Expand Down
3 changes: 2 additions & 1 deletion cmake/dependencies/libevdev_Sunshine.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ if(PC_EVDEV_FOUND)
find_path(EVDEV_INCLUDE_DIR libevdev/libevdev.h
HINTS ${PC_EVDEV_INCLUDE_DIRS} ${PC_EVDEV_INCLUDEDIR})
find_library(EVDEV_LIBRARY
NAMES evdev libevdev)
NAMES ${PC_EVDEV_LIBRARIES} evdev libevdev
HINTS ${PC_EVDEV_LIBRARY_DIRS} ${PC_EVDEV_LIBDIR})
else()
include(ExternalProject)

Expand Down
Loading
Loading