Skip to content

Commit

Permalink
fix: Update mac version and JDK version into yml file (#482)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mansi-mParticle authored and rmi22186 committed May 29, 2024
1 parent a4f1979 commit b67c108
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cross-platform-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
jobs:
cross-platform-tests:
timeout-minutes: 30
runs-on: macos-latest
runs-on: macOS-12
steps:
- name: "Checkout Cross Platform Tests Repo"
uses: actions/checkout@v3
Expand Down
58 changes: 34 additions & 24 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ jobs:
instrumented-tests:
name: "Instrumented Tests"
timeout-minutes: 30
runs-on: macos-latest
runs-on: ubuntu-latest
steps:
- name: "Checkout Branch"
uses: actions/checkout@v3
- name: "Install JDK 11"
- name: "Install JDK 17"
uses: actions/setup-java@v3
with:
distribution: "zulu"
java-version: "11"
java-version: "17"
- name: Gradle cache
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a #v2.9.0
- name: AVD cache
Expand All @@ -35,14 +35,23 @@ jobs:
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- 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
- name: "Run Instrumented Tests"
uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b #v2.28.0
with:
api-level: 29
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: ./gradlew :android-core:cAT :android-kit-base:cAT --stacktrace
#script: ./gradlew :android-core:cAT :android-kit-base:cAT --stacktrace
script: |
# Disable benchmark tests as they do not work on emulators
adb uninstall com.mparticle.kits.test; ./gradlew connectedCheck --stacktrace
./gradlew :android-core:cAT :android-kit-base:cAT -Pandroid.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=none
- name: "Archive Instrumented Tests Results"
uses: actions/upload-artifact@v3
if: always()
Expand All @@ -53,25 +62,18 @@ jobs:
instrumented-orchestrator-tests:
name: "Instrumented Orchestrator Tests"
timeout-minutes: 30
runs-on: macos-latest
runs-on: ubuntu-latest
steps:
- name: "Checkout Branch"
uses: actions/checkout@v3
- name: "Install JDK 11"
- name: "Install JDK 17"
uses: actions/setup-java@v3
with:
distribution: "zulu"
java-version: "11"
java-version: "17"
- name: Gradle cache
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a #v2.9.0
- name: AVD cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-29

- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b #v2.28.0
Expand All @@ -81,14 +83,22 @@ jobs:
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- 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
- name: "Run Instrumented Orchestrator Tests"
uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b #v2.28.0
with:
api-level: 29
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: ./gradlew -Porchestrator=true :android-core:cAT --stacktrace
script: |
# Disable benchmark tests as they do not work on emulators
adb uninstall com.mparticle.test; ./gradlew connectedCheck --stacktrace
./gradlew -Porchestrator=true :android-core:cAT -Pandroid.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=none
- name: "Archive Instrumented Orchestrator Tests Results"
uses: actions/upload-artifact@v3
if: always()
Expand All @@ -102,11 +112,11 @@ jobs:
steps:
- name: "Checkout Branch"
uses: actions/checkout@v3
- name: "Install JDK 11"
- name: "Install JDK 17"
uses: actions/setup-java@v3
with:
distribution: "zulu"
java-version: "11"
java-version: "17"
- name: "Run Unit Tests"
run: ./gradlew test
- name: "Print Android Unit Tests Report"
Expand All @@ -128,11 +138,11 @@ jobs:
uses: actions/checkout@v3
with:
submodules: recursive
- name: "Install JDK 11"
- name: "Install JDK 17"
uses: actions/setup-java@v3
with:
distribution: "zulu"
java-version: "11"
java-version: "17"
- name: "Run Android Core SDK Lint"
run: ./gradlew lint
- name: "Archive Lint Test Results"
Expand All @@ -151,11 +161,11 @@ jobs:
uses: actions/checkout@v3
with:
submodules: recursive
- name: "Install JDK 11"
- name: "Install JDK 17"
uses: actions/setup-java@v3
with:
distribution: "zulu"
java-version: "11"
java-version: "17"
- name: "Run Android Core SDK Kotlin Lint"
run: ./gradlew ktlintCheck
- name: "Archive Kotlin Lint Test Results"
Expand All @@ -181,11 +191,11 @@ jobs:
with:
submodules: recursive
fetch-depth: 0
- name: "Install JDK 11"
- name: "Install JDK 17"
uses: actions/setup-java@v3
with:
distribution: "zulu"
java-version: "11"
java-version: "17"
- name: "Get Latest Kits"
run: git submodule foreach "git rebase main"
- name: "Generate Core Release Build"
Expand Down
8 changes: 8 additions & 0 deletions android-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ android {
}
}
testOptions {
unitTests.all {
jvmArgs += ['--add-opens', 'java.base/java.lang=ALL-UNNAMED']
jvmArgs += ['--add-opens', 'java.base/java.util=ALL-UNNAMED']
jvmArgs += ['--add-opens', 'java.base/java.text=ALL-UNNAMED']
jvmArgs += ['--add-opens', 'java.base/java.math=ALL-UNNAMED']
jvmArgs += ['--add-opens', 'java.base/java.util.concurrent=ALL-UNNAMED']
jvmArgs += ['--add-opens', 'java.base/java.lang.ref=ALL-UNNAMED']
}
if (useOrchestrator()) {
execution 'ANDROIDX_TEST_ORCHESTRATOR'
reportDir buildDir.absolutePath + '/orchestrator/reports'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ class MPUserTest : BaseCleanStartedEachTest() {
assertTrue { getUserAttributes().isEmpty() }
setUserAttribute("foo", "bar")
setUserAttribute("fooInt", 123)
setUserAttribute("fooLong", 12345L)
setUserAttribute("fooLong", 12345)
setUserAttribute("fooDouble", 10.15)
setUserAttribute("fooNegInt", -10L)
setUserAttribute("fooNegLong", -1010L)
setUserAttribute("fooNegInt", -10)
setUserAttribute("fooNegLong", -1010)
this.userAttributes.put("fooNull", null)
android_test_hack()

Expand Down
6 changes: 6 additions & 0 deletions android-kit-base/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ android {
}
}

tasks.withType(Test).configureEach {
jvmArgs('--add-opens=java.base/java.lang=ALL-UNNAMED')
jvmArgs("--add-opens=java.base/java.util=ALL-UNNAMED")
jvmArgs('--add-opens=java.base/java.util.concurrent=ALL-UNNAMED')
}

task kitSdkJavadocs(type: Javadoc) {
include {
String filePath = it.toString()
Expand Down
4 changes: 4 additions & 0 deletions kit-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ dependencies {
testImplementation 'junit:junit:4.13.2'
}

tasks.withType(Test) {
jvmArgs('--add-opens=java.base/java.lang=ALL-UNNAMED')
}

task generateJavadocsJar(type: Jar, dependsOn: groovydoc) {
archiveClassifier.set("javadoc")
from groovydoc.destinationDir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ class KitPlugin implements Plugin<Project> {
androidLib.buildTypes.release.minifyEnabled false
androidLib.buildTypes.release.consumerProguardFiles 'consumer-proguard.pro'
androidLib.lintOptions.abortOnError true
androidLib.testOptions.unitTests.all { jvmArgs += ['--add-opens', 'java.base/java.lang=ALL-UNNAMED']
jvmArgs += ['--add-opens', 'java.base/java.lang.reflect=ALL-UNNAMED']
jvmArgs += ['--add-opens', 'java.base/java.util=ALL-UNNAMED']
jvmArgs += ['--add-opens', 'java.base/java.text=ALL-UNNAMED']
jvmArgs += ['--add-opens', 'java.desktop/java.awt.font=ALL-UNNAMED']
jvmArgs += ['--add-opens', 'java.base/java.util.concurrent=ALL-UNNAMED'] }


//formerly in maven.gradle
target.apply(plugin: 'maven-publish')
Expand Down

0 comments on commit b67c108

Please sign in to comment.