Skip to content

Commit 3ded04c

Browse files
build(packaging/macos)!: remove macports support
1 parent b662b8e commit 3ded04c

File tree

3 files changed

+61
-369
lines changed

3 files changed

+61
-369
lines changed

.github/workflows/CI.yml

Lines changed: 61 additions & 256 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ jobs:
547547
- name: Checkout
548548
uses: actions/checkout@v4
549549

550-
- name: Fix python
550+
- name: Fix homebrew python
551551
if: matrix.os_name == 'macos' && matrix.os_version == '13'
552552
run: |
553553
rm '/usr/local/bin/2to3'
@@ -562,7 +562,14 @@ jobs:
562562
rm '/usr/local/bin/python3.12-config'
563563
brew install python
564564
565+
- name: Setup python
566+
id: python
567+
uses: actions/setup-python@v5
568+
with:
569+
python-version: '3.11'
570+
565571
- name: Configure formula
572+
id: configure-formula
566573
run: |
567574
# variables for formula
568575
branch="${{ github.head_ref }}"
@@ -598,6 +605,8 @@ jobs:
598605
echo "Clone URL: ${clone_url}"
599606
echo "Tag: ${tag}"
600607
608+
echo "build-version=${build_version}" >> $GITHUB_OUTPUT
609+
601610
mkdir -p build
602611
cmake \
603612
-B build \
@@ -641,6 +650,7 @@ jobs:
641650
echo "DISPLAY=${DISPLAY}" >> $GITHUB_ENV
642651
643652
- name: Validate Homebrew Formula
653+
id: test
644654
if: |
645655
matrix.release != true
646656
uses: LizardByte/[email protected]
@@ -652,6 +662,56 @@ jobs:
652662
token: ${{ secrets.GH_BOT_TOKEN }}
653663
validate: true
654664

665+
- name: Generate gcov report
666+
# any except canceled or skipped
667+
# TODO: fix coverage, no .gcno files are being created
668+
# TODO: .gcno files are supposed to be created next to .o files
669+
if: false
670+
# if: >-
671+
# always() &&
672+
# matrix.release != true &&
673+
# (steps.test.outcome == 'success' || steps.test.outcome == 'failure')
674+
id: test_report
675+
run: |
676+
# if linux
677+
if [ "${{ runner.os }}" == "Linux" ]; then
678+
prefix="/tmp"
679+
else
680+
prefix="/private/tmp"
681+
fi
682+
683+
brew_dir=$(find ${prefix} -type d -name "sunshine-*" -maxdepth 1 2>/dev/null)
684+
cp -rf $brew_dir/build/ ./build/
685+
cd build
686+
ls -Ra
687+
688+
${{ steps.python.outputs.python-path }} -m pip install gcovr
689+
${{ steps.python.outputs.python-path }} -m gcovr . -r ../src \
690+
--exclude-noncode-lines \
691+
--exclude-throw-branches \
692+
--exclude-unreachable-branches \
693+
--verbose \
694+
--xml-pretty \
695+
-o coverage.xml
696+
697+
- name: Upload coverage
698+
# any except canceled or skipped
699+
# TODO: enable this once coverage report is fixed
700+
if: false
701+
# if: >-
702+
# always() &&
703+
# matrix.release != true &&
704+
# (steps.test_report.outcome == 'success') &&
705+
# startsWith(github.repository, 'LizardByte/')
706+
uses: codecov/codecov-action@v5
707+
with:
708+
disable_search: true
709+
fail_ci_if_error: true
710+
files: ./build/coverage.xml
711+
flags: ${{ matrix.os_name }}-${{ matrix.os_version }} (Homebrew)
712+
token: ${{ secrets.CODECOV_TOKEN }}
713+
verbose: true
714+
655715
- name: Create/Update GitHub Release
656716
if: >-
657717
matrix.release &&
@@ -701,261 +761,6 @@ jobs:
701761
token: ${{ secrets.GH_BOT_TOKEN }}
702762
validate: false
703763

