Sunshine/.github/workflows/pull-requests_build-check.yml

92 lines
4.3 KiB
YAML
Raw Normal View History

2021-12-17 15:55:23 +00:00
name: Build test
on:
pull_request:
types: [opened, synchronize, edited, reopened]
workflow_dispatch:
jobs:
# check_branch:
# runs-on: ubuntu-latest
#
# steps:
# - name: Fail Workflow
# if: github.base_ref != 'nightly'
# run: |
# echo Base: "$GITHUB_BASE_REF"
# echo Head: "$GITHUB_HEAD_REF"
# exit 1
build_linux:
name: Linux
runs-on: ubuntu-20.04
# needs: check_branch
steps:
- uses: actions/checkout@v2
- name: Setup Dependencies
run: |
mkdir -p artifacts
sudo apt-get update -y && \
sudo apt-get --reinstall install -y \
git wget gcc-10 g++-10 build-essential cmake libssl-dev libavdevice-dev libboost-thread-dev libboost-filesystem-dev libboost-log-dev libpulse-dev libopus-dev libxtst-dev libx11-dev libxrandr-dev libxfixes-dev libevdev-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev libdrm-dev libcap-dev libwayland-dev
sudo cp /usr/bin/gcc-10 /usr/bin/gcc && sudo cp /usr/bin/g++-10 /usr/bin/gcc-10
sudo wget https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda_11.4.2_470.57.02_linux.run --progress=bar:force:noscroll -q --show-progress -O /root/cuda.run && sudo chmod a+x /root/cuda.run
sudo /root/cuda.run --silent --toolkit --toolkitpath=/usr --no-opengl-libs --no-man-page --no-drm && sudo rm /root/cuda.run
sudo add-apt-repository ppa:savoury1/graphics -y
sudo add-apt-repository ppa:savoury1/multimedia -y
sudo add-apt-repository ppa:savoury1/ffmpeg4 -y
sudo apt-get update -y
sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y
sudo apt-get install ffmpeg -y
- name: Build Sunshine for AppImage
run: |
CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-Release}"
SUNSHINE_EXECUTABLE_PATH="${SUNSHINE_EXECUTABLE_PATH:-/usr/bin/sunshine}"
SUNSHINE_ASSETS_DIR="${SUNSHINE_ASSETS_DIR:-sunshine.AppImage.config}"
SUNSHINE_ENABLE_WAYLAND=${SUNSHINE_ENABLE_WAYLAND:-ON}
SUNSHINE_ENABLE_X11=${SUNSHINE_ENABLE_X11:-ON}
SUNSHINE_ENABLE_DRM=${SUNSHINE_ENABLE_DRM:-ON}
SUNSHINE_ENABLE_CUDA=${SUNSHINE_ENABLE_CUDA:-ON}
mkdir -p appimage-build && cd appimage-build
cmake "-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE" "-DSUNSHINE_EXECUTABLE_PATH=$SUNSHINE_EXECUTABLE_PATH" "-DSUNSHINE_ASSETS_DIR=$SUNSHINE_ASSETS_DIR" "-DSUNSHINE_ENABLE_WAYLAND=$SUNSHINE_ENABLE_WAYLAND" "-DSUNSHINE_ENABLE_X11=$SUNSHINE_ENABLE_X11" "-DSUNSHINE_ENABLE_DRM=$SUNSHINE_ENABLE_DRM" "-DSUNSHINE_ENABLE_CUDA=$SUNSHINE_ENABLE_CUDA" ".." -DCMAKE_INSTALL_PREFIX=/usr
make -j ${nproc} DESTDIR=AppDir
- name: Build AppImage
# https://docs.appimage.org/packaging-guide/index.html
run: |
DESKTOP_FILE="${DESKTOP_FILE:-sunshine.desktop}"
ICON_FILE="${ICON_FILE:-sunshine.png}"
CONFIG_DIR="${CONFIG_DIR:-sunshine/sunshine.AppImage.config/}"
HOME_DIR="${HOME_DIR:-sunshine/sunshine.AppImage.home/}"
mkdir -p temp_appimage && cd temp_appimage
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage && chmod +x linuxdeploy-x86_64.AppImage
./linuxdeploy-x86_64.AppImage --appdir AppDir -e ../appimage-build/sunshine -i "../$ICON_FILE" -d "../$DESKTOP_FILE" --output appimage
mv sunshine*.AppImage sunshine.AppImage
mkdir sunshine && mv sunshine.AppImage sunshine/
./sunshine/sunshine.AppImage --appimage-portable-config
./sunshine/sunshine.AppImage --appimage-portable-home
cp -r ../assets/* "$CONFIG_DIR"
rm -f "$CONFIG_DIR"/apps_windows.json
mkdir -p ./$HOME_DIR/.config/$CONFIG_DIR
cp ./$CONFIG_DIR/apps_linux.json ./$HOME_DIR/.config/$CONFIG_DIR
zip -r ./sunshine_linux.zip ./sunshine/*
cd ..
mv ./temp_appimage/sunshine_linux.zip ./artifacts/sunshine_linux.zip
- name: Verify AppImage
run: |
wget https://github.com/TheAssassin/appimagelint/releases/download/continuous/appimagelint-x86_64.AppImage && chmod +x appimagelint-x86_64.AppImage && ./appimagelint-x86_64.AppImage .temp_appimage/sunshine/sunshine.AppImage
- name: Upload Artifacts
- uses: actions/upload-artifact@v2
with:
name: Artifacts
path: artifacts/