Skip to content

Explicitly uses macOS 13 runners #57

Explicitly uses macOS 13 runners

Explicitly uses macOS 13 runners #57

Workflow file for this run

name: UI Tests
concurrency:
group: ui-tests-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch: {}
pull_request:
branches: [ main ]
paths:
- 'Sources/**'
- '!Sources/Runestone/Documentation.docc/**'
- 'UITests/HostUITests/**'
concurrency:

Check failure on line 13 in .github/workflows/ui_tests.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/ui_tests.yml

Invalid workflow file

You have an error in your yaml syntax on line 13
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
DEVELOPER_DIR: /Applications/Xcode_14.3.1.app/Contents/Developer
jobs:
run_korean_tests:
name: Run Korean tests
runs-on: macos-13
env:
SIMULATOR_NAME: UI Test (Korean)
SCHEME: Host
PROJECT_PATH: UITests/UITests.xcodeproj
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Disable "Use the Same Keyboard Language as macOS"
run: defaults write com.apple.iphonesimulator EnableKeyboardSync -bool NO
- name: Create Simulator
run: xcrun simctl create "${SIMULATOR_NAME}" "iPhone 8"
- name: Find Simulator UDID
run: |
TMP_SIMULATOR_UDID=`xcrun simctl list --json devices | jq -r ".devices | flatten | .[] | select(.name == \"${SIMULATOR_NAME}\").udid"`
echo "SIMULATOR_UDID=$(echo $TMP_SIMULATOR_UDID)" >> $GITHUB_ENV
- name: Modify .GlobalPreferences.plist
run: >
find ~/Library/Developer/CoreSimulator/Devices/$SIMULATOR_UDID -type d -maxdepth 0\
-exec /usr/libexec/PlistBuddy\
-c "Add :AppleKeyboardsExpanded integer 1"\
-c "Delete :AppleLanguages"\
-c "Add :AppleLanguages array"\
-c "Add :AppleLanguages:0 string en-US"\
-c "Delete :AppleKeyboards"\
-c "Add :AppleKeyboards array"\
-c "Add :AppleKeyboards:0 string ko_KR@Sw=Korean;hw=Automatic"\
{}/data/Library/Preferences/.GlobalPreferences.plist \;
- name: Disable "Connect Hardware Keyboard" in the simulator.
run: >
find ~/Library/Preferences/com.apple.iphonesimulator.plist\
-exec /usr/libexec/PlistBuddy\
-c "Add :DevicePreferences dict"\
-c "Add :DevicePreferences:${SIMULATOR_UDID} dict"\
-c "Add :DevicePreferences:${SIMULATOR_UDID}:ConnectHardwareKeyboard bool false"\
{} \;
- name: Build
run: >
xcodebuild build-for-testing\
-project $PROJECT_PATH\
-scheme $SCHEME\
-sdk iphonesimulator\
-destination "platform=iOS Simulator,id=${SIMULATOR_UDID}"
- name: Run Tests
run: >
xcodebuild test-without-building\
-only-testing:HostUITests/KoreanInputTests\
-project $PROJECT_PATH\
-scheme $SCHEME\
-sdk iphonesimulator\
-destination "platform=iOS Simulator,id=${SIMULATOR_UDID}"
- name: Remove Simulator Preferences
run: >
find ~/Library/Preferences/com.apple.iphonesimulator.plist\
-exec /usr/libexec/PlistBuddy\
-c "Delete :DevicePreferences:${SIMULATOR_UDID}"\
{} \;
- name: Delete Simulator
if: always()
run: xcrun simctl delete $SIMULATOR_UDID
run_chinese_tests:
name: Run Chinese tests
runs-on: macos-13
env:
SIMULATOR_NAME: UI Test (Chinese)
SCHEME: Host
PROJECT_PATH: UITests/UITests.xcodeproj
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Disable "Use the Same Keyboard Language as macOS"
run: defaults write com.apple.iphonesimulator EnableKeyboardSync -bool NO
- name: Create Simulator
run: xcrun simctl create "${SIMULATOR_NAME}" "iPhone 8"
- name: Find Simulator UDID
run: |
TMP_SIMULATOR_UDID=`xcrun simctl list --json devices | jq -r ".devices | flatten | .[] | select(.name == \"${SIMULATOR_NAME}\").udid"`
echo "SIMULATOR_UDID=$(echo $TMP_SIMULATOR_UDID)" >> $GITHUB_ENV
- name: Modify .GlobalPreferences.plist
run: >
find ~/Library/Developer/CoreSimulator/Devices/$SIMULATOR_UDID -type d -maxdepth 0\
-exec /usr/libexec/PlistBuddy\
-c "Add :AppleKeyboardsExpanded integer 1"\
-c "Delete :AppleLanguages"\
-c "Add :AppleLanguages array"\
-c "Add :AppleLanguages:0 string en-US"\
-c "Delete :AppleKeyboards"\
-c "Add :AppleKeyboards array"\
-c "Add :AppleKeyboards:0 string zh_Hant-Sucheng@sw=Sucheng;hw=Automatic"\
{}/data/Library/Preferences/.GlobalPreferences.plist \;
- name: Disable "Connect Hardware Keyboard" in the simulator.
run: >
find ~/Library/Preferences/com.apple.iphonesimulator.plist\
-exec /usr/libexec/PlistBuddy\
-c "Add :DevicePreferences dict"\
-c "Add :DevicePreferences:${SIMULATOR_UDID} dict"\
-c "Add :DevicePreferences:${SIMULATOR_UDID}:ConnectHardwareKeyboard bool false"\
{} \;
- name: Build
run: >
xcodebuild build-for-testing -project\
$PROJECT_PATH -scheme $SCHEME\
-sdk iphonesimulator\
-destination "platform=iOS Simulator,id=${SIMULATOR_UDID}"
- name: Run Tests
run: >
xcodebuild test-without-building\
-only-testing:HostUITests/ChineseInputTests\
-project $PROJECT_PATH\
-scheme $SCHEME\
-sdk iphonesimulator\
-destination "platform=iOS Simulator,id=${SIMULATOR_UDID}"
- name: Remove Simulator Preferences
run: >
find ~/Library/Preferences/com.apple.iphonesimulator.plist\
-exec /usr/libexec/PlistBuddy\
-c "Delete :DevicePreferences:${SIMULATOR_UDID}"\
{} \;
- name: Delete Simulator
if: always()
run: xcrun simctl delete $SIMULATOR_UDID