RunestoneSwiftUI #6
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
# --- | |
# This workflow is disabled because multi-stage input, which is used when writing text | |
# in languages like Korean and Chinese, is broken in the iOS 16 and iOS 17 simulators. | |
# However, it still works on the device. Multi-stage text input does work in the | |
# iOS 15 simulator, which is used in this workflow. | |
# | |
# The iOS 15 simulators are not installed on GitHub's macOS 13 and macOS 14 runners, | |
# but they are installed in GitHub's macOS 12 runners. However, the iOS 15 simulators | |
# are only available in Xcode 13.4.1 on those runners, and Xcode 14.3.1 cannot be used | |
# to build this project as the tree-sitter dependency uses Swift tools version 5.8, | |
# which is not supported by Xcode 13.4.1. In fact, the most recent version installed on | |
# the macOS 12 runners is Xcode 14.3, which does not support Swift tools version 5.8 either. | |
# --- | |
name: UI Tests | |
on: | |
workflow_dispatch: {} | |
pull_request: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/ui_tests.yml' | |
- 'Sources/**' | |
- '!Sources/Runestone/Documentation.docc/**' | |
- 'UITests/HostUITests/**' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
DEVELOPER_DIR: /Applications/Xcode_15.0.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@v3 | |
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 13" "iOS15.5" | |
- 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@v3 | |
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 13" "iOS15.5" | |
- 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 |