GH Actions: More logging to help diagnose UI test failures.

This commit is contained in:
Kyle Neideck 2022-05-15 14:49:08 +10:00
parent 89eebb0e02
commit 909615617a
No known key found for this signature in database
GPG key ID: CAA8D9B8E39EC18C
2 changed files with 97 additions and 91 deletions

View file

@ -4,13 +4,12 @@ name: Build, Test and Release
on: on:
push: push:
branches: branches:
- $default-branch - '*'
- gh-actions
tags: tags:
- '*' - '*'
pull_request: pull_request:
branches: branches:
- $default-branch - '*'
jobs: jobs:
# Build and test in the same job because the UI tests expect BGMDriver to be installed. # Build and test in the same job because the UI tests expect BGMDriver to be installed.
@ -72,31 +71,36 @@ jobs:
run: | run: |
echo '::group::BGMDriver Tests' echo '::group::BGMDriver Tests'
xcodebuild \ xcodebuild \
-quiet \
-workspace BGM.xcworkspace \ -workspace BGM.xcworkspace \
-scheme 'Background Music Device' \ -scheme 'Background Music Device' \
test test
echo '::endgroup::'
echo '::group::BGMApp Tests'
xcodebuild \
-quiet \
-workspace BGM.xcworkspace \
-scheme 'Background Music' \
test
echo '::endgroup::'
echo '::group::BGMXPCHelper Tests' echo '::group::BGMXPCHelper Tests'
xcodebuild \ xcodebuild \
-quiet \
-workspace BGM.xcworkspace \ -workspace BGM.xcworkspace \
-scheme 'BGMXPCHelper' \ -scheme 'BGMXPCHelper' \
test test
echo '::endgroup::' echo '::endgroup::'
echo '::endgroup::'
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 &
xcodebuild \
-workspace BGM.xcworkspace \
-scheme 'Background Music' \
test
echo '::endgroup::'
- name: Upload the test results. - name: Upload the test results.
if: always() if: always()
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: BGMTests.xcresult name: bgm-test-results
path: /Users/runner/Library/Developer/Xcode/DerivedData/*/Logs/Test/*.xcresult path: |
/Users/runner/Library/Developer/Xcode/DerivedData/*/Logs/Test/*.xcresult
app.log
- name: Uninstall Background Music. - name: Uninstall Background Music.
run: | run: |
# `tput` expects this to be set. # `tput` expects this to be set.
@ -111,79 +115,79 @@ jobs:
exit 1 exit 1
fi fi
if ls -la "/Library/LaunchDaemons/com.bearisdriving.BGM.XPCHelper.plist"; then exit 1; fi if ls -la "/Library/LaunchDaemons/com.bearisdriving.BGM.XPCHelper.plist"; then exit 1; fi
release: # release:
runs-on: macos-latest # runs-on: macos-latest
timeout-minutes: 15 # timeout-minutes: 15
steps: # steps:
- name: Checkout # - name: Checkout
uses: actions/checkout@v3 # uses: actions/checkout@v3
- name: Build the .pkg installer. # - name: Build the .pkg installer.
run: | # run: |
# `sudo` and `tput` expect this to be set. # # `sudo` and `tput` expect this to be set.
export TERM=xterm-256color # export TERM=xterm-256color
# If this build is for a tag with "DEBUG" in its name, build a debug package. (More # # If this build is for a tag with "DEBUG" in its name, build a debug package. (More
# detailed logging, no optimization, etc.) # # detailed logging, no optimization, etc.)
if [[ "$GITHUB_REF" =~ .*DEBUG.* ]]; then # if [[ "$GITHUB_REF" =~ .*DEBUG.* ]]; then
sudo ./package.sh -d # sudo ./package.sh -d
else # else
sudo ./package.sh # sudo ./package.sh
fi # fi
- name: Install the .pkg. # - name: Install the .pkg.
# Delete archives/ first because it contains a copy of Background Music.app. # # Delete archives/ first because it contains a copy of Background Music.app.
# Background Music.app is "relocatable", which means that if the user moves it and then # # Background Music.app is "relocatable", which means that if the user moves it and then
# installs a new version, macOS will put the new version in the same place. This makes sure # # installs a new version, macOS will put the new version in the same place. This makes sure
# the installer puts Background Music.app in /Applications (and the build won't fail when we # # the installer puts Background Music.app in /Applications (and the build won't fail when we
# check that later). # # check that later).
# # #
# package.sh puts the archives in a zipfile next to the .pkg, so we can still upload them. # # package.sh puts the archives in a zipfile next to the .pkg, so we can still upload them.
# # #
# TODO: On TravisCI, this was failing for debug builds. We couldn't figure out why, so we # # TODO: On TravisCI, this was failing for debug builds. We couldn't figure out why, so we
# might have to ignore that with # # might have to ignore that with
# || [[ "$GITHUB_REF" =~ .*DEBUG.* ]] # # || [[ "$GITHUB_REF" =~ .*DEBUG.* ]]
run: | # run: |
sudo rm -rf archives # sudo rm -rf archives
sudo installer \ # sudo installer \
-pkg Background-Music-*/BackgroundMusic-*.pkg \ # -pkg Background-Music-*/BackgroundMusic-*.pkg \
-target / \ # -target / \
-verbose \ # -verbose \
-dumplog # -dumplog
- name: Print the installer logs. # - name: Print the installer logs.
if: always() # if: always()
# This trims the start of the log to save space. # # This trims the start of the log to save space.
run: grep -E -A 9999 -B 20 'Background.?Music' /var/log/install.log # run: grep -E -A 9999 -B 20 'Background.?Music' /var/log/install.log
- name: Check the BGM dirs and files were installed. # - name: Check the BGM dirs and files were installed.
if: always() # if: always()
run: | # run: |
ls -la "/Applications/Background Music.app" # ls -la "/Applications/Background Music.app"
ls -la "/Library/Audio/Plug-Ins/HAL/Background Music Device.driver" # ls -la "/Library/Audio/Plug-Ins/HAL/Background Music Device.driver"
ls -la "/usr/local/libexec/BGMXPCHelper.xpc" \ # ls -la "/usr/local/libexec/BGMXPCHelper.xpc" \
|| ls -la "/Library/Application Support/Background Music/BGMXPCHelper.xpc" # || ls -la "/Library/Application Support/Background Music/BGMXPCHelper.xpc"
ls -la "/Library/LaunchDaemons/com.bearisdriving.BGM.XPCHelper.plist" # ls -la "/Library/LaunchDaemons/com.bearisdriving.BGM.XPCHelper.plist"
- name: Upload the .pkg installer and archives. # - name: Upload the .pkg installer and archives.
if: always() # if: always()
uses: actions/upload-artifact@v3 # uses: actions/upload-artifact@v3
with: # with:
name: pkg-installer # name: pkg-installer
path: Background-Music-* # path: Background-Music-*
- name: Upload the log file from the package.sh build. # - name: Upload the log file from the package.sh build.
if: always() # if: always()
uses: actions/upload-artifact@v3 # uses: actions/upload-artifact@v3
with: # with:
name: build-and-install-log-for-pkg # name: build-and-install-log-for-pkg
path: build_and_install.log # path: build_and_install.log
# TODO: Create a GitHub release. This is the Travis YAML that was handling it: ## TODO: Create a GitHub release. This is the Travis YAML that was handling it:
# deploy: ## deploy:
# provider: releases ## provider: releases
# api_key: ## api_key:
# secure: j5Gd[...] ## secure: j5Gd[...]
# file_glob: true ## file_glob: true
# file: Background-Music-*/* ## file: Background-Music-*/*
# skip_cleanup: true ## skip_cleanup: true
# name: $TRAVIS_TAG ## name: $TRAVIS_TAG
# prerelease: true ## prerelease: true
# draft: true ## draft: true
# on: ## on:
# repo: kyleneideck/BackgroundMusic ## repo: kyleneideck/BackgroundMusic
# tags: true ## tags: true
# # TODO: Use "condition" to build master and tags? ## # TODO: Use "condition" to build master and tags?
# condition: $DEPLOY = true ## condition: $DEPLOY = true

View file

@ -110,6 +110,8 @@
XCTAssert([okButton waitForExistenceWithTimeout:10.0]); XCTAssert([okButton waitForExistenceWithTimeout:10.0]);
// This click is failing on GH Actions. No idea why, so try a sleep.
(void)[XCTWaiter waitForExpectations:@[[XCTestExpectation new]] timeout:2.0];
[okButton click]; [okButton click];
} }