From f660c87900dca6593b13b06c9b4a234765b2b2a7 Mon Sep 17 00:00:00 2001 From: Sergey Chelombitko Date: Wed, 31 Jul 2024 17:02:01 +0100 Subject: [PATCH 1/2] Include plugin build in the sample project --- .github/workflows/ci.yml | 4 ++-- sample/gradle.properties | 3 +-- sample/settings.gradle | 6 ++++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4d73a2026..a88747789 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,6 +26,6 @@ jobs: restore-keys: | ${{ runner.os }}-gradle- - name: Build - run: ./gradlew build publishAllPublicationsToLocalRepository + run: ./gradlew build - name: Build sample - run: ./gradlew -p sample marathonDebugAndroidTest --dry-run + run: ./gradlew -p sample marathon --dry-run diff --git a/sample/gradle.properties b/sample/gradle.properties index 94f6abb87..fff179c40 100644 --- a/sample/gradle.properties +++ b/sample/gradle.properties @@ -1,5 +1,4 @@ android.useAndroidX=true -androidPluginVersion=8.5.0 +androidPluginVersion=8.5.1 kotlinVersion=1.9.24 -marathonVersion=0.5.4-SNAPSHOT diff --git a/sample/settings.gradle b/sample/settings.gradle index a3183304d..d7b52898b 100644 --- a/sample/settings.gradle +++ b/sample/settings.gradle @@ -9,8 +9,9 @@ pluginManagement { id "com.android.application" version "$androidPluginVersion" id "com.android.library" version "$androidPluginVersion" id "org.jetbrains.kotlin.android" version "$kotlinVersion" - id "marathon" version "$marathonVersion" } + + includeBuild("..") } dependencyResolutionManagement { @@ -20,6 +21,7 @@ dependencyResolutionManagement { } } -rootProject.name = "multi-module" +rootProject.name = "sample" + include ":app" include ":library" From 2ffe74c6da04056bc3e04c074f03680d9535997d Mon Sep 17 00:00:00 2001 From: Sergey Chelombitko Date: Wed, 31 Jul 2024 17:52:33 +0100 Subject: [PATCH 2/2] Simplify deployment --- .buildsystem/deploy-sonatype.sh | 30 ---------------- README.md | 13 +++---- build.gradle.kts | 37 +++++++++---------- buildSrc/src/main/kotlin/Deployment.kt | 49 +++----------------------- sample/settings.gradle | 4 +-- settings.gradle.kts | 11 +++++- 6 files changed, 40 insertions(+), 104 deletions(-) delete mode 100755 .buildsystem/deploy-sonatype.sh diff --git a/.buildsystem/deploy-sonatype.sh b/.buildsystem/deploy-sonatype.sh deleted file mode 100755 index 51e7af64c..000000000 --- a/.buildsystem/deploy-sonatype.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash -cd $(dirname $0)/.. - - -if [ -z "$SONATYPE_USERNAME" ]; then - echo "error: please set SONATYPE_USERNAME environment variable" - exit 1 -fi - -if [ -z "$SONATYPE_PASSWORD" ]; then - echo "error: please set SONATYPE_PASSWORD environment variable" - exit 1 -fi - -if [ -z "$GPG_PASSPHRASE" ]; then - echo "error: please set GPG_PASSPHRASE environment variable" - exit 1 -fi - -DTASK=":publishDefaultPublicationToOSSHRRepository" - -TARGETS=":core$DTASK :vendor:vendor-android$DTASK :marathon-gradle-plugin$DTASK :report:execution-timeline$DTASK :report:html-report$DTASK" - -if [ -z "$TRAVIS_TAG" ]; then - echo "not on a tag -> deploy snapshot version" - ./gradlew $TARGETS -PreleaseMode=SNAPSHOT -else - echo "on a tag -> deploy release version $TRAVIS_TAG" - ./gradlew $TARGETS -PreleaseMode=RELEASE -fi diff --git a/README.md b/README.md index fbe9bd8b3..45cc7582b 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,20 @@ # Marathon -Cross-platform test runner for Android projects +Test runner for Android projects ## Main focus - **stability** of test execution adjusting for flakiness in the environment and in the tests. - **performance** using high parallelization (handling dozens of devices) -## Documentation -Please check the official [documentation](https://malinskiy.github.io/marathon/) for installation, configuration and more - -
- ### Testing Local Changes If you want to make a small update and test it locally before pushing a branch, you can follow these steps: - make sure you have been grated access to the repo -- clone the repo on your local machine and do a build ```./gradlew clean assemble``` +- clone the repo on your local machine and build ```./gradlew build``` - make your changes and verify that the tests pass - deploy to local maven with ```./gradlew publishToMavenLocal -PreleaseMode=SNAPSHOT``` -- to use the artifact in your other Repo, make sure you set `mavenLocal()` before other repositories in your buildScript node in settings.gradle +- to use the artifact in your other Repo, make sure you set `mavenLocal()` before other repositories in your `pluginManagement` node in settings.gradle - to check that the deploy stage was successful, check the pom file in your local maven directory (e.g. `vim ~/.m2/repository/marathon/marathon.gradle.plugin/0.5.4-SNAPSHOT/marathon.gradle.plugin-0.5.4-SNAPSHOT.pom`) -- note that the artifact name to import will begin with "com.malinskiy.marathon" (e.g. ```implementation "com.malinskiy.marathon:marathon-gradle-plugin:0.5.4-SNAPSHOT"```) +- note that the artifact name to import will begin with "com.github.badoo.marathon" (e.g. ```implementation "com.github.badoo.marathon:marathon-gradle-plugin:0.5.4-SNAPSHOT"```) License ------- diff --git a/build.gradle.kts b/build.gradle.kts index 0f322bb92..5dd48a1c8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,5 @@ import io.gitlab.arturbosch.detekt.extensions.DetektExtension +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -17,32 +18,32 @@ configure { } allprojects { - group = "com.malinskiy.marathon" + group = "com.github.badoo.marathon" - repositories { - mavenCentral() - google() - maven { url = uri("https://jitpack.io") } + plugins.withId("org.jetbrains.kotlin.jvm") { + dependencies.add("implementation", dependencies.platform(Libraries.kotlinBom)) + dependencies.add("implementation", dependencies.platform(Libraries.kotlinCoroutinesBom)) } - project.plugins.withId("org.jetbrains.kotlin.jvm") { - project.dependencies.add("implementation", project.dependencies.platform(Libraries.kotlinBom)) - project.dependencies.add("implementation", project.dependencies.platform(Libraries.kotlinCoroutinesBom)) - } - - extensions.findByType()?.run { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 + plugins.withId("java") { + extensions.configure { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + withJavadocJar() + withSourcesJar() + } } - project.tasks.withType().configureEach { - kotlinOptions { - jvmTarget = "17" - freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn" + tasks.withType().configureEach { + compilerOptions { + jvmTarget.set(JvmTarget.JVM_17) + freeCompilerArgs.addAll( + "-opt-in=kotlin.RequiresOptIn" + ) } } } tasks.register("clean") { - delete(project.layout.buildDirectory) + delete(layout.buildDirectory) } diff --git a/buildSrc/src/main/kotlin/Deployment.kt b/buildSrc/src/main/kotlin/Deployment.kt index e87d1a9b9..1bc6fea42 100644 --- a/buildSrc/src/main/kotlin/Deployment.kt +++ b/buildSrc/src/main/kotlin/Deployment.kt @@ -1,32 +1,23 @@ import org.gradle.api.Project -import org.gradle.api.plugins.JavaPluginExtension import org.gradle.api.publish.PublishingExtension import org.gradle.api.publish.maven.MavenPom import org.gradle.api.publish.maven.MavenPublication import org.gradle.kotlin.dsl.configure -import org.gradle.kotlin.dsl.creating +import org.gradle.kotlin.dsl.create import org.gradle.kotlin.dsl.extra import org.gradle.kotlin.dsl.get -import org.gradle.kotlin.dsl.getValue import org.gradle.kotlin.dsl.provideDelegate import org.gradle.kotlin.dsl.the import org.gradle.plugins.signing.SigningExtension import java.net.URI object Deployment { - val user = System.getenv("SONATYPE_USERNAME") - val password = System.getenv("SONATYPE_PASSWORD") val githubUser = System.getenv("GITHUB_MAVEN_USERNAME") val githubPassword = System.getenv("GITHUB_MAVEN_PASSWORD") var releaseMode: String? = null var versionSuffix: String? = null - var deployUrl: String? = null - val snapshotDeployUrl = System.getenv("SONATYPE_SNAPSHOTS_URL") - ?: "https://oss.sonatype.org/content/repositories/snapshots/" - val releaseDeployUrl = System.getenv("SONATYPE_RELEASES_URL") - ?: "https://oss.sonatype.org/service/local/staging/deploy/maven2/" - val githubDeployUrl = "https://maven.pkg.github.com/Malinskiy" + val githubDeployUrl = "https://maven.pkg.github.com/badoo" fun initialize(project: Project) { val releaseMode: String? by project @@ -37,10 +28,6 @@ object Deployment { Deployment.releaseMode = releaseMode Deployment.versionSuffix = versionSuffix - Deployment.deployUrl = when (releaseMode) { - "RELEASE" -> Deployment.releaseDeployUrl - else -> Deployment.snapshotDeployUrl - } initializePublishing(project) initializeSigning(project) @@ -51,40 +38,14 @@ object Deployment { project.plugins.apply("maven-publish") - val javaPlugin = project.the(JavaPluginExtension::class) - - val sourcesJar by project.tasks.creating(org.gradle.api.tasks.bundling.Jar::class) { - archiveClassifier.set("sources") - from(javaPlugin.sourceSets["main"].allSource) - } - val javadocJar by project.tasks.creating(org.gradle.api.tasks.bundling.Jar::class) { - archiveClassifier.set("javadoc") - from(javaPlugin.docsDir) - dependsOn("javadoc") - } - project.configure { publications { - create("default", MavenPublication::class.java) { + create("default") { Deployment.customizePom(project, pom) from(project.components["java"]) - artifact(sourcesJar) - artifact(javadocJar) } } repositories { - maven { - name = "Local" - setUrl("${project.rootDir}/build/repository") - } - maven { - name = "OSSHR" - credentials { - username = Deployment.user - password = Deployment.password - } - url = URI.create(Deployment.deployUrl) - } maven { name = "GitHub" credentials { @@ -116,7 +77,7 @@ object Deployment { fun customizePom(project: Project, pom: MavenPom?) { pom?.apply { name.set(project.name) - url.set("https://github.com/Malinskiy/marathon") + url.set("https://github.com/badoo/marathon") description.set("Android test runner") licenses { @@ -135,7 +96,7 @@ object Deployment { } scm { - url.set("https://github.com/Malinskiy/marathon") + url.set("https://github.com/badoo/marathon") } } } diff --git a/sample/settings.gradle b/sample/settings.gradle index d7b52898b..44e0dd36c 100644 --- a/sample/settings.gradle +++ b/sample/settings.gradle @@ -1,8 +1,8 @@ pluginManagement { repositories { - google() - maven { url "$rootDir/../build/repository" } gradlePluginPortal() + mavenCentral() + google() maven { url "https://jitpack.io" } } plugins { diff --git a/settings.gradle.kts b/settings.gradle.kts index e14d32702..5de6dbe20 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,7 +1,7 @@ pluginManagement { repositories { - maven { url = uri("$rootDir/build/repository") } gradlePluginPortal() + mavenCentral() } plugins { id("org.jetbrains.kotlin.jvm") version "1.9.22" @@ -10,7 +10,16 @@ pluginManagement { } } +dependencyResolutionManagement { + repositories { + mavenCentral() + google() + maven { url = uri("https://jitpack.io") } + } +} + rootProject.name = "marathon" + include("core") include("vendor:vendor-android:base") include("vendor:vendor-android:ddmlib")