Skip to content

Commit

Permalink
Update GitHub Actions steps
Browse files Browse the repository at this point in the history
  • Loading branch information
dpogue authored and Darryl Pogue committed May 17, 2024
1 parent 4b6e4c3 commit d68ce0a
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 25 deletions.
51 changes: 34 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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


Expand All @@ -53,28 +54,44 @@ 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: |
npm i
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
12 changes: 7 additions & 5 deletions tests/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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'
}

Expand Down
2 changes: 1 addition & 1 deletion tests/ios/Tests/Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions tests/ios/UITests/UITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -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()
Expand Down

0 comments on commit d68ce0a

Please sign in to comment.