Template warning #149
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continuous Integration | |
on: | |
pull_request: | |
branches: [main] | |
env: | |
BUNDLE_IDENTIFIER: com.kylenazario.Essayist | |
TEST_PROJECT_PATH: ./Tests/Essayist/Essayist.xcodeproj | |
TEST_PROJECT_NAME: Essayist | |
jobs: | |
linting: | |
name: Linting | |
runs-on: macos-11 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Lint project | |
run: swiftlint | |
appkit: | |
name: AppKit Tests | |
runs-on: macos-11 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: actions/checkout@v2 | |
- name: Turn on Do Not Disturb | |
run: | | |
brew install vitorgalvao/tiny-scripts/calm-notifications | |
calm-notifications on | |
- name: Change to testing branch | |
env: | |
XCODEPROJ: Tests/Essayist/Essayist.xcodeproj/project.pbxproj | |
run: | | |
sed -i '' "s/main;/${GITHUB_HEAD_REF//\//\\/};/g" $XCODEPROJ | |
sed -i '' "s/kyle-n/${GITHUB_ACTOR//\//\\/}/g" $XCODEPROJ | |
- name: Run AppKit tests | |
run: | | |
xcodebuild -resolvePackageDependencies -project "$TEST_PROJECT_PATH" | |
xcodebuild test -destination 'platform=OS X,arch=x86_64' -scheme "$TEST_PROJECT_NAME (macOS)" -project $TEST_PROJECT_PATH | |
- name: Save non-matching macOS snapshots | |
if: failure() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: macOS-non-matching-snapshots | |
path: /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/com.kylenazario.macOS-EssayistUITests.xctrunner/macOS_EssayistUITests | |
if-no-files-found: ignore | |
- name: Save existing/new macOS snapshots | |
if: failure() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: macOS-existing-or-new-snapshots | |
path: /Users/runner/work/HighlightedTextEditor/HighlightedTextEditor/Tests/Essayist/macOS-EssayistUITests/__Snapshots__ | |
if-no-files-found: ignore | |
uikit: | |
name: UIKit Tests | |
runs-on: macos-11 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Change to testing branch | |
env: | |
XCODEPROJ: Tests/Essayist/Essayist.xcodeproj/project.pbxproj | |
run: | | |
sed -i '' "s/main;/${GITHUB_HEAD_REF//\//\\/};/g" $XCODEPROJ | |
sed -i '' "s/kyle-n/${GITHUB_ACTOR//\//\\/}/g" $XCODEPROJ | |
- name: Boot Simulator | |
env: | |
IOS_SIM_NAME: iPhone 13 | |
run: | | |
IOS_SIM_UDID=`xcrun simctl list | grep -w "$IOS_SIM_NAME" | awk 'match($0, /\(([-0-9A-F]+)\)/) { print substr( $0, RSTART + 1, RLENGTH - 2 )}' | head -1` | |
SIMULATOR_PATH='/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator' | |
echo "Running sim for $APP_NAME - $BUNDLE_IDENTIFIER" | |
open -a "$SIMULATOR_PATH" --args -CurrentDeviceUDID $IOS_SIM_UDID | |
# Wait until there is a device booted | |
function booted_sim_ct() { | |
echo `xcrun simctl list | grep Booted | wc -l | sed -e 's/ //g'` | |
} | |
while [ `booted_sim_ct` -lt 1 ] | |
do | |
sleep 1 | |
done | |
- name: Run UIKit tests | |
run: | | |
xcodebuild -resolvePackageDependencies -project "$TEST_PROJECT_PATH" | |
xcodebuild test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13' -scheme "$TEST_PROJECT_NAME (iOS)" -project $TEST_PROJECT_PATH | |
killall Simulator | |
- name: Save non-matching iOS snapshots | |
if: failure() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: iOS-failing-snapshots | |
path: /Users/runner/Library/Developer/CoreSimulator/Devices/**/test*.png | |
if-no-files-found: ignore | |
- name: Save existing/new iOS snapshots | |
if: failure() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: iOS-new-snapshots | |
path: /Users/runner/work/HighlightedTextEditor/HighlightedTextEditor/Tests/Essayist/iOS-EssayistUITests/__Snapshots__ | |
if-no-files-found: ignore |