mirror of
https://github.com/kyleneideck/BackgroundMusic
synced 2024-11-22 20:23:04 +00:00
Migrate from Travis CI to GitHub Actions.
This commit is contained in:
parent
6ef13ed762
commit
d84471c29e
1 changed files with 190 additions and 0 deletions
190
.github/workflows/build-test-release.yml
vendored
Normal file
190
.github/workflows/build-test-release.yml
vendored
Normal file
|
@ -0,0 +1,190 @@
|
||||||
|
# Based on the .travis.yml file.
|
||||||
|
# TODO: Split this into multiple .yml files? Multiple jobs?
|
||||||
|
name: Build, Test and Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- $default-branch
|
||||||
|
- gh-actions
|
||||||
|
tags:
|
||||||
|
- *
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- $default-branch
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-test-release:
|
||||||
|
runs-on: ${{ matrix.conf.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
conf:
|
||||||
|
# TODO: Add older macOS versions.
|
||||||
|
- os: macos-latest
|
||||||
|
release: true
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
# TODO: This part is commented out for now so we can check whether we need it for GitHub Actions. If
|
||||||
|
# the VMs do have an audio device, we can probably delete NullAudio.
|
||||||
|
# - name: |
|
||||||
|
# Install Apple's NullAudio device. The CI VMs probably don't have any audio devices installed.
|
||||||
|
# run: >-
|
||||||
|
# sudo xcodebuild -quiet -project
|
||||||
|
# BGMApp/BGMAppTests/NullAudio/AudioDriverExamples.xcodeproj -target
|
||||||
|
# NullAudio DSTROOT="/" install &&
|
||||||
|
# sudo launchctl kickstart -kp system/com.apple.audio.coreaudiod || sudo
|
||||||
|
# killall coreaudiod
|
||||||
|
- name: Work in a case-sensitive disk image.
|
||||||
|
# This lets us catch failures that only happen on case-sensitive filesystems.
|
||||||
|
run: |
|
||||||
|
hdiutil create \
|
||||||
|
-type SPARSEBUNDLE \
|
||||||
|
-fs 'Case-sensitive Journaled HFS+' \
|
||||||
|
-volname bgmbuild \
|
||||||
|
-nospotlight \
|
||||||
|
-verbose \
|
||||||
|
-attach \
|
||||||
|
-size 100m \
|
||||||
|
bgmbuild.dmg
|
||||||
|
sudo cp -r . /Volumes/bgmbuild
|
||||||
|
cd /Volumes/bgmbuild
|
||||||
|
- name: Install Background Music.
|
||||||
|
run: yes | ./build_and_install.sh
|
||||||
|
- name: Print the log file.
|
||||||
|
run: |
|
||||||
|
# Put it in a fold because it's so long. TODO: Is this necessary?
|
||||||
|
echo ::group::build_and_install.log
|
||||||
|
cat build_and_install.log
|
||||||
|
echo ::endgroup::
|
||||||
|
- name: Log some checksums.
|
||||||
|
run: 'find */build/Release/*/ -type f -exec md5 {} \;'
|
||||||
|
- name: Log the installed audio devices and their IDs.
|
||||||
|
run: |
|
||||||
|
system_profiler SPAudioDataType
|
||||||
|
say -a '?'
|
||||||
|
- name: Check the BGM dirs and files were installed. (These fail if the dir/file isn't found.)
|
||||||
|
run: |
|
||||||
|
ls -la "/Applications/Background Music.app"
|
||||||
|
ls -la "/Library/Audio/Plug-Ins/HAL/Background Music Device.driver"
|
||||||
|
ls -la "/usr/local/libexec/BGMXPCHelper.xpc" \
|
||||||
|
|| ls -la "/Library/Application Support/Background Music/BGMXPCHelper.xpc"
|
||||||
|
ls -la "/Library/LaunchDaemons/com.bearisdriving.BGM.XPCHelper.plist"
|
||||||
|
- name: Close BGMApp (which the install script opened).
|
||||||
|
run: >-
|
||||||
|
osascript -e 'tell application "Background Music" to quit'
|
||||||
|
|| killall "Background Music"
|
||||||
|
# TODO: Reenable this if it turns out we need it. (Likely.)
|
||||||
|
# - name: Skip the UI tests until GitHub Actions supports them.
|
||||||
|
# run: BGMApp/BGMAppTests/UITests/travis-skip.py
|
||||||
|
- name: Run the tests.
|
||||||
|
run: \
|
||||||
|
echo ::group::BGMDriver Tests
|
||||||
|
xcodebuild \
|
||||||
|
-quiet \
|
||||||
|
-workspace BGM.xcworkspace \
|
||||||
|
-scheme 'Background Music Device' \
|
||||||
|
test
|
||||||
|
echo ::endgroup::
|
||||||
|
echo ::group::BGMApp Tests
|
||||||
|
xcodebuild \
|
||||||
|
-quiet \
|
||||||
|
-workspace BGM.xcworkspace \
|
||||||
|
-scheme 'Background Music' \
|
||||||
|
test
|
||||||
|
echo ::endgroup::
|
||||||
|
echo ::group::BGMXPCHelper Tests
|
||||||
|
xcodebuild \
|
||||||
|
-quiet \
|
||||||
|
-workspace BGM.xcworkspace \
|
||||||
|
-scheme 'BGMXPCHelper' \
|
||||||
|
test
|
||||||
|
echo ::endgroup::
|
||||||
|
- name: Uninstall Background Music.
|
||||||
|
run: yes | ./uninstall.sh
|
||||||
|
- name: Check the BGM dirs and files were removed.
|
||||||
|
run: |
|
||||||
|
if ls -la "/Applications/Background Music.app"; then exit 1; fi
|
||||||
|
if ls -la "/Library/Audio/Plug-Ins/HAL/Background Music Device.driver"; then exit 1; fi
|
||||||
|
if ls -la "/usr/local/libexec/BGMXPCHelper.xpc"; then exit 1; fi
|
||||||
|
if ls -la "/Library/Application Support/Background Music/BGMXPCHelper.xpc"; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if ls -la "/Library/LaunchDaemons/com.bearisdriving.BGM.XPCHelper.plist"; then exit 1; fi
|
||||||
|
- name: Build the .pkg installer.
|
||||||
|
if: matrix.conf.release
|
||||||
|
run: |
|
||||||
|
# If this build is for a tag with "DEBUG" in its name, build a debug package. (More detailed
|
||||||
|
# logging, no optimization, etc.)
|
||||||
|
if [[ "$GITHUB_REF" =~ .*DEBUG.* ]]; then
|
||||||
|
if ! ./package.sh -d; then
|
||||||
|
# Print the build logs if it fails.
|
||||||
|
# TODO: We upload this file in a later step, so this might not be necessary.
|
||||||
|
cat build_and_install.log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if ! ./package.sh; then
|
||||||
|
cat build_and_install.log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
- name: Install the .pkg.
|
||||||
|
if: matrix.conf.release
|
||||||
|
run: >-
|
||||||
|
sudo installer
|
||||||
|
-pkg Background-Music-*/BackgroundMusic-*.pkg
|
||||||
|
-target /
|
||||||
|
-verbose
|
||||||
|
-dumplog
|
||||||
|
#|| [[ "$GITHUB_REF" =~ .*DEBUG.* ]]
|
||||||
|
- name: Print the installer logs.
|
||||||
|
if: matrix.conf.release
|
||||||
|
run: |
|
||||||
|
echo ::group::install.log
|
||||||
|
# This trims the start of the log to save space.
|
||||||
|
grep -E -A 9999 -B 20 'Background.?Music' /var/log/install.log
|
||||||
|
echo ::endgroup::
|
||||||
|
- name: Check the BGM dirs and files were installed again.
|
||||||
|
if: matrix.conf.release
|
||||||
|
run: |
|
||||||
|
ls -la "/Applications/Background Music.app"
|
||||||
|
ls -la "/Library/Audio/Plug-Ins/HAL/Background Music Device.driver"
|
||||||
|
ls -la "/usr/local/libexec/BGMXPCHelper.xpc" \
|
||||||
|
|| ls -la "/Library/Application Support/Background Music/BGMXPCHelper.xpc"
|
||||||
|
ls -la "/Library/LaunchDaemons/com.bearisdriving.BGM.XPCHelper.plist"
|
||||||
|
- name: Upload the .pkg installer.
|
||||||
|
if: matrix.conf.release
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: pkg-installer
|
||||||
|
path: Background-Music-*
|
||||||
|
- name: Upload the log file from the package.sh build.
|
||||||
|
if: matrix.conf.release
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: build-and-install-log-for-pkg
|
||||||
|
path: build_and_install.log
|
||||||
|
- name: Upload the dsyms (debug symbols).
|
||||||
|
# TODO: Check this works.
|
||||||
|
if: matrix.conf.release
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: archives
|
||||||
|
path: archives
|
||||||
|
# TODO: Create a GitHub release. This is the Travis YAML that was handling it:
|
||||||
|
# deploy:
|
||||||
|
# provider: releases
|
||||||
|
# api_key:
|
||||||
|
# secure: j5Gd[...]
|
||||||
|
# file_glob: true
|
||||||
|
# file: Background-Music-*/*
|
||||||
|
# skip_cleanup: true
|
||||||
|
# name: $TRAVIS_TAG
|
||||||
|
# prerelease: true
|
||||||
|
# draft: true
|
||||||
|
# on:
|
||||||
|
# repo: kyleneideck/BackgroundMusic
|
||||||
|
# tags: true
|
||||||
|
# # TODO: Use "condition" to build master and tags?
|
||||||
|
# condition: $DEPLOY = true
|
Loading…
Reference in a new issue