Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(macos): add build strategy matrix #2211

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 49 additions & 20 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -506,11 +506,23 @@ jobs:
prerelease: ${{ needs.setup_release.outputs.pre_release }}

build_mac:
name: MacOS
runs-on: macos-11
needs: [check_changelog, setup_release]
env:
BOOST_VERSION: 1.83.0
strategy:
fail-fast: false # false to test all, true to fail entire job if any fail
matrix:
include:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
# while GitHub has larger macOS runners, they are not available for our repos :(
- os_version: "12"
arch: "x86_64"
- os_version: "13"
arch: "x86_64"
- os_version: "14"
arch: "arm64"
name: macOS-${{ matrix.os_version }} ${{ matrix.arch }}
runs-on: macos-${{ matrix.os_version }}

steps:
- name: Checkout
Expand All @@ -520,24 +532,32 @@ jobs:

- name: Setup Dependencies MacOS
run: |
if [[ ${{ matrix.arch }} == "arm64" ]]; then
brew_prefix="/opt/homebrew"
else
brew_prefix="/usr/local"
fi

# install dependencies using homebrew
brew install cmake curl miniupnpc node openssl opus pkg-config

# fix openssl header not found
# ln -sf /usr/local/opt/openssl/include/openssl /usr/local/include/openssl

# by installing boost from source, several headers cannot be found...
# the above commented out link only works if boost is installed from homebrew... does not make sense
ln -sf $(find /usr/local/Cellar -type d -name "openssl" -path "*/openssl@3/*/include" | head -n 1) \
/usr/local/include/openssl
openssl_path=$(find ${brew_prefix}/Cellar -type d -name "openssl" -path "*/openssl@3/*/include" | head -n 1)
echo "OpenSSL path: $openssl_path"
ln -sf $openssl_path ${brew_prefix}/include/openssl
ls -l ${brew_prefix}/include/openssl

# fix opus header not found
ln -sf $(find /usr/local/Cellar -type d -name "opus" -path "*/opus/*/include" | head -n 1) \
/usr/local/include/opus
opus_path=$(find ${brew_prefix}/Cellar -type d -name "opus" -path "*/opus/*/include" | head -n 1)
echo "Opus path: $opus_path"
ln -sf $opus_path ${brew_prefix}/include/opus
ls -l ${brew_prefix}/include/opus

# fix miniupnpc header not found
ln -sf $(find /usr/local/Cellar -type d -name "miniupnpc" -path "*/miniupnpc/*/include" | head -n 1) \
/usr/local/include/miniupnpc
upnp_path=$(find ${brew_prefix}/Cellar -type d -name "miniupnpc" -path "*/miniupnpc/*/include" | head -n 1)
echo "Miniupnpc path: $upnp_path"
ln -sf $upnp_path ${brew_prefix}/include/miniupnpc
ls -l ${brew_prefix}/include/miniupnpc

- name: Install Boost
# installing boost from homebrew takes 30 minutes in a GitHub runner
Expand Down Expand Up @@ -594,15 +614,13 @@ jobs:

# package
cpack -G DragNDrop
mv ./cpack_artifacts/Sunshine.dmg ../artifacts/sunshine.dmg

# cpack -G Bundle
# mv ./cpack_artifacts/Sunshine.dmg ../artifacts/sunshine-bundle.dmg
mv ./cpack_artifacts/Sunshine.dmg \
../artifacts/sunshine-macos-${{ matrix.os_version }}-${{ matrix.arch }}.dmg

- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: sunshine-macos
name: sunshine-macos-${{ matrix.os_version }}-${{ matrix.arch }}
path: artifacts/

- name: Create/Update GitHub Release
Expand All @@ -620,9 +638,19 @@ jobs:
prerelease: ${{ needs.setup_release.outputs.pre_release }}

build_mac_port:
name: Macports
needs: [check_changelog, setup_release]
runs-on: macos-11
strategy:
fail-fast: false # false to test all, true to fail entire job if any fail
matrix:
include:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
# while GitHub has larger macOS runners, they are not available for our repos :(
- os_version: "12"
release: true
- os_version: "13"
- os_version: "14"
name: Macports (macOS-${{ matrix.os_version }})
runs-on: macos-${{ matrix.os_version }}

steps:
- name: Checkout
Expand Down Expand Up @@ -725,13 +753,14 @@ jobs:
echo "::endgroup::"

- name: Upload Artifacts
if: ${{ matrix.release == 'true' }}
uses: actions/upload-artifact@v4
with:
name: sunshine-macports
path: artifacts/

- name: Create/Update GitHub Release
if: ${{ needs.setup_release.outputs.create_release == 'true' }}
if: ${{ needs.setup_release.outputs.create_release == 'true' && matrix.release == 'true' }}
uses: ncipollo/release-action@v1
with:
name: ${{ needs.setup_release.outputs.release_name }}
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ System Requirements
+------------+------------------------------------------------------------+
| OS | Windows: 10+ (Windows Server not supported) |
| +------------------------------------------------------------+
| | macOS: 11.7+ |
| | macOS: 12+ |
| +------------------------------------------------------------+
| | Linux/Debian: 11 (bullseye) |
| +------------------------------------------------------------+
| | Linux/Fedora: 37+ |
| | Linux/Fedora: 38+ |
| +------------------------------------------------------------+
| | Linux/Ubuntu: 20.04+ (focal) |
+------------+------------------------------------------------------------+
Expand Down
4 changes: 2 additions & 2 deletions docs/source/about/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,14 @@ Install

.. tab:: macOS

.. important:: Sunshine on macOS is experimental. Gamepads do not work. Other features may not work as expected.
.. important:: Sunshine on macOS is experimental. Gamepads do not work.

.. tab:: dmg

.. warning:: The `dmg` does not include runtime dependencies. This package is not recommended for most users.
No support will be provided!

#. Download the ``sunshine.dmg`` file and install it.
#. Download the ``sunshine-<macos_version>-<cpu_architecture>.dmg`` file and install it.

Uninstall:
.. code-block:: bash
Expand Down
20 changes: 17 additions & 3 deletions docs/source/building/macos.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,23 @@ Install Requirements
.. code-block:: bash

brew install boost cmake miniupnpc node opus pkg-config
# if there are issues with an SSL header that is not found:
cd /usr/local/include
ln -s ../opt/openssl/include/openssl .

If there are issues with an SSL header that is not found:
.. tab:: Intel

.. code-block:: bash

pushd /usr/local/include
ln -s ../opt/openssl/include/openssl .
popd

.. tab:: Apple Silicon

.. code-block:: bash

pushd /opt/homebrew/include
ln -s ../opt/openssl/include/openssl .
popd

Build
-----
Expand Down
3 changes: 3 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,11 @@ main(int argc, char *argv[]) {
setlocale(LC_ALL, ".UTF-8");
#endif

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// Use UTF-8 conversion for the default C++ locale (used by boost::log)
std::locale::global(std::locale(std::locale(), new std::codecvt_utf8<wchar_t>));
#pragma GCC diagnostic pop

mail::man = std::make_shared<safe::mail_raw_t>();

Expand Down
Loading