Skip to content

Commit

Permalink
Merge branch 'main' into test/ios
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekpacia committed Aug 6, 2024
2 parents 1e2c631 + 4a2ae34 commit 5cfbc75
Show file tree
Hide file tree
Showing 19 changed files with 161 additions and 129 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ on:
- 'v*'

env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_ACCESS_TOKEN_USER }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_ACCESS_TOKEN_PASSWORD }}

jobs:
publish:
Expand Down Expand Up @@ -78,4 +78,4 @@ jobs:
if: ${{ !endsWith(env.VERSION_NAME, '-SNAPSHOT') }}
env:
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
73 changes: 73 additions & 0 deletions .github/workflows/test-e2e-prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Test E2E (prod)

on:
workflow_dispatch:
schedule:
- cron: '0 * * * *'

jobs:
test-cloud-production:
# this job is the same as e2e-production in mobile-dev-inc/monorepo
runs-on: ubuntu-latest
if: github.repository == 'mobile-dev-inc/maestro'

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Set up JDK 8
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 8

- name: Install Maestro
run: |
curl -Ls --retry 3 --retry-all-errors "https://get.maestro.mobile.dev" | bash
echo "${HOME}/.maestro/bin" >> $GITHUB_PATH
- name: Print Maestro version
run: maestro --version

- name: Download samples
run: maestro download-samples

- name: Run iOS test
run: |
maestro cloud \
--apiKey ${{ secrets.E2E_MOBILE_DEV_API_KEY }} \
--timeout 180 \
--fail-on-cancellation \
--include-tags=advanced
samples/sample.zip samples
- name: Run Android test
run: |
maestro cloud \
--apiKey ${{ secrets.E2E_MOBILE_DEV_API_KEY }} \
--fail-on-cancellation \
--include-tags advanced \
samples/sample.apk samples
- name: Trigger alert on failure
if: ${{ false }}
# if: failure()
run: |
curl --request POST \
--url "https://events.pagerduty.com/v2/enqueue" \
--header 'Content-Type: application/json' \
--data '{
"payload": {
"summary": "E2E test failed",
"source": "E2E test",
"severity": "critical"
},
"routing_key": "${{ secrets.E2E_PAGER_DUTY_INTEGRATION_KEY }}",
"event_action": "trigger",
"links": [
{
"href": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"text": "Failed E2E test - Github Action"
}
]
}'
60 changes: 3 additions & 57 deletions .github/workflows/e2e.yaml → .github/workflows/test-e2e.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: E2E test
name: Test E2E

on:
workflow_dispatch:
Expand Down Expand Up @@ -180,7 +180,7 @@ jobs:
- name: Run iOS test
run: |
maestro cloud \
--apiKey=${{secrets.E2E_MOBILE_DEV_API_KEY}} \
--apiKey ${{ secrets.E2E_MOBILE_DEV_API_KEY }} \
--timeout 180 \
--fail-on-cancellation \
--include-tags advanced \
Expand All @@ -190,62 +190,8 @@ jobs:
- name: Run Android test
run: |
maestro cloud \
--apiKey ${{secrets.E2E_MOBILE_DEV_API_KEY}} \
--apiKey ${{ secrets.E2E_MOBILE_DEV_API_KEY }} \
--fail-on-cancellation \
--include-tags advanced \
samples/sample.apk \
samples
test-cloud-production:
# this job is the same as e2e-production in mobile-dev-inc/monorepo
runs-on: ubuntu-latest

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Set up JDK 8
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 8

- name: Install Maestro
run: |
curl -Ls --retry 3 --retry-all-errors "https://get.maestro.mobile.dev" | bash
echo "${HOME}/.maestro/bin" >> $GITHUB_PATH
- name: Print Maestro version
run: maestro --version

- name: Download samples
run: maestro download-samples

