From 1bc77ff32d626dfb83127493b45a03817027dd92 Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Tue, 9 Apr 2024 00:49:16 -0700 Subject: [PATCH] Update GitHub Actions steps --- .github/workflows/ci.yml | 51 ++++++++++++++++++++++----------- tests/android/build.gradle | 12 ++++---- tests/ios/Tests/Tests.swift | 2 +- tests/ios/UITests/UITests.swift | 4 +-- 4 files changed, 44 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6549871..ec9ead7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,17 +11,17 @@ on: jobs: test-ios: name: "iOS Tests" - runs-on: macos-12 + runs-on: macos-14 env: - DEVELOPER_DIR: /Applications/Xcode_13.4.1.app/Contents/Developer + DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: - node-version: 16 + node-version: 20 - name: Set up example app run: | @@ -35,16 +35,17 @@ jobs: -project OAuthPluginTests.xcodeproj \ -scheme OAuthPluginTests \ -testPlan UnitTests \ - -destination "platform=iOS Simulator,name=iPhone 13" + -destination "platform=iOS Simulator,name=iPhone 15" working-directory: ./tests/ios - name: Run iOS UI Tests run: | - xcodebuild test -quiet \ + xcodebuild test \ -project OAuthPluginTests.xcodeproj \ -scheme OAuthPluginTests \ -testPlan DeviceTests \ - -destination "platform=iOS Simulator,name=iPhone 13" + -destination "platform=iOS Simulator,name=iPhone 15" \ + -destination-timeout 300 working-directory: ./tests/ios @@ -53,18 +54,24 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Enable KVM group perms + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + + - uses: actions/checkout@v4 - name: Use Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: - node-version: 16 + node-version: 20 - name: Use Java - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: temurin - java-version: 11 + java-version: 17 - name: Set up example app run: | @@ -72,9 +79,19 @@ jobs: npx cordova prepare android working-directory: ./example + - name: Set up gradle + uses: gradle/actions/setup-gradle@v3 + with: + gradle-version: 8.4 + - name: Run Android Unit Tests - uses: gradle/gradle-build-action@v2 + run: | + gradle test + working-directory: ./tests/android + + - name: Run Android UI Tests + uses: reactivecircus/android-emulator-runner@v2 with: - gradle-version: 7.5.1 - arguments: test - build-root-directory: ./tests/android + api-level: 29 + script: gradle connectedCheck + working-directory: ./tests/android diff --git a/tests/android/build.gradle b/tests/android/build.gradle index 53ba64c..4f5d2ae 100644 --- a/tests/android/build.gradle +++ b/tests/android/build.gradle @@ -21,20 +21,20 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.3.0' + classpath 'com.android.tools.build:gradle:8.3.1' } } apply plugin: 'com.android.application' android { - compileSdkVersion 33 + compileSdkVersion 34 defaultConfig { namespace 'com.ayogo.cordova.oauth.tests' applicationId 'com.ayogo.cordova.oauth.tests' - minSdkVersion 22 - targetSdkVersion 33 + minSdkVersion 24 + targetSdkVersion 34 versionCode 1 versionName '1.0' testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' @@ -65,7 +65,9 @@ dependencies { testImplementation 'org.mockito:mockito-inline:4.6.1' testImplementation 'org.json:json:[20220924,)' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test:core:1.5.0' + androidTestImplementation 'androidx.test:runner:1.5.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0' } diff --git a/tests/ios/Tests/Tests.swift b/tests/ios/Tests/Tests.swift index d9c6d82..38321e5 100644 --- a/tests/ios/Tests/Tests.swift +++ b/tests/ios/Tests/Tests.swift @@ -118,7 +118,7 @@ class OAuthPluginTests: XCTestCase { func testOAuthCommandURL() throws { plugin.pluginInitialize() - let nonURLcmd = CDVInvokedUrlCommand(arguments:["Hello world!"], callbackId:"", className:"CDVOAuthPlugin", methodName:"startOAuth") + let nonURLcmd = CDVInvokedUrlCommand(arguments:[""], callbackId:"", className:"CDVOAuthPlugin", methodName:"startOAuth") plugin.startOAuth(nonURLcmd!) XCTAssertEqual(cmdDlg.lastResult.status as! UInt, CDVCommandStatus.error.rawValue) } diff --git a/tests/ios/UITests/UITests.swift b/tests/ios/UITests/UITests.swift index ed6050f..00c9dd7 100644 --- a/tests/ios/UITests/UITests.swift +++ b/tests/ios/UITests/UITests.swift @@ -59,7 +59,7 @@ class OAuthPluginUITests: XCTestCase { // Verify the app received the OAuth token and considers us logged in let loggedIn = app.staticTexts["LOGGED IN"] - _ = loggedIn.waitForExistence(timeout: 5) + _ = loggedIn.waitForExistence(timeout: 45) XCTAssert(loggedIn.exists) } @@ -71,7 +71,7 @@ class OAuthPluginUITests: XCTestCase { } let oauthButton = app.webViews.buttons["Click Here to Login"] - _ = oauthButton.waitForExistence(timeout: 5) + _ = oauthButton.waitForExistence(timeout: 25) XCTAssert(oauthButton.exists) XCTAssert(oauthButton.isHittable) oauthButton.tap()