From 0ba9b6cb726649be03dda3c34720e00242af9e3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=B8vring?= Date: Sun, 24 Sep 2023 16:11:54 +0200 Subject: [PATCH] Workflows uses Xcode 15 (#316) * Workflows uses Xcode 15 * Run workflows when workflow changes * Fixes UI tests * Makes destination more specific * Updates DEVELOPER_DIR * Update build_and_test.yml * Uses iPhone 14 --- .github/workflows/build_and_test.yml | 16 ++++++---- .github/workflows/build_example_project.yml | 9 ++++-- .github/workflows/codeql.yml | 8 +++-- .github/workflows/deploy_documentation.yml | 2 +- .github/workflows/ui_tests.yml | 7 +++-- Scripts/run-ui-test-chinese.sh | 2 +- Scripts/run-ui-test-korean.sh | 2 +- UITests/HostUITests/KoreanInputTests.swift | 31 ------------------- .../HostUITests/XCUIApplication+Helpers.swift | 7 ----- 9 files changed, 30 insertions(+), 54 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index be34aa611..c7f45d80c 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -4,6 +4,7 @@ on: pull_request: branches: [ main ] paths: + - '.github/workflows/build_and_test.yml' - 'Sources/**' - '!Sources/Runestone/Documentation.docc/**' - 'Tests/**' @@ -11,7 +12,7 @@ concurrency: 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 + DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer jobs: build: name: Build and test on iPhone 14 @@ -23,10 +24,13 @@ jobs: submodules: recursive - name: Build run: | - xcodebuild build-for-testing -scheme Runestone -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' + xcodebuild build-for-testing\ + -scheme Runestone\ + -sdk iphonesimulator\ + -destination "platform=iOS Simulator,name=iPhone 14 Pro,OS=17.0" - name: Test - env: - scheme: ${{ 'default' }} - platform: ${{ 'iOS Simulator' }} run: | - xcodebuild test-without-building -scheme Runestone -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' + xcodebuild test-without-building\ + -scheme Runestone\ + -sdk iphonesimulator\ + -destination "platform=iOS Simulator,name=iPhone 14 Pro,OS=17.0" diff --git a/.github/workflows/build_example_project.yml b/.github/workflows/build_example_project.yml index 5a5e28ff2..53baadfc8 100644 --- a/.github/workflows/build_example_project.yml +++ b/.github/workflows/build_example_project.yml @@ -4,12 +4,13 @@ on: pull_request: branches: [ main ] paths: + - '.github/workflows/build_example_project.yml' - 'Example/**' concurrency: 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 + DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer jobs: build: name: Build example project for iPhone 14 @@ -21,4 +22,8 @@ jobs: submodules: recursive - name: Build run: | - xcodebuild build -project Example/Example.xcodeproj -scheme Example -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' + xcodebuild build\ + -project Example/Example.xcodeproj\ + -scheme Example\ + -sdk iphonesimulator\ + -destination "platform=iOS Simulator,name=iPhone 14 Pro,OS=17.0" diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index ccea7ec09..bab6cb89d 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -8,7 +8,7 @@ concurrency: 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 + DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer jobs: analyze: name: Analyze @@ -29,7 +29,11 @@ jobs: with: languages: ${{ matrix.language }} - name: Build - run: xcodebuild -scheme Runestone -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' + run: | + xcodebuild\ + -scheme Runestone\ + -sdk iphonesimulator\ + -destination "platform=iOS Simulator,name=iPhone 14 Pro,OS=17.0" - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 with: diff --git a/.github/workflows/deploy_documentation.yml b/.github/workflows/deploy_documentation.yml index 219d7d518..2797dd56b 100644 --- a/.github/workflows/deploy_documentation.yml +++ b/.github/workflows/deploy_documentation.yml @@ -9,7 +9,7 @@ concurrency: group: "pages" cancel-in-progress: true env: - DEVELOPER_DIR: /Applications/Xcode_14.3.1.app/Contents/Developer + DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer jobs: build: runs-on: macos-13 diff --git a/.github/workflows/ui_tests.yml b/.github/workflows/ui_tests.yml index 907e01f32..dfd6517a6 100644 --- a/.github/workflows/ui_tests.yml +++ b/.github/workflows/ui_tests.yml @@ -4,6 +4,7 @@ on: pull_request: branches: [ main ] paths: + - '.github/workflows/ui_tests.yml' - 'Sources/**' - '!Sources/Runestone/Documentation.docc/**' - 'UITests/HostUITests/**' @@ -11,7 +12,7 @@ concurrency: 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 + DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer jobs: run_korean_tests: name: Run Korean tests @@ -28,7 +29,7 @@ jobs: - 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" + 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"` @@ -92,7 +93,7 @@ jobs: - 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" + 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"` diff --git a/Scripts/run-ui-test-chinese.sh b/Scripts/run-ui-test-chinese.sh index 59c84e360..ba925b3bb 100755 --- a/Scripts/run-ui-test-chinese.sh +++ b/Scripts/run-ui-test-chinese.sh @@ -6,7 +6,7 @@ PROJECT_PATH="${SCRIPT_PATH}/../UITests/UITests.xcodeproj" # Disable "Use the Same Keyboard Language as macOS" in Simulator.app. defaults write com.apple.iphonesimulator EnableKeyboardSync -bool NO # Create the simulator we will use for the tests. -xcrun simctl create "${SIMULATOR_NAME}" "iPhone 8" 2> /dev/null +xcrun simctl create "${SIMULATOR_NAME}" "iPhone 13" "iOS15.5" 2> /dev/null # Find the UDID of the newly created simulator. SIMULATOR_UDID=`xcrun simctl list --json devices | jq -r ".devices | flatten | .[] | select(.name == \"${SIMULATOR_NAME}\").udid"` # Edit the simulator's .GlobalPreferences.plist to use the Chinese language. diff --git a/Scripts/run-ui-test-korean.sh b/Scripts/run-ui-test-korean.sh index 7170329f4..dca4197fd 100755 --- a/Scripts/run-ui-test-korean.sh +++ b/Scripts/run-ui-test-korean.sh @@ -6,7 +6,7 @@ PROJECT_PATH="${SCRIPT_PATH}/../UITests/UITests.xcodeproj" # Disable "Use the Same Keyboard Language as macOS" in Simulator.app. defaults write com.apple.iphonesimulator EnableKeyboardSync -bool NO # Create the simulator we will use for the tests. -xcrun simctl create "${SIMULATOR_NAME}" "iPhone 8" 2> /dev/null +xcrun simctl create "${SIMULATOR_NAME}" "iPhone 13" "iOS15.5" 2> /dev/null # Find the UDID of the newly created simulator. SIMULATOR_UDID=`xcrun simctl list --json devices | jq -r ".devices | flatten | .[] | select(.name == \"${SIMULATOR_NAME}\").udid"` # Edit the simulator's .GlobalPreferences.plist to use the Korean language. diff --git a/UITests/HostUITests/KoreanInputTests.swift b/UITests/HostUITests/KoreanInputTests.swift index 792aafca8..98f799e6e 100644 --- a/UITests/HostUITests/KoreanInputTests.swift +++ b/UITests/HostUITests/KoreanInputTests.swift @@ -95,37 +95,6 @@ final class KoreanInputTests: XCTestCase { XCTAssertEqual(app.textView?.value as? String, "\"어\"") } - func testInsertingKoreanCharactersBelowStringContainingKoreanLetters() throws { - let app = XCUIApplication().disablingTextPersistance() - app.launch() - app.textView?.tap() - app.keys["ㅇ"].tap() - app.keys["ㅓ"].tap() - app.keys["ㅇ"].tap() - app.keys["ㅓ"].tap() - app.keys["ㅇ"].tap() - app.keys["ㅓ"].tap() - app.buttons["Return"].tap() - app.keys["more"].tap() - app.keys["\""].tap() - app.keys["more"].tap() - app.keys["ㅇ"].tap() - app.keys["ㅓ"].tap() - app.keys["ㅇ"].tap() - app.keys["ㅓ"].tap() - app.keys["ㅇ"].tap() - app.keys["ㅓ"].tap() - app.tap(at: CGPoint(x: 100, y: 100)) - app.buttons["Return"].tap() - app.keys["ㅇ"].tap() - app.keys["ㅓ"].tap() - app.keys["ㅇ"].tap() - app.keys["ㅓ"].tap() - app.keys["ㅇ"].tap() - app.keys["ㅓ"].tap() - XCTAssertEqual(app.textView?.value as? String, "어어어\n\"어어어\"\n어어어") - } - func testInsertingKoreanCharactersInTextWithCRLFLineEndings() throws { let app = XCUIApplication().disablingTextPersistance().usingCRLFLineEndings() app.launch() diff --git a/UITests/HostUITests/XCUIApplication+Helpers.swift b/UITests/HostUITests/XCUIApplication+Helpers.swift index a95acd23f..1299b25b3 100644 --- a/UITests/HostUITests/XCUIApplication+Helpers.swift +++ b/UITests/HostUITests/XCUIApplication+Helpers.swift @@ -10,13 +10,6 @@ extension XCUIApplication { scrollViews.children(matching: .textView).element } - func tap(at point: CGPoint) { - let normalized = coordinate(withNormalizedOffset: .zero) - let offset = CGVector(dx: point.x, dy: point.y) - let coordinate = normalized.withOffset(offset) - coordinate.tap() - } - func disablingTextPersistance() -> Self { var newLaunchEnvironment = launchEnvironment newLaunchEnvironment[EnvironmentKey.disableTextPersistance] = "1"