- name: Run iOS test
run: |
maestro cloud --apiKey=${{secrets.E2E_MOBILE_DEV_API_KEY}} --timeout=180 --fail-on-cancellation --include-tags=advanced samples/sample.zip samples
- name: Run Android test
run: |
maestro cloud --apiKey=${{secrets.E2E_MOBILE_DEV_API_KEY}} --fail-on-cancellation --include-tags=advanced samples/sample.apk samples
- name: Trigger alert on failure
if: ${{ false }}
# if: failure()
run: |
curl --request POST \
--url "https://events.pagerduty.com/v2/enqueue" \
--header 'Content-Type: application/json' \
--data '{
"payload": {
"summary": "E2E test failed",
"source": "E2E test",
"severity": "critical"
},
"routing_key": "${{ secrets.E2E_PAGER_DUTY_INTEGRATION_KEY }}",
"event_action": "trigger",
"links": [
{
"href": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"text": "Failed E2E test - Github Action"
}
]
}'
8 changes: 8 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,11 @@
1. Trigger the [Publish CLI Github action](https://github.com/mobile-dev-inc/maestro/actions/workflows/publish-cli.yml)
2. Test installing the cli by running `curl -Ls "https://get.maestro.mobile.dev" | bash`
3. Check the version number `maestro --version`

## Publish Maven Central

1. Trigger the [Publish Release action](https://github.com/mobile-dev-inc/maestro/actions/workflows/publish-release.yml)
- ATTENTION: Wait for it to finish
3. Go to [OSS Sonatype](https://s01.oss.sonatype.org/) and login with user/password
4. Go to Staging Repositories, select the repository uploaded from the trigger above.
5. Click "Close" and then "Release". Each of these operations take a couple minutes to complete
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.android.application) apply false
alias(libs.plugins.google.protobuf) apply false
alias(libs.plugins.vanniktech.publish)
alias(libs.plugins.protobuf) apply false
alias(libs.plugins.mavenPublish)
alias(libs.plugins.detekt)
}

Expand All @@ -17,4 +17,4 @@ detekt {
allRules = false
autoCorrect = true
config = files("${rootDir}/detekt.yml")
}
}
22 changes: 16 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# How to sort with AS:
# "Select all in block" -> "Edit" -> "Sort lines"

# File should follow the naming convention:
# https://blog.gradle.org/best-practices-naming-version-catalog-entries

[versions]
androidPlugin = "4.2.1"
androidxEspresso = "3.4.0"
Expand All @@ -12,14 +15,15 @@ apkParser = "2.6.10"
appdirs = "1.2.1"
axml = "2.1.2"
commons-codec = "1.15"
commonsLang3 = "3.13.0"
commons-lang3 = "3.13.0"
commons-io = "2.11.0"
dadb = "1.2.6"
detekt = "1.19.0"
googleFindbugs = "3.0.2"
googleGson = "2.9.0"
googleProtobuf = "3.21.9"
googleProtobufPlugin = "0.9.1"
googleTruth = "1.1.3"
googleTruth = "1.4.2"
graaljs = "22.0.0" # Latest version that supports Java 8
grpc = "1.50.2"
grpcKotlinStub = "1.3.0"
Expand All @@ -34,25 +38,28 @@ kotlinResult = "1.1.14"
ktor = "2.3.6"
mozillaRhino = "1.7.14"
picocli = "4.5.2"
selenium = "4.11.0"
selenium = "4.13.0"
slf4j = "1.7.36"
squareOkhttp = "4.12.0"
squareOkio = "3.8.0"
squareMockWebServer = "4.11.0"
wiremock = "2.35.0"
logback = "1.2.6"
coroutines = "1.6.3"
kotlinx-html = "0.8.0"

