@@ -505,124 +505,111 @@ jobs:
505505 discussionCategory : announcements
506506 prerelease : ${{ needs.setup_release.outputs.pre_release }}
507507
508- build_mac :
509- name : MacOS
510- runs-on : macos-11
508+ build_mac_brew :
511509 needs : [check_changelog, setup_release]
512- env :
513- BOOST_VERSION : 1.83.0
510+ strategy :
511+ fail-fast : false # false to test all, true to fail entire job if any fail
512+ matrix :
513+ include :
514+ # 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
515+ # while GitHub has larger macOS runners, they are not available for our repos :(
516+ - os_version : " 12"
517+ release : true
518+ - os_version : " 13"
519+ - os_version : " 14"
520+ name : Homebrew (macOS-${{ matrix.os_version }})
521+ runs-on : macos-${{ matrix.os_version }}
514522
515523 steps :
516524 - name : Checkout
517525 uses : actions/checkout@v4
518- with :
519- submodules : recursive
520526
521- - name : Setup Dependencies MacOS
527+ - name : Setup Dependencies Homebrew
522528 run : |
523529 # install dependencies using homebrew
524- brew install cmake curl miniupnpc node openssl opus pkg-config
525-
526- # fix openssl header not found
527- # ln -sf /usr/local/opt/openssl/include/openssl /usr/local/include/openssl
528-
529- # by installing boost from source, several headers cannot be found...
530- # the above commented out link only works if boost is installed from homebrew... does not make sense
531- ln -sf $(find /usr/local/Cellar -type d -name "openssl" -path "*/openssl@3/*/include" | head -n 1) \
532- /usr/local/include/openssl
530+ brew install cmake
533531
534- # fix opus header not found
535- ln -sf $(find /usr/local/Cellar -type d -name "opus" -path "*/opus/*/include" | head -n 1) \
536- /usr/local/include/opus
532+ - name : Configure formula
533+ run : |
534+ # variables for formula
535+ branch=${GITHUB_HEAD_REF}
537536
538- # fix miniupnpc header not found
539- ln -sf $(find /usr/local/Cellar -type d -name "miniupnpc" -path "*/miniupnpc/*/include" | head -n 1) \
540- /usr/local/include/miniupnpc
537+ # check the branch variable
538+ if [ -z "$branch" ]
539+ then
540+ echo "This is a PUSH event"
541+ clone_url=${{ github.event.repository.clone_url }}
542+ branch="${{ github.ref_name }}"
543+ else
544+ echo "This is a PR event"
545+ clone_url=${{ github.event.pull_request.head.repo.clone_url }}
546+ branch="${{ github.event.pull_request.head.ref }}"
547+ fi
548+ echo "Branch: ${branch}"
549+ echo "Clone URL: ${clone_url}"
541550
542- - name : Install Boost
543- # installing boost from homebrew takes 30 minutes in a GitHub runner
544- run : |
545- export BOOST_ROOT=${HOME}/boost-${BOOST_VERSION}
546-
547- # install boost
548- wget \
549- https://github.com/boostorg/boost/releases/download/boost-${BOOST_VERSION}/boost-${BOOST_VERSION}.tar.gz \
550- --progress=bar:force:noscroll -q --show-progress
551- tar xf boost-${BOOST_VERSION}.tar.gz
552- cd boost-${BOOST_VERSION}
553-
554- # libdir should be set by --prefix but isn't
555- ./bootstrap.sh \
556- --prefix=${BOOST_ROOT} \
557- --libdir=${BOOST_ROOT}/lib \
558- --with-libraries=locale,log,program_options,system,thread
559- ./b2 headers
560- ./b2 install \
561- --prefix=${BOOST_ROOT} \
562- --libdir=${BOOST_ROOT}/lib \
563- -j$(sysctl -n hw.ncpu) \
564- link=shared,static \
565- variant=release \
566- cxxflags=-std=c++14 \
567- cxxflags=-stdlib=libc++ \
568- linkflags=-stdlib=libc++
569-
570- # put boost in cmake prefix path
571- echo "BOOST_ROOT=${BOOST_ROOT}" >> ${GITHUB_ENV}
572-
573- - name : Build MacOS
574- env :
575- BRANCH : ${{ github.head_ref || github.ref_name }}
576- BUILD_VERSION : ${{ needs.check_changelog.outputs.next_version_bare }}
577- COMMIT : ${{ github.event.pull_request.head.sha || github.sha }}
578- run : |
579551 mkdir build
580552 cd build
581553 cmake \
582- -DBUILD_WERROR=ON \
583- -DCMAKE_BUILD_TYPE=Release \
584- -DCMAKE_INSTALL_PREFIX=/usr \
585- -DSUNSHINE_ASSETS_DIR=local/sunshine/assets \
586- -DSUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine \
554+ -DGITHUB_BRANCH="${branch}" \
555+ -DGITHUB_CLONE_URL="${clone_url}" \
556+ -DSUNSHINE_CONFIGURE_HOMEBREW=ON \
557+ -DSUNSHINE_CONFIGURE_ONLY=ON \
587558 ..
588- make -j $(sysctl -n hw.ncpu)
589-
590- - name : Package MacOS
591- run : |
592- mkdir -p artifacts
593- cd build
559+ cd ..
594560
595- # package
596- cpack -G DragNDrop
597- mv ./cpack_artifacts/Sunshine.dmg ../artifacts /sunshine.dmg
561+ # copy formula to artifacts
562+ mkdir -p homebrew
563+ cp -f ./build/sunshine.rb ./homebrew /sunshine.rb
598564
599- # cpack -G Bundle
600- # mv ./cpack_artifacts/Sunshine.dmg ../artifacts/ sunshine-bundle.dmg
565+ # testing
566+ cat ./homebrew/ sunshine.rb
601567
602568 - name : Upload Artifacts
569+ if : ${{ matrix.release }}
603570 uses : actions/upload-artifact@v4
604571 with :
605- name : sunshine-macos
606- path : artifacts /
572+ name : sunshine-homebrew
573+ path : homebrew /
607574
608- - name : Create/Update GitHub Release
609- if : ${{ needs.setup_release.outputs.create_release == 'true' }}
610- uses : ncipollo/release-action@v1
575+ - name : Should Publish Homebrew Formula
576+ id : homebrew_publish
577+ run : |
578+ PUBLISH=false
579+ if [[ \
580+ "${{ matrix.release }}" == "true" && \
581+ "${{ github.repository_owner }}" == "LizardByte" && \
582+ "${{ needs.setup_release.outputs.create_release }}" == "true" && \
583+ "${{ github.ref }}" == "refs/heads/master" \
584+ ]]; then
585+ PUBLISH=true
586+ fi
587+
588+ echo "publish=${PUBLISH}" >> $GITHUB_OUTPUT
589+
590+ - name : Validate and Publish Homebrew Formula
591+ uses :
LizardByte/[email protected] 611592 with :
612- name : ${{ needs.setup_release.outputs.release_name }}
613- tag : ${{ needs.setup_release.outputs.release_tag }}
614- commit : ${{ needs.setup_release.outputs.release_commit }}
615- artifacts : " *artifacts/* "
593+ formula_file : ${{ github.workspace }}/homebrew/sunshine.rb
594+ git_email : ${{ secrets.GH_BOT_EMAIL }}
595+ git_username : ${{ secrets.GH_BOT_NAME }}
596+ publish : ${{ steps.homebrew_publish.outputs.publish }}
616597 token : ${{ secrets.GH_BOT_TOKEN }}
617- allowUpdates : true
618- body : ${{ needs.setup_release.outputs.release_body }}
619- discussionCategory : announcements
620- prerelease : ${{ needs.setup_release.outputs.pre_release }}
621598
622599 build_mac_port :
623- name : Macports
624600 needs : [check_changelog, setup_release]
625- runs-on : macos-11
601+ strategy :
602+ fail-fast : false # false to test all, true to fail entire job if any fail
603+ matrix :
604+ include :
605+ # 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
606+ # while GitHub has larger macOS runners, they are not available for our repos :(
607+ - os_version : " 12"
608+ release : true
609+ - os_version : " 13"
610+ - os_version : " 14"
611+ name : Macports (macOS-${{ matrix.os_version }})
612+ runs-on : macos-${{ matrix.os_version }}
626613
627614 steps :
628615 - name : Checkout
@@ -725,13 +712,14 @@ jobs:
725712 echo "::endgroup::"
726713
727714 - name : Upload Artifacts
715+ if : ${{ matrix.release }}
728716 uses : actions/upload-artifact@v4
729717 with :
730718 name : sunshine-macports
731719 path : artifacts/
732720
733721 - name : Create/Update GitHub Release
734- if : ${{ needs.setup_release.outputs.create_release == 'true' }}
722+ if : ${{ needs.setup_release.outputs.create_release == 'true' && matrix.release }}
735723 uses : ncipollo/release-action@v1
736724 with :
737725 name : ${{ needs.setup_release.outputs.release_name }}
@@ -814,11 +802,15 @@ jobs:
814802 - name : Package Windows Debug Info
815803 working-directory : build
816804 run : |
817- # save the original binaries with debug info
805+ # use .dbg file extension for binaries to avoid confusion with real packages
806+ Get-ChildItem -File -Recurse | `
807+ % { Rename-Item -Path $_.PSPath -NewName $_.Name.Replace(".exe",".dbg") }
808+
809+ # save the binaries with debug info
818810 7z -r `
819811 "-xr!CMakeFiles" `
820812 "-xr!cpack_artifacts" `
821- a "../artifacts/sunshine-debuginfo- win32.zip " "*.exe "
813+ a "../artifacts/sunshine-win32-debuginfo.7z " "*.dbg "
822814
823815 - name : Upload Artifacts
824816 uses : actions/upload-artifact@v4
0 commit comments