-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: sauce-visual-bot <[email protected]>
- Loading branch information
Showing
6 changed files
with
85 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Sauce Labs Visual for Espresso | ||
|
||
Sauce Labs Visual for Espresso exposes Sauce Labs Visual Testing for your Android apps. | ||
|
||
## Installation & Usage | ||
|
||
View installation and usage instructions on the [Sauce Docs website](https://docs.saucelabs.com/visual-testing/integrations/espresso/). | ||
|
||
## Building | ||
|
||
Sauce Visual Java SDK uses [Gradle](https://gradle.org/). | ||
|
||
`gradlew` binary, that is included in the source, can be used as a replacement if you don't have Maven. | ||
|
||
You'll also need [Android command line tools](https://developer.android.com/tools/). | ||
|
||
It can be setup either using [Android Studio](https://developer.android.com/studio) or using [homebrew](https://formulae.brew.sh/cask/android-commandlinetools). | ||
|
||
```sh | ||
./gradlew build | ||
``` | ||
|
||
## Running the tests | ||
|
||
To run the smoke test you'll need a running Android Emulator. | ||
|
||
You can either start an emulator from Android Studio or using [command line](https://developer.android.com/studio/run/emulator-commandline). | ||
|
||
Then you can run the smoke test using the following command. Make sure that SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables | ||
are in place before running the test. | ||
|
||
```sh | ||
./gradlew connectedAndroidTest | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import com.vanniktech.maven.publish.AndroidSingleVariantLibrary | ||
import com.vanniktech.maven.publish.SonatypeHost | ||
|
||
plugins { | ||
alias libs.plugins.android.library | ||
alias libs.plugins.apollographql | ||
id 'maven-publish' | ||
id 'signing' | ||
alias libs.plugins.vanniktech.maven.publish | ||
} | ||
|
||
android { | ||
|
@@ -12,7 +14,7 @@ android { | |
defaultConfig { | ||
minSdk 21 | ||
versionCode 1 | ||
versionName "0.0.0" | ||
versionName "0.0.1" | ||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
consumerProguardFiles "consumer-rules.pro" | ||
|
||
|
@@ -27,16 +29,12 @@ android { | |
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_11 | ||
targetCompatibility JavaVersion.VERSION_11 | ||
} | ||
publishing { | ||
singleVariant("release") { | ||
withSourcesJar() | ||
withJavadocJar() | ||
} | ||
} | ||
|
||
buildFeatures { | ||
buildConfig = true | ||
} | ||
|
@@ -73,53 +71,34 @@ ext { | |
artifactName = 'visual-espresso' | ||
} | ||
|
||
publishing { | ||
publications { | ||
release(MavenPublication) { | ||
groupId = android.namespace | ||
artifactId = "${artifactName}" | ||
version = android.defaultConfig.versionName | ||
afterEvaluate { | ||
from components.release | ||
} | ||
pom { | ||
name = "${artifactName}" | ||
description = 'Sauce Visual Espresso SDK' | ||
url = 'https://github.com/saucelabs/visual-sdks' | ||
scm { | ||
connection = "scm:git:${scmUrl}" | ||
developerConnection = "scm:git:${scmUrl}" | ||
url = "${scmUrl}" | ||
} | ||
licenses { | ||
license { | ||
name = 'Apache-2.0' | ||
url = 'https://github.com/saucelabs/visual-sdks/blob/main/LICENSE' | ||
} | ||
} | ||
developers { | ||
developer { | ||
name = 'Sauce Labs Visual Team' | ||
email = '[email protected]' | ||
organization = 'Sauce Labs' | ||
organizationUrl = 'https://saucelabs.com/' | ||
} | ||
} | ||
mavenPublishing { | ||
configure(new AndroidSingleVariantLibrary("release", true, true)) | ||
publishToMavenCentral(SonatypeHost.DEFAULT) | ||
signAllPublications() | ||
coordinates(android.namespace, "${artifactName}", android.defaultConfig.versionName) | ||
|
||
pom { | ||
name = "${artifactName}" | ||
description = 'Sauce Visual Espresso SDK' | ||
url = 'https://github.com/saucelabs/visual-sdks' | ||
scm { | ||
connection = "scm:git:${scmUrl}" | ||
developerConnection = "scm:git:${scmUrl}" | ||
url = "${scmUrl}" | ||
} | ||
licenses { | ||
license { | ||
name = 'Apache-2.0' | ||
url = 'https://github.com/saucelabs/visual-sdks/blob/main/LICENSE' | ||
} | ||
} | ||
} | ||
repositories { | ||
mavenLocal() | ||
} | ||
} | ||
|
||
nexusPublishing { | ||
repositories { | ||
sonatype { | ||
nexusUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") | ||
snapshotRepositoryUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/") | ||
username = project.findProperty("ossrhUsername") ?: System.getenv("OSSRH_USERNAME") | ||
password = project.findProperty("ossrhPassword") ?: System.getenv("OSSRH_PASSWORD") | ||
developers { | ||
developer { | ||
name = 'Sauce Labs Visual Team' | ||
email = '[email protected]' | ||
organization = 'Sauce Labs' | ||
organizationUrl = 'https://saucelabs.com/' | ||
} | ||
} | ||
} | ||
} | ||
|
@@ -132,26 +111,17 @@ apollo { | |
} | ||
} | ||
|
||
signing { | ||
useInMemoryPgpKeys( | ||
project.findProperty("signingKey") ?: System.getenv("GPG_PRIVATE_KEY"), | ||
project.findProperty("signingPassword") ?: System.getenv("GPG_PASSPHRASE") | ||
) | ||
sign publishing.publications | ||
} | ||
|
||
tasks.register('bumpVersion') { | ||
doLast { | ||
def releaseType = project.hasProperty("releaseType") ? project.releaseType : null | ||
if (!releaseType) { | ||
throw new GradleException("Please provide a release type using -PreleaseType=<major|minor|patch>") | ||
} | ||
|
||
def currentVersionName = android.defaultConfig.versionName | ||
def newVersionName = calculateNewVersion(currentVersionName, releaseType) | ||
persistVersionName(newVersionName) | ||
def newVersion = calculateNewVersion(android.defaultConfig.versionName, releaseType) | ||
persistNewVersion(newVersion) | ||
|
||
println "$newVersionName" | ||
print "$newVersion" | ||
} | ||
} | ||
|
||
|
@@ -182,8 +152,8 @@ static def calculateNewVersion(currentVersion, releaseType) { | |
return "$major.$minor.$patch" | ||
} | ||
|
||
def persistVersionName(newVersionName) { | ||
def persistNewVersion(newVersion) { | ||
def buildFile = file("build.gradle") | ||
def buildFileContent = buildFile.text.replaceAll(/versionName\s+"[^"]+"/, "versionName \"$newVersionName\"") | ||
def buildFileContent = buildFile.text.replaceAll(/versionName\s+"[^"]+"/, "versionName \"$newVersion\"") | ||
buildFile.text = buildFileContent | ||
} |