name: CI on: pull_request: branches: [master, nightly] types: [opened, synchronize, reopened] push: branches: [master] workflow_dispatch: jobs: check_changelog: name: Check Changelog runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - name: Verify Changelog id: verify_changelog if: ${{ github.ref == 'refs/heads/master' || github.base_ref == 'master' }} # base_ref for pull request check, ref for push uses: SunshineStream/actions/verify_changelog@master with: token: ${{ secrets.GITHUB_TOKEN }} outputs: next_version: ${{ steps.verify_changelog.outputs.changelog_parser_version }} next_version_bare: ${{ steps.verify_changelog.outputs.changelog_parser_version_bare }} last_version: ${{ steps.verify_changelog.outputs.latest_release_tag_name }} release_body: ${{ steps.verify_changelog.outputs.changelog_parser_description }} check_versions: name: Check Versions runs-on: ubuntu-latest needs: check_changelog if: ${{ github.ref == 'refs/heads/master' || github.base_ref == 'master' }} # base_ref for pull request check, ref for push steps: - name: Checkout uses: actions/checkout@v3 - name: Check CMakeLists.txt Version run: | version=$(grep -o -E '^project\(Sunshine VERSION [0-9]+\.[0-9]+\.[0-9]+' CMakeLists.txt | grep -o -E '[0-9]+\.[0-9]+\.[0-9]+') echo "cmakelists_version=${version}" >> $GITHUB_ENV - name: Compare CMakeList.txt Version if: ${{ env.cmakelists_version != needs.check_changelog.outputs.next_version_bare }} run: | echo CMakeLists version: "$cmakelists_version" echo Changelog version: "${{ needs.check_changelog.outputs.next_version_bare }}" echo Within 'CMakeLists.txt' change "project(Sunshine [VERSION $cmakelists_version]" to "project(Sunshine [VERSION ${{ needs.check_changelog.outputs.next_version_bare }}]" exit 1 build_linux: name: Linux runs-on: ubuntu-20.04 needs: check_changelog steps: - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Setup Dependencies Linux run: | sudo add-apt-repository ppa:savoury1/ffmpeg4 -y # sudo add-apt-repository ppa:savoury1/boost-defaults-1.71 -y sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y sudo apt-get update -y sudo apt-get install -y \ build-essential \ cmake \ gcc-10 \ git \ g++-10 \ libavdevice-dev \ libboost-filesystem-dev \ libboost-log-dev \ libboost-thread-dev \ libcap-dev \ libdrm-dev \ libevdev-dev \ libpulse-dev \ libopus-dev \ libssl-dev \ libwayland-dev \ libx11-dev \ libxcb-shm0-dev \ libxcb-xfixes0-dev \ libxcb1-dev \ libxfixes-dev \ libxrandr-dev \ libxtst-dev \ wget # # Ubuntu 20.04+ packages # libboost-filesystem-dev # libboost-log-dev # libboost-thread-dev # # Ubuntu 18.04 packages # libboost-filesystem1.71-dev \ # libboost-log1.71-dev \ # libboost-regex1.71-dev \ # libboost-thread1.71-dev \ # clean apt cache sudo apt-get clean sudo rm -rf /var/lib/apt/lists/* # Update gcc alias sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 # Install CuDA 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 # # Install cmake (necessary for 18.04) # wget https://cmake.org/files/v3.22/cmake-3.22.2-linux-x86_64.sh # chmod +x cmake-3.22.2-linux-x86_64.sh # mkdir /opt/cmake # ./cmake-3.22.2-linux-x86_64.sh --prefix=/opt/cmake --skip-license # ln --force --symbolic /opt/cmake/bin/cmake /usr/local/bin/cmake # cmake --version - name: Build Linux run: | mkdir -p build cd build cmake -DCMAKE_BUILD_TYPE=Release -DSUNSHINE_ASSETS_DIR=/usr/local/sunshine/.assets -DSUNSHINE_CONFIG_DIR=/usr/local/sunshine/config -DSUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine -DSUNSHINE_ENABLE_WAYLAND=ON -DSUNSHINE_ENABLE_X11=ON -DSUNSHINE_ENABLE_DRM=ON -DSUNSHINE_ENABLE_CUDA=ON .. make -j ${nproc} - name: Set AppImage Version if: ${{ needs.check_changelog.outputs.next_version_bare != needs.check_changelog.outputs.latest_version }} run: | version=${{ needs.check_changelog.outputs.next_version_bare }} echo "VERSION=${version}" >> $GITHUB_ENV - name: Package Linux run: | mkdir -p artifacts cd build # variables DESKTOP_FILE="${DESKTOP_FILE:-sunshine.desktop}" ICON_FILE="${ICON_FILE:-sunshine.png}" # AppImage # https://docs.appimage.org/packaging-guide/index.html wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage chmod +x linuxdeploy-x86_64.AppImage # # https://github.com/linuxdeploy/linuxdeploy-plugin-gtk # sudo apt-get install libgtk-3-dev librsvg2-dev -y # wget https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh # chmod +x linuxdeploy-plugin-gtk.sh # export DEPLOY_GTK_VERSION=3 ./linuxdeploy-x86_64.AppImage \ --appdir . \ --executable ./sunshine \ --icon-file "../$ICON_FILE" \ --desktop-file "./$DESKTOP_FILE" \ --library /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0 \ --library /usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0 \ --library /usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0 \ --output appimage # # add this argument back if using gtk plugin # --plugin gtk \ # package cpack -G DEB cpack -G RPM # move mv Sunshine*.AppImage ../artifacts/sunshine.AppImage mv ./cpack_artifacts/Sunshine.deb ../artifacts/sunshine.deb mv ./cpack_artifacts/Sunshine.rpm ../artifacts/sunshine.rpm - name: Verify AppImage run: | wget https://github.com/TheAssassin/appimagelint/releases/download/continuous/appimagelint-x86_64.AppImage chmod +x appimagelint-x86_64.AppImage # rm -rf ~/.cache/appimagelint/ ./appimagelint-x86_64.AppImage ./artifacts/sunshine.AppImage - name: Upload Artifacts if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} uses: actions/upload-artifact@v3 with: name: sunshine-linux path: artifacts/ - name: Create Release if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} uses: SunshineStream/actions/create_release@master with: token: ${{ secrets.GITHUB_TOKEN }} next_version: ${{ needs.check_changelog.outputs.next_version }} last_version: ${{ needs.check_changelog.outputs.last_version }} release_body: ${{ needs.check_changelog.outputs.release_body }} build_mac: name: MacOS runs-on: macos-11 needs: check_changelog steps: - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Setup Dependencies MacOS run: | # install dependencies using homebrew brew install boost cmake ffmpeg opus # fix openssl header not found cd /usr/local/include ln -s ../opt/openssl/include/openssl . - name: Build MacOS run: | mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release -DSUNSHINE_ASSETS_DIR=/usr/local/sunshine/.assets -DSUNSHINE_CONFIG_DIR=/usr/local/sunshine/config .. make -j ${nproc} - name: Package MacOS run: | mkdir -p artifacts cd build # package cpack -G DragNDrop cpack -G ZIP # move mv Portfile ../artifacts/Portfile mv ./cpack_artifacts/Sunshine.dmg ../artifacts/sunshine-macos.dmg mv ./cpack_artifacts/Sunshine.zip ../artifacts/sunshine-macos.zip - name: Upload Artifacts if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} uses: actions/upload-artifact@v3 with: name: sunshine-macos path: artifacts/ - name: Create Release if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} uses: SunshineStream/actions/create_release@master with: token: ${{ secrets.GITHUB_TOKEN }} next_version: ${{ needs.check_changelog.outputs.next_version }} last_version: ${{ needs.check_changelog.outputs.last_version }} release_body: ${{ needs.check_changelog.outputs.release_body }} build_win: name: Windows runs-on: windows-2019 needs: check_changelog steps: - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - name: Setup Dependencies Windows uses: msys2/setup-msys2@v2 with: update: true install: >- base-devel diffutils git make mingw-w64-x86_64-binutils mingw-w64-x86_64-boost mingw-w64-x86_64-cmake mingw-w64-x86_64-nsis mingw-w64-x86_64-openssl mingw-w64-x86_64-opus mingw-w64-x86_64-toolchain mingw-w64-x86_64-x265 nasm yasm - name: Build Windows shell: msys2 {0} run: | mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release -DSUNSHINE_ASSETS_DIR=assets -DSUNSHINE_CONFIG_DIR=config -G "MinGW Makefiles" .. mingw32-make -j2 - name: Package Windows shell: msys2 {0} run: | mkdir -p artifacts cd build # package cpack -G NSIS cpack -G ZIP # move mv ./cpack_artifacts/Sunshine.exe ../artifacts/sunshine-windows.exe mv ./cpack_artifacts/Sunshine.zip ../artifacts/sunshine-windows.zip - name: Upload Artifacts if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} uses: actions/upload-artifact@v3 with: name: sunshine-windows path: artifacts/ - name: Create Release if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} uses: SunshineStream/actions/create_release@master with: token: ${{ secrets.GITHUB_TOKEN }} next_version: ${{ needs.check_changelog.outputs.next_version }} last_version: ${{ needs.check_changelog.outputs.last_version }} release_body: ${{ needs.check_changelog.outputs.release_body }}