-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
259 lines (235 loc) · 10.9 KB
/
CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
name: CI
on:
pull_request:
branches: [master, nightly]
types: [opened, synchronize, edited, 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_appimage:
name: AppImage
runs-on: ubuntu-20.04
needs: check_changelog
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Dependencies AppImage
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 update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-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 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: 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 AppImage
# https://docs.appimage.org/packaging-guide/index.html
run: |
mkdir -p appimage_temp && cd appimage_temp
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/}"
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 "../appimage-build/$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-appimage.zip ./sunshine/*
mv sunshine-appimage.zip ../artifacts/
- name: Verify AppImage
run: |
cd appimage_temp
wget https://github.com/TheAssassin/appimagelint/releases/download/continuous/appimagelint-x86_64.AppImage && chmod +x appimagelint-x86_64.AppImage && ./appimagelint-x86_64.AppImage ./sunshine/sunshine.AppImage
- name: Upload Artifacts
if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
uses: actions/upload-artifact@v3
with:
name: sunshine-appimage
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_linux:
name: Linux
runs-on: ubuntu-20.04
needs: check_changelog
strategy:
fail-fast: true # false to test all, true to fail entire job if any fail
matrix:
distro: [ debian, ubuntu_18_04, ubuntu_20_04, ubuntu_21_10 ]
package: [ -p ]
extension: [ deb ]
include: # package these differently
- distro: fedora_35
package: '-p'
extension: rpm
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Container
run: |
mkdir -p artifacts
cd scripts
sudo ./build-container.sh -c build -f Dockerfile-${{ matrix.distro }} -n sunshine-${{ matrix.distro }}
- name: Build Linux
run: |
cd scripts
sudo ./build-sunshine.sh ${{ matrix.package }} -e ${{ matrix.extension }} -u -n sunshine-${{ matrix.distro }} -s ..
- name: Package Linux
if: ${{ matrix.package != '' }}
run: |
cd scripts
sudo mv ./sunshine-${{ matrix.distro }}-build/sunshine-${{ matrix.distro }}.${{ matrix.extension }} ../artifacts/
- name: Upload Artifacts
if: ${{ matrix.package == '-p' && ( github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' ) }}
uses: actions/upload-artifact@v3
with:
name: sunshine-${{ matrix.distro }}
path: artifacts/
- name: Create Release
if: ${{ matrix.package == '-p' && 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: MSYS2 Setup
uses: msys2/setup-msys2@v2
with:
update: true
install: >-
base-devel
git
mingw-w64-x86_64-binutils
mingw-w64-x86_64-openssl
mingw-w64-x86_64-cmake
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-opus
mingw-w64-x86_64-x265
mingw-w64-x86_64-boost
git
yasm
nasm
diffutils
make
- name: Build Windows
shell: msys2 {0}
run: |
mkdir sunshine-windows-build && cd sunshine-windows-build
cmake -DCMAKE_BUILD_TYPE=Release -DSUNSHINE_ASSETS_DIR=assets -G "MinGW Makefiles" ..
mingw32-make -j2
- name: Package Windows
run: |
cd sunshine-windows-build
del ..\assets\apps_linux.json
7z a sunshine-windows.zip ..\assets
7z a sunshine-windows.zip sunshine.exe
7z a sunshine-windows.zip tools\dxgi-info.exe
7z a sunshine-windows.zip tools\audio-info.exe
7z a sunshine-windows.zip tools\sunshinesvc.exe
7z a sunshine-windows.zip ..\tools\install-service.bat
7z a sunshine-windows.zip ..\tools\uninstall-service.bat
cd ..
mkdir artifacts
move "sunshine-windows-build\sunshine-windows.zip" "artifacts"
- 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 }}