704-
build_mac_port:
705-
needs: [setup_release]
706-
strategy:
707-
fail-fast: false # false to test all, true to fail entire job if any fail
708-
matrix:
709-
include:
710-
# 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
711-
# while GitHub has larger macOS runners, they are not available for our repos :(
712-
- os_version: "13"
713-
release: true
714-
- os_version: "14"
715-
name: Macports (macOS-${{ matrix.os_version }})
716-
runs-on: macos-${{ matrix.os_version }}
717-
718-
steps:
719-
- name: Checkout
720-
uses: actions/checkout@v4
721-
722-
- name: Checkout ports
723-
uses: actions/checkout@v4
724-
with:
725-
repository: macports/macports-ports
726-
fetch-depth: 64
727-
path: ports
728-
729-
- name: Checkout mpbb
730-
uses: actions/checkout@v4
731-
with:
732-
repository: macports/mpbb
733-
path: mpbb
734-
735-
- name: Setup Dependencies Macports
736-
run: |
737-
# install dependencies using homebrew
738-
brew install cmake
739-
740-
- name: Setup python
741-
id: python
742-
uses: actions/setup-python@v5
743-
with:
744-
python-version: '3.11'
745-
746-
- name: Configure Portfile
747-
run: |
748-
# variables for Portfile
749-
branch="${{ github.head_ref }}"
750-
commit=${{ needs.setup_release.outputs.release_commit }}
751-
752-
# check the branch variable
753-
if [ -z "$branch" ]
754-
then
755-
echo "This is a PUSH event"
756-
branch="${{ github.ref_name }}"
757-
build_version=${{ needs.setup_release.outputs.release_tag }}
758-
clone_url=${{ github.event.repository.clone_url }}
759-
else
760-
echo "This is a PR event"
761-
clone_url=${{ github.event.pull_request.head.repo.clone_url }}
762-
fi
763-
echo "Commit: ${commit}"
764-
echo "Clone URL: ${clone_url}"
765-
766-
mkdir -p build
767-
cmake \
768-
-B build \
769-
-S . \
770-
-DBUILD_VERSION=${build_version} \
771-
-DGITHUB_BRANCH=${branch} \
772-
-DGITHUB_COMMIT=${commit} \
773-
-DGITHUB_CLONE_URL=${clone_url} \
774-
-DSUNSHINE_CONFIGURE_PORTFILE=ON \
775-
-DSUNSHINE_CONFIGURE_ONLY=ON
776-
777-
# copy Portfile to artifacts
778-
mkdir -p artifacts
779-
cp -f ./build/Portfile ./artifacts/
780-
781-
# copy Portfile to ports
782-
mkdir -p ./ports/multimedia/Sunshine
783-
cp -f ./build/Portfile ./ports/multimedia/Sunshine/Portfile
784-
785-
# testing
786-
cat ./artifacts/Portfile
787-
788-
- name: Bootstrap MacPorts
789-
run: |
790-
. ports/.github/workflows/bootstrap.sh
791-
792-
# Add getopt, mpbb and the MacPorts paths to $PATH for the subsequent steps.
793-
echo "/opt/mports/bin" >> $GITHUB_PATH
794-
echo "${PWD}/mpbb" >> $GITHUB_PATH
795-
echo "/opt/local/bin" >> $GITHUB_PATH
796-
echo "/opt/local/sbin" >> $GITHUB_PATH
797-
798-
- name: Run port lint
799-
run: |
800-
port -q lint "Sunshine"
801-
802-
- name: Build port
803-
env:
804-
subportlist: ${{ steps.subportlist.outputs.subportlist }}
805-
id: build
806-
run: |
807-
subport="Sunshine"
808-
809-
workdir="/tmp/mpbb/$subport"
810-
mkdir -p "$workdir/logs"
811-
812-
echo "::group::Installing dependencies"
813-
sudo mpbb \
814-
--work-dir "$workdir" \
815-
install-dependencies \
816-
"$subport"
817-
echo "::endgroup::"
818-
819-
echo "::group::Installing ${subport}"
820-
sudo mpbb \
821-
--work-dir "$workdir" \
822-
install-port \
823-
--source \
824-
"$subport"
825-
echo "::endgroup::"
826-
827-
- name: Build Logs
828-
if: always()
829-
run: |
830-
logfile="/opt/local/var/macports/logs/_Users_runner_work_Sunshine_Sunshine_ports_multimedia_Sunshine/Sunshine/main.log"
831-
cat "$logfile"
832-
sudo mv "${logfile}" "${logfile}.bak"
833-
834-
- name: Upload Artifacts
835-
if: ${{ matrix.release }}
836-
uses: actions/upload-artifact@v4
837-
with:
838-
name: sunshine-macports
839-
path: artifacts/
840-
841-
- name: Fix permissions
842-
run: |
843-
# https://apple.stackexchange.com/questions/362865/macos-list-apps-authorized-for-full-disk-access
844-
# https://github.com/actions/runner-images/issues/9529
845-
# https://github.com/actions/runner-images/pull/9530
846-
847-
# function to execute sql query for each value
848-
function execute_sql_query {
849-
local value=$1
850-
local dbPath=$2
851-
852-
echo "Executing SQL query for value: $value"
853-
sudo sqlite3 "$dbPath" "INSERT OR IGNORE INTO access VALUES($value);"
854-
}
855-
856-
# Find all provisioner paths and store them in an array
857-
readarray -t provisioner_paths < <(sudo find /opt /usr -name provisioner)
858-
echo "Provisioner paths: ${provisioner_paths[@]}"
859-
860-
# Create an empty array
861-
declare -a values=()
862-
863-
# Loop through the provisioner paths and add them to the values array
864-
for p_path in "${provisioner_paths[@]}"; do
865-
# Adjust the service name and other parameters as needed
866-
values+=("'kTCCServiceAccessibility','${p_path}',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,NULL,1592919552")
867-
values+=("'kTCCServiceScreenCapture','${p_path}',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159")
868-
done
869-
870-
echo "Values: ${values[@]}"
871-
872-
if [[ "${{ matrix.os_version }}" == "14" ]]; then
873-
# TCC access table in Sonoma has extra 4 columns: pid, pid_version, boot_uuid, last_reminded
874-
for i in "${!values[@]}"; do
875-
values[$i]="${values[$i]},NULL,NULL,'UNUSED',${values[$i]##*,}"
876-
done
877-
fi
878-
879-
# system and user databases
880-
dbPaths=(
881-
"/Library/Application Support/com.apple.TCC/TCC.db"
882-
"$HOME/Library/Application Support/com.apple.TCC/TCC.db"
883-
)
884-
885-
for value in "${values[@]}"; do
886-
for dbPath in "${dbPaths[@]}"; do
887-
echo "Column names for $dbPath"
888-
echo "-------------------"
889-
sudo sqlite3 "$dbPath" "PRAGMA table_info(access);"
890-
echo "Current permissions for $dbPath"
891-
echo "-------------------"
892-
sudo sqlite3 "$dbPath" "SELECT * FROM access WHERE service='kTCCServiceScreenCapture';"
893-
execute_sql_query "$value" "$dbPath"
894-
echo "Updated permissions for $dbPath"
895-
echo "-------------------"
896-
sudo sqlite3 "$dbPath" "SELECT * FROM access WHERE service='kTCCServiceScreenCapture';"
897-
done
898-
done
899-
900-
- name: Run tests
901-
id: test
902-
timeout-minutes: 10
903-
working-directory:
904-
/opt/local/var/macports/build/_Users_runner_work_Sunshine_Sunshine_ports_multimedia_Sunshine/Sunshine/work/build/tests
905-
run: |
906-
sudo ./test_sunshine --gtest_color=yes
907-
908-
- name: Generate gcov report
909-
# any except canceled or skipped
910-
if: always() && (steps.test.outcome == 'success' || steps.test.outcome == 'failure')
911-
id: test_report
912-
working-directory:
913-
/opt/local/var/macports/build/_Users_runner_work_Sunshine_Sunshine_ports_multimedia_Sunshine/Sunshine/work
914-
run: |
915-
base_dir=$(pwd)
916-
build_dir=${base_dir}/build
917-
918-
# get the directory name that starts with Sunshine-*
919-
dir=$(ls -d Sunshine-*)
920-
921-
cd ${build_dir}
922-
${{ steps.python.outputs.python-path }} -m pip install gcovr
923-
sudo ${{ steps.python.outputs.python-path }} -m gcovr . -r ../${dir}/src \
924-
--exclude-noncode-lines \
925-
--exclude-throw-branches \
926-
--exclude-unreachable-branches \
927-
--gcov-object-directory $(pwd) \
928-
--verbose \
929-
--xml-pretty \
930-
-o ${{ github.workspace }}/build/coverage.xml
931-
932-
- name: Upload coverage
933-
# any except canceled or skipped
934-
if: >-
935-
always() &&
936-
(steps.test_report.outcome == 'success') &&
937-
startsWith(github.repository, 'LizardByte/')
938-
uses: codecov/codecov-action@v5
939-
with:
940-
disable_search: true
941-
fail_ci_if_error: false # todo: re-enable this when action is fixed
942-
files: ./build/coverage.xml
943-
flags: ${{ runner.os }}-${{ matrix.os_version }}
944-
token: ${{ secrets.CODECOV_TOKEN }}
945-
verbose: true
946-
947-
- name: Create/Update GitHub Release
948-
if: ${{ needs.setup_release.outputs.publish_release == 'true' }}
949-
uses: LizardByte/[email protected]
950-
with:
951-
allowUpdates: true
952-
body: ${{ needs.setup_release.outputs.release_body }}
953-
generateReleaseNotes: ${{ needs.setup_release.outputs.release_generate_release_notes }}
954-
name: ${{ needs.setup_release.outputs.release_tag }}
955-
prerelease: true
956-
tag: ${{ needs.setup_release.outputs.release_tag }}
957-
token: ${{ secrets.GH_BOT_TOKEN }}
958-
959764
build_win:
960765
name: Windows
961766
runs-on: windows-2019

0 commit comments

Comments
 (0)