[libraries]
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
kotlinx-html = { module = "org.jetbrains.kotlinx:kotlinx-html", version.ref = "kotlinx-html" }
androidx-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "androidxEspresso" }
androidx-test-junit = { module = "androidx.test.ext:junit", version.ref = "androidxTestJunit" }
androidx-uiautomator = { module = "androidx.test.uiautomator:uiautomator", version.ref = "androidxUiautomator" }
apk-parser = { module = "net.dongliu:apk-parser", version.ref = "apkParser" }
appdirs = { module = "net.harawata:appdirs", version.ref = "appdirs" }
axml = { module = "de.upb.cs.swt:axml", version.ref = "axml" }
commons-codec = { module = "commons-codec:commons-codec", version.ref = "commons-codec" }
commons-lang3 = { module = "org.apache.commons:commons-lang3", version.ref = "commonsLang3" }
commons-lang3 = { module = "org.apache.commons:commons-lang3", version.ref = "commons-lang3" }
commons-io = { module = "commons-io:commons-io", version.ref = "commons-io" }
dadb = { module = "dev.mobile:dadb", version.ref = "dadb" }
google-findbugs = { module = "com.google.code.findbugs:jsr305", version.ref = "googleFindbugs" }
google-gson = { module = "com.google.code.gson:gson", version.ref = "googleGson" }
Expand Down Expand Up @@ -106,6 +113,9 @@ logback = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
[plugins]
android-application = { id = "com.android.application", version.ref = "androidPlugin" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
google-protobuf = { id = "com.google.protobuf", version.ref = "googleProtobufPlugin" }
protobuf = { id = "com.google.protobuf", version.ref = "googleProtobufPlugin" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
vanniktech-publish = { id = "com.vanniktech.maven.publish", version = "0.19.0" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
mavenPublish = { id = "com.vanniktech.maven.publish", version = "0.19.0" }
jreleaser = { id = "org.jreleaser", version = "1.13.1" }
shadow = { id = "com.github.johnrengelman.shadow", version = "7.1.2" }
12 changes: 6 additions & 6 deletions maestro-cli/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import org.jreleaser.model.Active.ALWAYS
import org.jreleaser.model.Stereotype
import java.util.Properties

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
kotlin("jvm")
application
id("org.jreleaser") version "1.13.1"
id("com.github.johnrengelman.shadow") version "7.1.2"
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.jreleaser)
alias(libs.plugins.shadow)
}

group = "dev.mobile"
Expand All @@ -30,7 +31,6 @@ tasks.named<JavaExec>("run") {
}

dependencies {
val kotlinxHtmlVersion = "0.8.0"
implementation(project(path = ":maestro-utils"))
annotationProcessor(libs.picocli.codegen)

Expand All @@ -53,7 +53,7 @@ dependencies {
implementation(libs.jarchivelib)
implementation(libs.commons.codec)
implementation(libs.kotlinx.coroutines.core)
implementation("org.jetbrains.kotlinx:kotlinx-html:$kotlinxHtmlVersion")
implementation(libs.kotlinx.html)

testImplementation(libs.junit.jupiter.api)
testRuntimeOnly(libs.junit.jupiter.engine)
Expand Down Expand Up @@ -133,7 +133,7 @@ jreleaser {
content.set("""
[See changelog in the CHANGELOG.md file][link]
[link]: https://github.com/mobile-dev-inc/maestro/blob/main/CHANGELOG.md#{{versionHeader}}
[link]: https://github.com/mobile-dev-inc/maestro/blob/main/CHANGELOG.md#{{changelogVersionHeader}}
""".trimIndent()
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package maestro.cli.report

import maestro.cli.model.TestExecutionSummary
import maestro.cli.report.TestDebugReporter
import okio.Sink
import okio.buffer
import java.io.BufferedReader
import java.io.FileReader
import kotlinx.html.*
import kotlinx.html.stream.appendHTML

Expand All @@ -30,7 +27,8 @@ class HtmlTestSuiteReporter : TestSuiteReporter {
}

private fun buildHtmlReport(summary: TestExecutionSummary): String {
var failedTest = getFailedTest(summary)
val failedTest = getFailedTest(summary)

return buildString {
appendHTML().html {
head {
Expand Down Expand Up @@ -75,7 +73,7 @@ class HtmlTestSuiteReporter : TestSuiteReporter {
br{}
p(classes = "card-text") {
failedTest.forEach { test ->
+"${test}"
+test
br{}
}
}
Expand All @@ -87,18 +85,18 @@ class HtmlTestSuiteReporter : TestSuiteReporter {
div(classes = "card mb-4") {
div(classes = "card-header") {
h5(classes = "mb-0") {
button(classes = "$buttonClass") {
button(classes = buttonClass) {
attributes["type"] = "button"
attributes["data-bs-toggle"] = "collapse"
attributes["data-bs-target"] = "#${flow.name}"
attributes["aria-expanded"] = "false"
attributes["aria-controls"] = "${flow.name}"
attributes["aria-controls"] = flow.name
+"${flow.name} : ${flow.status}"
}
}
}
div(classes = "collapse") {
id = "${flow.name}"
id = flow.name
div(classes = "card-body") {
p(classes = "card-text") {
+"Status: ${flow.status}"
Expand All @@ -109,7 +107,7 @@ class HtmlTestSuiteReporter : TestSuiteReporter {
}
if(flow.failure != null) {
p(classes = "card-text text-danger"){
+"${flow.failure.message}"
+flow.failure.message
}
}
}
Expand All @@ -124,4 +122,4 @@ class HtmlTestSuiteReporter : TestSuiteReporter {
}
}
}
}
}
9 changes: 4 additions & 5 deletions maestro-client/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
plugins {
id 'maven-publish'
id "kotlin"
id "idea"
id "com.vanniktech.maven.publish"
id "com.google.protobuf"
id("maven-publish")
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.mavenPublish)
alias(libs.plugins.protobuf)
}

protobuf {
Expand Down
Loading

0 comments on commit 5cfbc75

Please sign in to comment.