809 lines
27 KiB
YAML
Raw Normal View History

2022-08-07 20:26:40 -04:00
---
2022-02-06 17:32:55 -05:00
name: CI
2021-12-17 10:55:23 -05:00
on:
pull_request:
branches: [master, nightly]
types: [opened, synchronize, reopened]
push:
2022-10-28 17:04:33 -04:00
branches: [master, nightly]
2021-12-17 10:55:23 -05:00
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
2021-12-17 10:55:23 -05:00
jobs:
github_env:
name: GitHub Env Debug
runs-on: ubuntu-latest
steps:
- name: Dump github context
run: echo "$GITHUB_CONTEXT"
shell: bash
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
2022-01-11 17:40:58 -05:00
check_changelog:
name: Check Changelog
runs-on: ubuntu-latest
steps:
- name: Checkout
2022-10-28 17:04:33 -04:00
if: ${{ github.ref == 'refs/heads/master' || github.base_ref == 'master' }}
uses: actions/checkout@v4
- 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: LizardByte/.github/actions/verify_changelog@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
2022-01-11 17:40:58 -05:00
outputs:
next_version: ${{ steps.verify_changelog.outputs.changelog_parser_version }}
2022-02-13 12:07:10 -05:00
next_version_bare: ${{ steps.verify_changelog.outputs.changelog_parser_version_bare }}
2022-01-11 17:40:58 -05:00
last_version: ${{ steps.verify_changelog.outputs.latest_release_tag_name }}
release_body: ${{ steps.verify_changelog.outputs.changelog_parser_description }}
2022-01-11 17:40:58 -05:00
# todo - remove this job once versioning is fully automated by cmake
2022-02-13 12:07:10 -05:00
check_versions:
name: Check Versions
runs-on: ubuntu-latest
2022-04-30 12:38:08 -04:00
needs: check_changelog
if: ${{ github.ref == 'refs/heads/master' || github.base_ref == 'master' }}
# base_ref for pull request check, ref for push
2022-02-13 12:07:10 -05:00
steps:
- name: Checkout
uses: actions/checkout@v4
2022-02-13 12:07:10 -05:00
- name: Check CMakeLists.txt Version
run: |
2022-08-07 20:26:40 -04:00
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
2022-02-13 12:07:10 -05:00
- 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 }}"
2022-08-07 20:26:40 -04:00
echo Within 'CMakeLists.txt' change "project(Sunshine [VERSION $cmakelists_version]" to \
"project(Sunshine [VERSION ${{ needs.check_changelog.outputs.next_version_bare }}]"
exit 1
2022-10-28 17:04:33 -04:00
setup_release:
name: Setup Release
needs: check_changelog
runs-on: ubuntu-latest
steps:
- name: Set release details
id: release_details
2022-10-30 15:14:50 -04:00
env:
2022-10-30 17:58:01 -04:00
RELEASE_BODY: ${{ needs.check_changelog.outputs.release_body }}
2022-10-28 17:04:33 -04:00
run: |
# determine to create a release or not
if [[ $GITHUB_EVENT_NAME == "push" ]]; then
RELEASE=true
else
RELEASE=false
fi
# set the release tag
COMMIT=${{ github.sha }}
2022-10-28 17:04:33 -04:00
if [[ $GITHUB_REF == refs/heads/master ]]; then
TAG="${{ needs.check_changelog.outputs.next_version }}"
RELEASE_NAME="${{ needs.check_changelog.outputs.next_version }}"
RELEASE_BODY="$RELEASE_BODY"
2022-10-28 17:04:33 -04:00
PRE_RELEASE="false"
elif [[ $GITHUB_REF == refs/heads/nightly ]]; then
2022-10-29 16:52:03 -04:00
TAG="nightly-dev"
RELEASE_NAME="nightly"
RELEASE_BODY="automated nightly release - $(date -u +'%Y-%m-%dT%H:%M:%SZ') - ${COMMIT}"
2022-10-28 17:04:33 -04:00
PRE_RELEASE="true"
fi
echo "create_release=${RELEASE}" >> $GITHUB_OUTPUT
echo "release_tag=${TAG}" >> $GITHUB_OUTPUT
echo "release_commit=${COMMIT}" >> $GITHUB_OUTPUT
echo "release_name=${RELEASE_NAME}" >> $GITHUB_OUTPUT
2022-10-28 17:04:33 -04:00
echo "pre_release=${PRE_RELEASE}" >> $GITHUB_OUTPUT
# this is stupid but works for multiline strings
echo "RELEASE_BODY<<EOF" >> $GITHUB_ENV
echo "$RELEASE_BODY" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
2022-10-28 17:04:33 -04:00
outputs:
create_release: ${{ steps.release_details.outputs.create_release }}
release_tag: ${{ steps.release_details.outputs.release_tag }}
2022-10-28 22:08:23 -04:00
release_commit: ${{ steps.release_details.outputs.release_commit }}
release_name: ${{ steps.release_details.outputs.release_name }}
release_body: ${{ env.RELEASE_BODY }}
2022-10-28 17:04:33 -04:00
pre_release: ${{ steps.release_details.outputs.pre_release }}
2022-10-29 16:52:03 -04:00
setup_flatpak_matrix:
name: Setup Flatpak Matrix
runs-on: ubuntu-latest
steps:
- name: Set release details
id: flatpak_matrix
# https://www.cynkra.com/blog/2020-12-23-dynamic-gha
run: |
# determine which architectures to build
if [[ $GITHUB_EVENT_NAME == "push" ]]; then
matrix=$((
echo '{ "arch" : ["x86_64", "aarch64"] }'
) | jq -c .)
else
matrix=$((
echo '{ "arch" : ["x86_64"] }'
) | jq -c .)
fi
echo $matrix
echo $matrix | jq .
echo "matrix=$matrix" >> $GITHUB_OUTPUT
outputs:
matrix: ${{ steps.flatpak_matrix.outputs.matrix }}
build_linux_flatpak:
name: Linux Flatpak
2022-10-10 07:14:12 -04:00
runs-on: ubuntu-22.04
2022-10-29 16:52:03 -04:00
needs: [setup_release, setup_flatpak_matrix]
strategy:
fail-fast: false # false to test all, true to fail entire job if any fail
2022-10-29 16:52:03 -04:00
matrix: ${{fromJson(needs.setup_flatpak_matrix.outputs.matrix)}}
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@v8
with:
root-reserve-mb: 10240
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'false'
- name: Checkout
uses: actions/checkout@v4
2023-09-18 18:14:53 -04:00
- name: Checkout Flathub Shared Modules
uses: actions/checkout@v4
with:
repository: flathub/shared-modules
path: build/shared-modules
- name: Setup Dependencies Linux Flatpak
run: |
PLATFORM_VERSION=22.08
2022-11-18 15:44:06 -05:00
sudo apt-get update -y
sudo apt-get install -y \
2022-08-07 20:26:40 -04:00
cmake \
2022-12-11 17:46:19 -05:00
flatpak \
qemu-user-static
2022-11-18 15:44:06 -05:00
sudo su $(whoami) -c "flatpak --user remote-add --if-not-exists flathub \
https://flathub.org/repo/flathub.flatpakrepo"
sudo su $(whoami) -c "flatpak --user install -y flathub \
org.flatpak.Builder \
2022-11-18 15:44:06 -05:00
org.freedesktop.Platform/${{ matrix.arch }}/${PLATFORM_VERSION} \
org.freedesktop.Sdk/${{ matrix.arch }}/${PLATFORM_VERSION} \
org.freedesktop.Sdk.Extension.node18/${{ matrix.arch }}/${PLATFORM_VERSION} \
2023-09-18 18:14:53 -04:00
org.freedesktop.Sdk.Extension.vala/${{ matrix.arch }}/${PLATFORM_VERSION} \
2022-11-18 15:44:06 -05:00
"
2022-10-20 20:08:19 -04:00
- name: Cache Flatpak build
uses: actions/cache@v3
with:
path: ./build/.flatpak-builder
key: flatpak-${{ matrix.arch }}-${{ github.sha }}
restore-keys: |
flatpak-${{ matrix.arch }}-
- name: Configure Flatpak Manifest
run: |
# variables for manifest
branch=${GITHUB_HEAD_REF}
2022-08-07 20:26:40 -04:00
# check the branch variable
if [ -z "$branch" ]
then
2022-08-07 20:26:40 -04:00
echo "This is a PUSH event"
branch=${{ github.ref_name }}
commit=${{ github.sha }}
clone_url=${{ github.event.repository.clone_url }}
else
2022-08-07 20:26:40 -04:00
echo "This is a PR event"
commit=${{ github.event.pull_request.head.sha }}
clone_url=${{ github.event.pull_request.head.repo.clone_url }}
fi
echo "Branch: ${branch}"
echo "Commit: ${commit}"
echo "Clone URL: ${clone_url}"
2022-08-07 20:26:40 -04:00
mkdir -p build
mkdir -p artifacts
2022-08-07 20:26:40 -04:00
cd build
2022-08-07 20:26:40 -04:00
cmake -DGITHUB_CLONE_URL=${clone_url} \
-DGITHUB_BRANCH=${branch} \
-DGITHUB_COMMIT=${commit} \
-DSUNSHINE_CONFIGURE_FLATPAK_MAN=ON \
2022-08-07 20:26:40 -04:00
-DSUNSHINE_CONFIGURE_ONLY=ON \
..
- name: Build Linux Flatpak
working-directory: build
run: |
2022-10-21 19:28:36 -04:00
sudo su $(whoami) -c 'flatpak run org.flatpak.Builder --arch=${{ matrix.arch }} --repo=repo --force-clean \
--stop-at=cuda build-sunshine dev.lizardbyte.sunshine.yml'
cp -r .flatpak-builder copy-of-flatpak-builder
sudo su $(whoami) -c 'flatpak run org.flatpak.Builder --arch=${{ matrix.arch }} --repo=repo --force-clean \
build-sunshine dev.lizardbyte.sunshine.yml'
2022-10-21 19:40:54 -04:00
rm -rf .flatpak-builder
2022-10-21 19:28:36 -04:00
mv copy-of-flatpak-builder .flatpak-builder
sudo su $(whoami) -c 'flatpak build-bundle --arch=${{ matrix.arch }} ./repo \
../artifacts/sunshine_${{ matrix.arch }}.flatpak dev.lizardbyte.sunshine'
2022-10-20 13:37:34 -04:00
sudo su $(whoami) -c 'flatpak build-bundle --runtime --arch=${{ matrix.arch }} ./repo \
../artifacts/sunshine_debug_${{ matrix.arch }}.flatpak dev.lizardbyte.sunshine.Debug'
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: sunshine-linux-flatpak-${{ matrix.arch }}
path: artifacts/
2022-10-28 17:04:33 -04:00
- name: Create/Update GitHub Release
if: ${{ needs.setup_release.outputs.create_release == 'true' }}
uses: ncipollo/release-action@v1
with:
name: ${{ needs.setup_release.outputs.release_name }}
2022-10-28 17:04:33 -04:00
tag: ${{ needs.setup_release.outputs.release_tag }}
commit: ${{ needs.setup_release.outputs.release_commit }}
2022-10-28 17:04:33 -04:00
artifacts: "*artifacts/*"
token: ${{ secrets.GH_BOT_TOKEN }}
2022-10-28 17:04:33 -04:00
allowUpdates: true
body: ${{ needs.setup_release.outputs.release_body }}
discussionCategory: announcements
prerelease: ${{ needs.setup_release.outputs.pre_release }}
2022-05-06 12:55:43 -04:00
build_linux:
name: Linux ${{ matrix.type }}
2022-12-11 20:26:25 -05:00
runs-on: ubuntu-${{ matrix.dist }}
2022-10-28 17:04:33 -04:00
needs: [check_changelog, setup_release]
strategy:
fail-fast: false # false to test all, true to fail entire job if any fail
matrix:
2022-08-07 20:26:40 -04:00
include: # package these differently
- type: AppImage
EXTRA_ARGS: '-DSUNSHINE_BUILD_APPIMAGE=ON'
2022-12-11 20:26:25 -05:00
dist: 20.04
2022-04-29 21:19:05 +01:00
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@v8
with:
root-reserve-mb: 20480
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'false'
2022-04-29 21:19:05 +01:00
- name: Checkout
uses: actions/checkout@v4
2022-04-29 21:19:05 +01:00
with:
submodules: recursive
2022-05-06 12:55:43 -04:00
- name: Setup Dependencies Linux
2022-04-29 21:19:05 +01:00
run: |
2022-05-10 21:18:37 -04:00
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
2022-08-07 20:26:40 -04:00
2022-12-11 20:26:25 -05:00
if [[ ${{ matrix.dist }} == "18.04" ]]; then
# Ubuntu 18.04 packages
sudo add-apt-repository ppa:savoury1/boost-defaults-1.71 -y
sudo apt-get update -y
sudo apt-get install -y \
libboost-filesystem1.71-dev \
libboost-locale1.71-dev \
2022-12-11 20:26:25 -05:00
libboost-log1.71-dev \
libboost-regex1.71-dev \
libboost-program-options1.71-dev
2022-12-11 20:26:25 -05:00
# Install cmake
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
# install newer tar from focal... appimagelint fails on 18.04 without this
echo "original tar version"
tar --version
wget -O tar.deb http://security.ubuntu.com/ubuntu/pool/main/t/tar/tar_1.30+dfsg-7ubuntu0.20.04.3_amd64.deb
2022-12-11 20:26:25 -05:00
sudo apt-get -y install -f ./tar.deb
echo "new tar version"
tar --version
else
# Ubuntu 20.04+ packages
sudo apt-get update -y
sudo apt-get install -y \
cmake \
libboost-filesystem-dev \
libboost-locale-dev \
2022-12-11 20:26:25 -05:00
libboost-log-dev \
libboost-program-options-dev
2022-12-11 20:26:25 -05:00
fi
2022-05-10 21:18:37 -04:00
sudo apt-get install -y \
2022-08-07 20:26:40 -04:00
build-essential \
gcc-10 \
g++-10 \
2023-09-18 18:14:53 -04:00
libayatana-appindicator3-dev \
2022-08-07 20:26:40 -04:00
libavdevice-dev \
libcap-dev \
libcurl4-openssl-dev \
2022-08-07 20:26:40 -04:00
libdrm-dev \
libevdev-dev \
libmfx-dev \
2023-09-18 18:14:53 -04:00
libnotify-dev \
2022-12-11 17:46:19 -05:00
libnuma-dev \
2022-08-07 20:26:40 -04:00
libopus-dev \
2022-12-11 17:46:19 -05:00
libpulse-dev \
2022-08-07 20:26:40 -04:00
libssl-dev \
2022-12-11 17:46:19 -05:00
libva-dev \
libvdpau-dev \
2022-08-07 20:26:40 -04:00
libwayland-dev \
libx11-dev \
libxcb-shm0-dev \
libxcb-xfixes0-dev \
libxcb1-dev \
libxfixes-dev \
libxrandr-dev \
libxtst-dev \
wget
2022-05-10 21:18:37 -04:00
# clean apt cache
sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/*
2022-08-07 20:26:40 -04:00
2022-05-10 21:18:37 -04:00
# Update gcc alias
2022-12-11 20:26:25 -05:00
# https://stackoverflow.com/a/70653945/11214013
2022-08-07 20:26:40 -04:00
sudo update-alternatives --install \
2022-12-11 20:26:25 -05:00
/usr/bin/gcc gcc /usr/bin/gcc-10 100 \
--slave /usr/bin/g++ g++ /usr/bin/g++-10 \
--slave /usr/bin/gcov gcov /usr/bin/gcov-10 \
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-10 \
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-10
2022-08-07 20:26:40 -04:00
# Install CUDA
2022-08-07 20:26:40 -04:00
sudo wget \
https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run \
2022-08-07 20:26:40 -04:00
--progress=bar:force:noscroll -q --show-progress -O /root/cuda.run
2022-05-10 21:18:37 -04:00
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
2022-08-07 20:26:40 -04:00
2022-05-06 12:55:43 -04:00
- name: Build Linux
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
BUILD_VERSION: ${{ needs.check_changelog.outputs.next_version_bare }}
COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
2022-04-29 21:19:05 +01:00
run: |
2022-05-06 12:55:43 -04:00
mkdir -p build
mkdir -p artifacts
2022-08-07 20:26:40 -04:00
2022-11-18 15:44:06 -05:00
npm install
2022-05-06 12:55:43 -04:00
cd build
2022-08-07 20:26:40 -04:00
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DSUNSHINE_ASSETS_DIR=share/sunshine \
2022-08-07 20:26:40 -04:00
-DSUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine \
-DSUNSHINE_ENABLE_WAYLAND=ON \
-DSUNSHINE_ENABLE_X11=ON \
-DSUNSHINE_ENABLE_DRM=ON \
-DSUNSHINE_ENABLE_CUDA=ON \
${{ matrix.EXTRA_ARGS }} \
..
2022-05-06 12:55:43 -04:00
make -j ${nproc}
2022-04-29 21:19:05 +01:00
- name: Package Linux - CPACK
# todo - this is no longer used
if: ${{ matrix.type == 'cpack' }}
working-directory: build
run: |
cpack -G DEB
2022-12-11 20:26:25 -05:00
mv ./cpack_artifacts/Sunshine.deb ../artifacts/sunshine-${{ matrix.dist }}.deb
2022-12-11 20:26:25 -05:00
if [[ ${{ matrix.dist }} == "20.04" ]]; then
cpack -G RPM
mv ./cpack_artifacts/Sunshine.rpm ../artifacts/sunshine.rpm
fi
- name: Set AppImage Version
if: ${{ matrix.type == 'AppImage' && ( needs.check_changelog.outputs.next_version_bare != needs.check_changelog.outputs.last_version ) }} # yamllint disable-line rule:line-length
run: |
version=${{ needs.check_changelog.outputs.next_version_bare }}
echo "VERSION=${version}" >> $GITHUB_ENV
2022-04-30 12:38:08 -04:00
- name: Package Linux - AppImage
if: ${{ matrix.type == 'AppImage' }}
working-directory: build
run: |
# install sunshine to the DESTDIR
make install DESTDIR=AppDir
2022-08-07 20:26:40 -04:00
# custom AppRun file
cp -f ../packaging/linux/AppImage/AppRun ./AppDir/
chmod +x ./AppDir/AppRun
2022-08-07 20:26:40 -04:00
2022-05-06 12:55:43 -04:00
# variables
DESKTOP_FILE="${DESKTOP_FILE:-sunshine.desktop}"
ICON_FILE="${ICON_FILE:-sunshine.png}"
2022-08-07 20:26:40 -04:00
2022-05-06 12:55:43 -04:00
# AppImage
# https://docs.appimage.org/packaging-guide/index.html
2022-05-10 18:54:50 -04:00
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy-x86_64.AppImage
2022-08-07 20:26:40 -04:00
# 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
2022-05-10 18:54:50 -04:00
./linuxdeploy-x86_64.AppImage \
2022-08-07 20:26:40 -04:00
--appdir ./AppDir \
--plugin gtk \
2022-08-07 20:26:40 -04:00
--executable ./sunshine \
--icon-file "../$ICON_FILE" \
--desktop-file "./$DESKTOP_FILE" \
--output appimage
2022-04-30 12:38:08 -04:00
2022-05-06 12:55:43 -04:00
# move
2022-05-06 15:19:11 -04:00
mv Sunshine*.AppImage ../artifacts/sunshine.AppImage
2022-08-07 20:26:40 -04:00
# permissions
chmod +x ../artifacts/sunshine.AppImage
2021-12-17 10:55:23 -05:00
- name: Verify AppImage
if: ${{ matrix.type == 'AppImage' }}
run: |
2022-05-06 12:55:43 -04:00
wget https://github.com/TheAssassin/appimagelint/releases/download/continuous/appimagelint-x86_64.AppImage
chmod +x appimagelint-x86_64.AppImage
2022-08-07 20:26:40 -04:00
2022-05-10 21:18:37 -04:00
# rm -rf ~/.cache/appimagelint/
2022-08-07 20:26:40 -04:00
2022-05-06 12:55:43 -04:00
./appimagelint-x86_64.AppImage ./artifacts/sunshine.AppImage
2022-04-30 12:38:08 -04:00
- name: Upload Artifacts
2022-04-29 21:19:05 +01:00
uses: actions/upload-artifact@v3
with:
2022-12-11 20:26:25 -05:00
name: sunshine-linux-${{ matrix.type }}-${{ matrix.dist }}
2022-04-30 12:38:08 -04:00
path: artifacts/
2022-05-12 21:05:23 -04:00
2022-10-28 17:04:33 -04:00
- name: Create/Update GitHub Release
if: ${{ needs.setup_release.outputs.create_release == 'true' }}
uses: ncipollo/release-action@v1
with:
name: ${{ needs.setup_release.outputs.release_name }}
2022-10-28 17:04:33 -04:00
tag: ${{ needs.setup_release.outputs.release_tag }}
commit: ${{ needs.setup_release.outputs.release_commit }}
2022-10-28 17:04:33 -04:00
artifacts: "*artifacts/*"
token: ${{ secrets.GH_BOT_TOKEN }}
2022-10-28 17:04:33 -04:00
allowUpdates: true
body: ${{ needs.setup_release.outputs.release_body }}
discussionCategory: announcements
prerelease: ${{ needs.setup_release.outputs.pre_release }}
2022-04-30 19:20:16 -04:00
build_mac:
name: MacOS
2022-06-13 20:50:22 -04:00
runs-on: macos-11
needs: [check_changelog, setup_release]
2022-04-30 19:20:16 -04:00
steps:
- name: Checkout
uses: actions/checkout@v4
2022-04-30 19:20:16 -04:00
with:
submodules: recursive
- name: Setup Dependencies MacOS
run: |
# install dependencies using homebrew
brew install boost cmake curl node opus pkg-config
2022-04-30 19:20:16 -04:00
# fix openssl header not found
2022-06-13 20:50:22 -04:00
ln -sf /usr/local/opt/openssl/include/openssl /usr/local/include/openssl
2022-04-30 19:20:16 -04:00
- name: Build MacOS
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
BUILD_VERSION: ${{ needs.check_changelog.outputs.next_version_bare }}
COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
2022-04-30 19:20:16 -04:00
run: |
2022-11-18 15:44:06 -05:00
npm install
2022-04-30 19:20:16 -04:00
mkdir build
cd build
2022-08-07 20:26:40 -04:00
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DSUNSHINE_ASSETS_DIR=local/sunshine/assets \
-DSUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine \
2022-08-07 20:26:40 -04:00
..
2022-04-30 19:20:16 -04:00
make -j ${nproc}
- name: Package MacOS
run: |
mkdir -p artifacts
cd build
# package
cpack -G DragNDrop
2023-05-04 21:07:41 -04:00
mv ./cpack_artifacts/Sunshine.dmg ../artifacts/sunshine.dmg
2022-08-07 20:26:40 -04:00
2023-05-04 21:07:41 -04:00
# cpack -G Bundle
# mv ./cpack_artifacts/Sunshine.dmg ../artifacts/sunshine-bundle.dmg
2022-04-30 19:20:16 -04:00
2022-06-13 20:50:22 -04:00
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: sunshine-macos
path: artifacts/
2023-05-04 21:07:41 -04:00
- name: Create/Update GitHub Release
if: ${{ needs.setup_release.outputs.create_release == 'true' }}
uses: ncipollo/release-action@v1
with:
name: ${{ needs.setup_release.outputs.release_name }}
tag: ${{ needs.setup_release.outputs.release_tag }}
commit: ${{ needs.setup_release.outputs.release_commit }}
artifacts: "*artifacts/*"
token: ${{ secrets.GH_BOT_TOKEN }}
allowUpdates: true
body: ${{ needs.setup_release.outputs.release_body }}
discussionCategory: announcements
prerelease: ${{ needs.setup_release.outputs.pre_release }}
2022-06-13 20:50:22 -04:00
2022-06-16 16:55:16 -04:00
build_mac_port:
name: Macports
needs: [check_changelog, setup_release]
runs-on: macos-11
2022-06-16 16:55:16 -04:00
steps:
2022-06-18 13:05:34 -04:00
- name: Checkout
uses: actions/checkout@v4
2022-06-16 16:55:16 -04:00
- name: Checkout ports
uses: actions/checkout@v4
2022-06-16 16:55:16 -04:00
with:
repository: macports/macports-ports
fetch-depth: 64
path: ports
- name: Checkout mpbb
uses: actions/checkout@v4
2022-06-16 16:55:16 -04:00
with:
repository: macports/mpbb
path: mpbb
2022-06-18 13:05:34 -04:00
- name: Setup Dependencies Macports
2022-06-16 16:55:16 -04:00
run: |
2022-06-18 13:05:34 -04:00
# install dependencies using homebrew
brew install cmake
2022-06-16 16:55:16 -04:00
2022-06-18 13:05:34 -04:00
- name: Configure Portfile
run: |
# variables for Portfile
branch=${GITHUB_HEAD_REF}
2022-08-07 20:26:40 -04:00
2022-06-18 13:05:34 -04:00
# check the branch variable
if [ -z "$branch" ]
then
2022-08-07 20:26:40 -04:00
echo "This is a PUSH event"
commit=${{ github.sha }}
clone_url=${{ github.event.repository.clone_url }}
2022-06-18 13:05:34 -04:00
else
2022-08-07 20:26:40 -04:00
echo "This is a PR event"
commit=${{ github.event.pull_request.head.sha }}
clone_url=${{ github.event.pull_request.head.repo.clone_url }}
2022-06-18 13:05:34 -04:00
fi
echo "Commit: ${commit}"
echo "Clone URL: ${clone_url}"
2022-08-07 20:26:40 -04:00
2022-06-18 13:05:34 -04:00
mkdir build
cd build
cmake \
-DGITHUB_COMMIT=${commit} \
2022-08-07 20:26:40 -04:00
-DGITHUB_CLONE_URL=${clone_url} \
-DSUNSHINE_CONFIGURE_PORTFILE=ON \
-DSUNSHINE_CONFIGURE_ONLY=ON \
..
2022-06-18 13:05:34 -04:00
cd ..
2022-08-07 20:26:40 -04:00
2022-06-18 13:05:34 -04:00
# copy Portfile to artifacts
mkdir -p artifacts
cp -f ./build/Portfile ./artifacts/
2022-08-07 20:26:40 -04:00
2022-06-18 13:05:34 -04:00
# copy Portfile to ports
mkdir -p ./ports/multimedia/Sunshine
cp -f ./build/Portfile ./ports/multimedia/Sunshine/Portfile
2022-08-07 20:26:40 -04:00
# testing
cat ./artifacts/Portfile
2022-06-16 16:55:16 -04:00
2022-06-18 13:05:34 -04:00
- name: Bootstrap MacPorts
run: |
2022-06-16 16:55:16 -04:00
. ports/.github/workflows/bootstrap.sh
2022-08-07 20:26:40 -04:00
2022-06-16 16:55:16 -04:00
# Add getopt, mpbb and the MacPorts paths to $PATH for the subsequent steps.
echo "/opt/mports/bin" >> $GITHUB_PATH
echo "${PWD}/mpbb" >> $GITHUB_PATH
echo "/opt/local/bin" >> $GITHUB_PATH
echo "/opt/local/sbin" >> $GITHUB_PATH
2023-08-31 14:38:14 -04:00
- name: Run port lint
2022-06-16 16:55:16 -04:00
run: |
2023-08-31 14:38:14 -04:00
port -q lint "Sunshine"
- name: Build port
env:
subportlist: ${{ steps.subportlist.outputs.subportlist }}
2022-06-16 16:55:16 -04:00
run: |
2023-08-31 14:38:14 -04:00
subport="Sunshine"
workdir="/tmp/mpbb/$subport"
mkdir -p "$workdir/logs"
echo "::group::Installing dependencies"
sudo mpbb \
--work-dir "$workdir" \
install-dependencies \
"$subport"
echo "::endgroup::"
echo "::group::Installing ${subport}"
sudo mpbb \
--work-dir "$workdir" \
install-port \
--source \
"$subport"
echo "::endgroup::"
2022-06-16 16:55:16 -04:00
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: sunshine-macports
2022-06-16 16:55:16 -04:00
path: artifacts/
2022-10-28 17:04:33 -04:00
- name: Create/Update GitHub Release
if: ${{ needs.setup_release.outputs.create_release == 'true' }}
uses: ncipollo/release-action@v1
2022-06-16 16:55:16 -04:00
with:
name: ${{ needs.setup_release.outputs.release_name }}
2022-10-28 17:04:33 -04:00
tag: ${{ needs.setup_release.outputs.release_tag }}
commit: ${{ needs.setup_release.outputs.release_commit }}
2022-10-28 17:04:33 -04:00
artifacts: "*artifacts/*"
token: ${{ secrets.GH_BOT_TOKEN }}
2022-10-28 17:04:33 -04:00
allowUpdates: true
body: ${{ needs.setup_release.outputs.release_body }}
discussionCategory: announcements
prerelease: ${{ needs.setup_release.outputs.pre_release }}
2022-04-30 19:20:16 -04:00
build_win:
name: Windows
runs-on: windows-2019
needs: [check_changelog, setup_release]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
2022-04-30 12:38:08 -04:00
- name: Setup Dependencies Windows
2021-12-24 11:27:40 +01:00
uses: msys2/setup-msys2@v2
2021-12-20 21:31:22 -05:00
with:
2021-12-24 11:27:40 +01:00
update: true
install: >-
base-devel
2022-04-30 12:38:08 -04:00
diffutils
2021-12-24 11:27:40 +01:00
git
2022-04-30 12:38:08 -04:00
make
2021-12-24 11:27:40 +01:00
mingw-w64-x86_64-binutils
2022-04-30 12:38:08 -04:00
mingw-w64-x86_64-boost
2021-12-24 11:27:40 +01:00
mingw-w64-x86_64-cmake
mingw-w64-x86_64-curl
mingw-w64-x86_64-onevpl
2022-04-30 12:38:08 -04:00
mingw-w64-x86_64-nsis
mingw-w64-x86_64-openssl
mingw-w64-x86_64-opus
2021-12-24 11:27:40 +01:00
mingw-w64-x86_64-toolchain
2022-04-30 12:38:08 -04:00
nasm
2023-01-01 23:59:53 -05:00
wget
2022-04-30 12:38:08 -04:00
yasm
2022-11-18 15:44:06 -05:00
- name: Install npm packages
run: |
npm install
- name: Build Windows
2021-12-24 11:27:40 +01:00
shell: msys2 {0}
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
BUILD_VERSION: ${{ needs.check_changelog.outputs.next_version_bare }}
COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
run: |
2022-04-30 12:38:08 -04:00
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
2022-08-07 20:26:40 -04:00
-DSUNSHINE_ASSETS_DIR=assets \
-G "MinGW Makefiles" \
..
2022-12-28 16:30:32 -05:00
mingw32-make -j$(nproc)
2022-04-30 19:06:19 -04:00
2022-04-30 12:38:08 -04:00
- name: Package Windows
2022-04-29 21:19:05 +01:00
shell: msys2 {0}
run: |
2022-04-30 12:38:08 -04:00
mkdir -p artifacts
cd build
# package
2022-05-05 22:17:07 -04:00
cpack -G NSIS
cpack -G ZIP
2022-04-30 12:38:08 -04:00
# move
2023-02-20 17:39:49 -05:00
mv ./cpack_artifacts/Sunshine.exe ../artifacts/sunshine-windows-installer.exe
mv ./cpack_artifacts/Sunshine.zip ../artifacts/sunshine-windows-portable.zip
- name: Package Windows Debug Info
working-directory: build
run: |
# save the original binaries with debug info
7z -r `
"-xr!CMakeFiles" `
"-xr!cpack_artifacts" `
a "../artifacts/sunshine-debuginfo-win32.zip" "*.exe"
2022-04-30 12:38:08 -04:00
- name: Upload Artifacts
2022-04-29 21:19:05 +01:00
uses: actions/upload-artifact@v3
with:
2022-04-30 12:38:08 -04:00
name: sunshine-windows
path: artifacts/
2022-10-28 17:04:33 -04:00
- name: Create/Update GitHub Release
if: ${{ needs.setup_release.outputs.create_release == 'true' }}
uses: ncipollo/release-action@v1
with:
name: ${{ needs.setup_release.outputs.release_name }}
2022-10-28 17:04:33 -04:00
tag: ${{ needs.setup_release.outputs.release_tag }}
commit: ${{ needs.setup_release.outputs.release_commit }}
2022-10-28 17:04:33 -04:00
artifacts: "*artifacts/*"
token: ${{ secrets.GH_BOT_TOKEN }}
2022-10-28 17:04:33 -04:00
allowUpdates: true
body: ${{ needs.setup_release.outputs.release_body }}
discussionCategory: announcements
prerelease: ${{ needs.setup_release.outputs.pre_release }}
2022-10-28 15:44:27 -04:00
release-winget:
name: Release to WinGet
2022-11-02 10:09:01 -04:00
needs: [setup_release, build_win]
if: |
(github.repository_owner == 'LizardByte' &&
needs.setup_release.outputs.create_release == 'true' &&
github.ref == 'refs/heads/master')
runs-on: ubuntu-latest
2022-10-28 15:44:27 -04:00
steps:
- name: Release to WinGet
uses: vedantmgoyal2009/winget-releaser@v2
2022-10-28 15:44:27 -04:00
with:
identifier: LizardByte.Sunshine
2022-10-28 17:04:33 -04:00
release-tag: ${{ needs.setup_release.outputs.release_tag }}
2022-10-28 15:44:27 -04:00
installers-regex: '\.exe$' # only .exe files
token: ${{ secrets.GH_BOT_TOKEN }}