Skip to content

Commit 4039fec

Browse files
rbqvqReenigneArcher
andcommitted
ci(build/windows): add support for arm64
nsis does not support arm64, so we cannot create an installer at this time Signed-off-by: Coia Prant <coiaprant@gmail.com> Co-authored-by: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com>
1 parent e62be72 commit 4039fec

File tree

1 file changed

+95
-49
lines changed

1 file changed

+95
-49
lines changed

.github/workflows/CI.yml

Lines changed: 95 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -740,9 +740,26 @@ jobs:
740740
validate: false
741741

742742
build_win:
743-
name: Windows
743+
name: ${{ matrix.name }}
744744
needs: setup_release
745-
runs-on: windows-2019
745+
runs-on: ${{ matrix.os }}
746+
defaults:
747+
run:
748+
shell: msys2 {0}
749+
strategy:
750+
fail-fast: false
751+
matrix:
752+
include:
753+
- name: Windows-AMD64
754+
os: windows-2019
755+
arch: x86_64
756+
msystem: ucrt64
757+
toolchain: ucrt-x86_64
758+
- name: Windows-ARM64
759+
os: windows-11-arm
760+
arch: aarch64
761+
msystem: clangarm64
762+
toolchain: clang-aarch64
746763
steps:
747764
- name: Checkout
748765
uses: actions/checkout@v4
@@ -752,6 +769,7 @@ jobs:
752769
- name: Prepare tests
753770
id: prepare-tests
754771
if: false # todo: DirectX11 is not available, so even software encoder fails
772+
shell: pwsh
755773
run: |
756774
# function to download and extract a zip file
757775
function DownloadAndExtract {
@@ -854,63 +872,84 @@ jobs:
854872
Get-Content -Path monitor_list.txt
855873
856874
- name: Setup Dependencies Windows
857-
# if a dependency needs to be pinned, see https://github.com/LizardByte/build-deps/pull/186
858875
uses: msys2/setup-msys2@v2
859876
with:
860-
msystem: ucrt64
877+
msystem: ${{ matrix.msystem }}
861878
update: true
862-
install: >-
863-
wget
864879

865880
- name: Update Windows dependencies
866881
env:
867-
gcc_version: "14.2.0-3"
868-
shell: msys2 {0}
882+
MSYSTEM: ${{ matrix.msystem }}
883+
TOOLCHAIN: ${{ matrix.toolchain }}
869884
run: |
870-
broken_deps=(
871-
"mingw-w64-ucrt-x86_64-gcc"
872-
"mingw-w64-ucrt-x86_64-gcc-libs"
885+
# variables
886+
declare -A pinned_deps
887+
if [[ ${MSYSTEM} == "ucrt64" ]]; then
888+
pinned_deps["mingw-w64-${TOOLCHAIN}-gcc"]="14.2.0-3"
889+
pinned_deps["mingw-w64-${TOOLCHAIN}-gcc-libs"]="14.2.0-3"
890+
fi
891+
892+
dependencies=(
893+
"git"
894+
"mingw-w64-${TOOLCHAIN}-cmake"
895+
"mingw-w64-${TOOLCHAIN}-cppwinrt"
896+
"mingw-w64-${TOOLCHAIN}-curl-winssl"
897+
"mingw-w64-${TOOLCHAIN}-graphviz"
898+
"mingw-w64-${TOOLCHAIN}-miniupnpc"
899+
"mingw-w64-${TOOLCHAIN}-nlohmann-json"
900+
"mingw-w64-${TOOLCHAIN}-nodejs"
901+
"mingw-w64-${TOOLCHAIN}-onevpl"
902+
"mingw-w64-${TOOLCHAIN}-openssl"
903+
"mingw-w64-${TOOLCHAIN}-opus"
904+
"mingw-w64-${TOOLCHAIN}-toolchain"
873905
)
874906
907+
if [[ ${MSYSTEM} == "ucrt64" ]]; then
908+
dependencies+=(
909+
"mingw-w64-${TOOLCHAIN}-MinHook"
910+
"mingw-w64-${TOOLCHAIN}-nsis" # TODO: how to create an arm64 installer?
911+
)
912+
elif [[ ${MSYSTEM} == "clangarm64" ]]; then
913+
dependencies+=(
914+
"mingw-w64-${TOOLCHAIN}-gcc"
915+
)
916+
fi
917+
918+
# do not modify below this line
919+
920+
ignore_packages=()
875921
tarballs=""
876-
for dep in "${broken_deps[@]}"; do
877-
tarball="${dep}-${gcc_version}-any.pkg.tar.zst"
922+
for pkg in "${!pinned_deps[@]}"; do
923+
ignore_packages+=("${pkg}")
924+
version="${pinned_deps[$pkg]}"
925+
tarball="${pkg}-${version}-any.pkg.tar.zst"
878926
879927
# download and install working version
880-
wget https://repo.msys2.org/mingw/ucrt64/${tarball}
928+
wget "https://repo.msys2.org/mingw/${MSYSTEM}/${tarball}"
881929
882930
tarballs="${tarballs} ${tarball}"
883931
done
884932
885-
# install broken dependencies
933+
# Create the ignore string for pacman
934+
ignore_list=$(IFS=,; echo "${ignore_packages[*]}")
935+
936+
# install pinned dependencies
886937
if [ -n "$tarballs" ]; then
887938
pacman -U --noconfirm ${tarballs}
888939
fi
889940
890-
# install dependencies
891-
dependencies=(
892-
"git"
893-
"mingw-w64-ucrt-x86_64-cmake"
894-
"mingw-w64-ucrt-x86_64-cppwinrt"
895-
"mingw-w64-ucrt-x86_64-curl-winssl"
896-
"mingw-w64-ucrt-x86_64-graphviz"
897-
"mingw-w64-ucrt-x86_64-MinHook"
898-
"mingw-w64-ucrt-x86_64-miniupnpc"
899-
"mingw-w64-ucrt-x86_64-nlohmann-json"
900-
"mingw-w64-ucrt-x86_64-nodejs"
901-
"mingw-w64-ucrt-x86_64-nsis"
902-
"mingw-w64-ucrt-x86_64-onevpl"
903-
"mingw-w64-ucrt-x86_64-openssl"
904-
"mingw-w64-ucrt-x86_64-opus"
905-
"mingw-w64-ucrt-x86_64-toolchain"
906-
)
907-
908-
pacman -Syu --noconfirm --ignore="$(IFS=,; echo "${broken_deps[*]}")" "${dependencies[@]}"
941+
# Only add --ignore if we have packages to ignore
942+
if [ -n "$ignore_list" ]; then
943+
pacman -Syu --noconfirm --ignore="${ignore_list}" "${dependencies[@]}"
944+
else
945+
pacman -Syu --noconfirm "${dependencies[@]}"
946+
fi
909947
910948
- name: Install Doxygen
911949
# GCC compiled doxygen has issues when running graphviz
912950
env:
913951
DOXYGEN_VERSION: "1.11.0"
952+
shell: pwsh
914953
run: |
915954
# Set version variables
916955
$doxy_ver = $env:DOXYGEN_VERSION
@@ -940,7 +979,6 @@ jobs:
940979

941980
- name: Python Path
942981
id: python-path
943-
shell: msys2 {0}
944982
run: |
945983
# replace backslashes with double backslashes
946984
python_path=$(echo "${{ steps.setup-python.outputs.python-path }}" | sed 's/\\/\\\\/g')
@@ -950,7 +988,6 @@ jobs:
950988
echo "python-path=${python_path}" >> $GITHUB_OUTPUT
951989
952990
- name: Build Windows
953-
shell: msys2 {0}
954991
env:
955992
BRANCH: ${{ github.head_ref || github.ref_name }}
956993
BUILD_VERSION: ${{ needs.setup_release.outputs.release_tag }}
@@ -962,40 +999,48 @@ jobs:
962999
-B build \
9631000
-G Ninja \
9641001
-S . \
965-
-DBUILD_WERROR=ON \
9661002
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
9671003
-DSUNSHINE_ASSETS_DIR=assets \
9681004
-DSUNSHINE_PUBLISHER_NAME='${{ github.repository_owner }}' \
9691005
-DSUNSHINE_PUBLISHER_WEBSITE='https://app.lizardbyte.dev' \
9701006
-DSUNSHINE_PUBLISHER_ISSUE_URL='https://app.lizardbyte.dev/support'
9711007
ninja -C build
9721008
973-
- name: Package Windows
974-
shell: msys2 {0}
1009+
- name: Package Windows (Prepare)
9751010
run: |
9761011
mkdir -p artifacts
1012+
1013+
- name: Package Windows (Installer)
1014+
if: runner.arch == 'X86' || runner.arch == 'X64'
1015+
run: |
9771016
cd build
9781017
9791018
# package
9801019
cpack -G NSIS
1020+
1021+
# move
1022+
mv ./cpack_artifacts/Sunshine.exe ../artifacts/Sunshine-${{ matrix.os }}-installer.exe
1023+
1024+
- name: Package Windows (Portable)
1025+
run: |
1026+
cd build
1027+
1028+
# package
9811029
cpack -G ZIP
9821030
9831031
# move
984-
mv ./cpack_artifacts/Sunshine.exe ../artifacts/sunshine-windows-installer.exe
985-
mv ./cpack_artifacts/Sunshine.zip ../artifacts/sunshine-windows-portable.zip
1032+
mv ./cpack_artifacts/Sunshine.zip ../artifacts/Sunshine-${{ matrix.os }}-portable.zip
9861033
9871034
- name: Run tests
9881035
id: test
989-
shell: msys2 {0}
9901036
working-directory: build/tests
9911037
run: |
9921038
./test_sunshine.exe --gtest_color=yes --gtest_output=xml:test_results.xml
9931039
9941040
- name: Generate gcov report
9951041
id: test_report
9961042
# any except canceled or skipped
997-
if: always() && (steps.test.outcome == 'success' || steps.test.outcome == 'failure')
998-
shell: msys2 {0}
1043+
if: always() && (steps.test.outcome == 'success' || steps.test.outcome == 'failure') && runner.arch == 'X86' || runner.arch == 'X64'
9991044
working-directory: build
10001045
run: |
10011046
${{ steps.python-path.outputs.python-path }} -m pip install gcovr
@@ -1018,7 +1063,7 @@ jobs:
10181063
disable_search: true
10191064
fail_ci_if_error: true
10201065
files: ./build/tests/test_results.xml
1021-
flags: ${{ runner.os }}
1066+
flags: ${{ matrix.name }}
10221067
handle_no_reports_found: true
10231068
token: ${{ secrets.CODECOV_TOKEN }}
10241069
verbose: true
@@ -1034,11 +1079,12 @@ jobs:
10341079
disable_search: true
10351080
fail_ci_if_error: true
10361081
files: ./build/coverage.xml
1037-
flags: ${{ runner.os }}
1082+
flags: ${{ matrix.name }}
10381083
token: ${{ secrets.CODECOV_TOKEN }}
10391084
verbose: true
10401085

10411086
- name: Package Windows Debug Info
1087+
shell: pwsh
10421088
working-directory: build
10431089
run: |
10441090
# use .dbg file extension for binaries to avoid confusion with real packages
@@ -1049,12 +1095,12 @@ jobs:
10491095
7z -r `
10501096
"-xr!CMakeFiles" `
10511097
"-xr!cpack_artifacts" `
1052-
a "../artifacts/sunshine-win32-debuginfo.7z" "*.dbg"
1098+
a "../artifacts/${{ matrix.name }}-debuginfo.7z" "*.dbg"
10531099
10541100
- name: Upload Artifacts
10551101
uses: actions/upload-artifact@v4
10561102
with:
1057-
name: sunshine-windows
1103+
name: Sunshine-${{ matrix.name }}
10581104
path: artifacts/
10591105
if-no-files-found: error
10601106

@@ -1068,4 +1114,4 @@ jobs:
10681114
name: ${{ needs.setup_release.outputs.release_tag }}
10691115
prerelease: true
10701116
tag: ${{ needs.setup_release.outputs.release_tag }}
1071-
token: ${{ secrets.GH_BOT_TOKEN }}
1117+
token: ${{ secrets.GH_BOT_TOKEN }}

0 commit comments

Comments
 (0)