mirror of
https://github.com/kyleneideck/BackgroundMusic
synced 2024-11-10 06:34:22 +00:00
GH Actions: Try to grant BGMApp mic authorization by modifying TCC.db.
This commit is contained in:
parent
30ec1c24b7
commit
3040a20766
2 changed files with 26 additions and 11 deletions
27
.github/workflows/build-test-release.yml
vendored
27
.github/workflows/build-test-release.yml
vendored
|
@ -75,6 +75,8 @@ jobs:
|
|||
-workspace BGM.xcworkspace \
|
||||
-scheme 'Background Music Device' \
|
||||
test
|
||||
echo '::endgroup::'
|
||||
|
||||
echo '::group::BGMXPCHelper Tests'
|
||||
xcodebuild \
|
||||
-quiet \
|
||||
|
@ -82,14 +84,23 @@ jobs:
|
|||
-scheme 'BGMXPCHelper' \
|
||||
test
|
||||
echo '::endgroup::'
|
||||
echo '::endgroup::'
|
||||
|
||||
# Grant BGMApp authorization to use input devices.
|
||||
# This is necessary for the UI tests because accepting the "Background Music would like to
|
||||
# use the microphone" dialog programmatically isn't reliable.
|
||||
dbPath="$HOME/Library/Application Support/com.apple.TCC/TCC.db"
|
||||
values="'kTCCServiceMicrophone','com.bearisdriving.BGM.App',0,2,2,1,NULL,NULL,NULL,'UNUSED',NULL,0,1652845317"
|
||||
sqlQuery="INSERT OR IGNORE INTO access VALUES($values);"
|
||||
sudo sqlite3 "$dbPath" "$sqlQuery"
|
||||
|
||||
echo '::group::BGMApp Tests'
|
||||
log stream --info \
|
||||
--predicate 'process == "coreaudiod" or
|
||||
process == "Background Music" or
|
||||
process == "BGMXPCHelper" or
|
||||
composedMessage contains[cd] "Background Music" or
|
||||
composedMessage contains "BGM"' > app.log &
|
||||
# TODO: Commented out in case it uses too much CPU.
|
||||
# log stream --info \
|
||||
# --predicate 'process == "coreaudiod" or
|
||||
# process == "Background Music" or
|
||||
# process == "BGMXPCHelper" or
|
||||
# composedMessage contains[cd] "Background Music" or
|
||||
# composedMessage contains "BGM"' > app.log &
|
||||
xcodebuild \
|
||||
-quiet \
|
||||
-workspace BGM.xcworkspace \
|
||||
|
@ -104,6 +115,8 @@ jobs:
|
|||
path: |
|
||||
/Users/runner/Library/Developer/Xcode/DerivedData/*/Logs/Test/*.xcresult
|
||||
app.log
|
||||
/Users/runner/Library/Logs/CrashReporter/*
|
||||
/Users/runner/Library/Logs/DiagnosticReports/*
|
||||
- name: Uninstall Background Music.
|
||||
run: |
|
||||
# `tput` expects this to be set.
|
||||
|
|
|
@ -76,14 +76,16 @@
|
|||
|
||||
// Make the "Background Music wants to use the microphone" dialog appear every time so the test
|
||||
// doesn't need logic to handle both cases.
|
||||
if (@available(macOS 10.15.4, *)) {
|
||||
[app resetAuthorizationStatusForResource:XCUIProtectedResourceMicrophone];
|
||||
}
|
||||
// TODO: Commented out to check if CI builds can grant access by modifying TCC.db.
|
||||
// if (@available(macOS 10.15.4, *)) {
|
||||
// [app resetAuthorizationStatusForResource:XCUIProtectedResourceMicrophone];
|
||||
// }
|
||||
|
||||
// Launch BGMApp.
|
||||
[app launch];
|
||||
|
||||
[self acceptMicrophoneAuthorizationDialog];
|
||||
// TODO: Commented out to check if CI builds can grant access by modifying TCC.db.
|
||||
// [self acceptMicrophoneAuthorizationDialog];
|
||||
|
||||
if (![icon waitForExistenceWithTimeout:20.0]) {
|
||||
// The status bar icon/button has this type when using older versions of XCTest, so try
|
||||
|
|
Loading…
Reference in a new issue