Skip to content

Commit

Permalink
Merge pull request #4 from Workday/Travis_CI
Browse files Browse the repository at this point in the history
Travis CI initial script. Restructured modules and added maven deploy…
  • Loading branch information
hujim authored Mar 11, 2019
2 parents 648540d + 8fb2505 commit 21f46e1
Show file tree
Hide file tree
Showing 87 changed files with 237 additions and 223 deletions.
31 changes: 14 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
language: shell

# We use Docker → we need sudo.
sudo: required

services:
- docker

language: java
script:
- ci/build.sh
# https://issues.sonatype.org/browse/OSSRH-38347 Change to auto release or switch repository (jfrog etc.)
#- "./gradlew clean build uploadArchives -s -PNEXUS_USERNAME=$NEXUS_USERNAME -PNEXUS_PASSWORD=$NEXUS_PASSWORD"
- "./gradlew clean build -s"

deploy:
- provider: script
script: PUBLISH=true ci/build.sh
skip_cleanup: true
on:
tags: true

notifications:
email: false
provider: releases
api_key:
secure: DpNBIvTfTo1Ws+H+k4jIuUy6WBWrsjoysndwDZMG9YL+tmm0qRD9nonCTSp4GhsAa/fn1zgh6xAwLsVumh7nnhuEBhKLgJ5KmCL7Xqn6KQ11VNfL0WUVm5lKFvIt8qUzTvL2gysDVEKACOnsaB2pQKiZkop82X0GhweoluUD7jPvEezKSAl+zenKnAniIFutTmSfL6QGELQDMtRC9izR90u6nFKPbCWuLC+SPGHAtCgWci8ILve2Fu3+dkhVRsDz5j61de4/Ywd8mhNZsNuVelRhF1fuBvNTlvZ5yrTAcOsGK++cOLplSCDDknLD4KJW0g+IgesWLMeKiksLHk7s4q3P71zdXKgaJWWYHNT31bIKiw98oWIoys/br+sEBNwIH7uj9+l5QDV7b2rkw3XZJ+6WawVSRU3JPdjQgunlQ5rYF7Yy7Q0gnCC1L4k1zdKRA0sOwk3vOJ+MnfLxS76JpBTUx8HT/ydCyR1NFLuSx0iXBlU5/2UbWYczlhzlxKS6d9Lapd/lP+41bT/OftVB9CQ6//cGR7RdHyZqXITifab8yI/n5w/ByOj91S/rTnm1itMAzN34uj/46BcEFVEZCu449KOm1/xT9EwPSgPjlk/KcY5Hz+iHY+VNd7SYEcG50JqH+e5CFOAW/XlcuipraQ8w8VoeNIR0ho2EyxSmvX0=
file_glob: true
file:
- torque-runner/build/libs/torque-runner-*.jar
skip_cleanup: true
on:
repo: Workday/torque
tags: true
33 changes: 23 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Torque — Reactive Android instrumentation test orchestrator with multi-library-modules-testing and test pooling/grouping support.

[![Build Status](https://travis-ci.org/Workday/torque.svg?branch=master)](https://travis-ci.org/Workday/torque)

Torque is a test orchestrator that aims to support the following features:
* Support running [Android Library Module](https://developer.android.com/studio/projects/android-library) test Apks.
* Parallel test execution on multiple emulators/devices with **pooled** test chunking support.
Expand Down Expand Up @@ -54,10 +56,9 @@ devices available to leverage the pooling.

## Usage

Torque is shipped as jar for now, you can run it directly (you need JVM 1.8+): `java -jar torque-latest-version.jar [options]`.
or
With the Gradle plugin use `torque-gradle-plugin-latest-version.jar`.

Torque can be ran directly (you need JVM 1.8+): `java -jar torque-runner-$torque_version.jar [options]`.
or
With the Gradle plugin

#### Supported options

Expand All @@ -81,15 +82,19 @@ java -jar torque-latest-version.jar \
```

##### Example (Gradle plugin)
In the project's `build.gradle`
```
Add the following lines to your project's `build.gradle` file, replacing `$torque_version` with latest version from Maven Central.
```gradle
repositories {
mavenCentral()
}
dependencies {
implementation files('../torque-gradle-plugin.jar')
implementation files('../torque.jar')
implementation "com.workday:torque-gradle-plugin:$torque_version"
}
```

In App and Library projects that will be tested and would provide test apks.
```
```gradle
apply plugin: 'com.workday.torque'
torque {
variantName "ProdDebug" // Required
Expand All @@ -107,8 +112,16 @@ torque {
`args` is a dsl for applying any optional params from [Args.kt](torque/src/main/kotlin/com/workday/torque/Args.kt), except the apk paths, which are parsed by the plugin, and only followed when the `torqueRun_` task is ran on that project (see below).

When the plugin is applied on an App module, it will create a `torqueRunAll` task which runs tests on all modules (including the App) that have the plugin applied.

When the plugin is applied on a Library module, it will create a `torqueRunLibrary` task which runs tests on just that Library module.

Run all plugin-applied app and library modules' tests, with CoolApp being the App module
```
./gradlew :CoolApp:torqueRunAll
```
Run a specific library module's tests, with CoolLibrary being the Library module
```
./gradlew :CoolLibrary:torqueRunLibrary
```

### How to build

Expand Down
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ allprojects {
repositories {
jcenter()
}
version = VERSION_NAME
group = GROUP

apply plugin: 'com.github.ben-manes.versions'
}
Expand Down
45 changes: 0 additions & 45 deletions ci/build.sh

This file was deleted.

35 changes: 0 additions & 35 deletions ci/docker/Dockerfile

This file was deleted.

15 changes: 0 additions & 15 deletions ci/docker/entrypoint.sh

This file was deleted.

2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ ext.libraries = [
]

ext.internal = [
torque : ":torque",
torqueCore : ":torque-core",
]
13 changes: 13 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
VERSION_NAME=1.0.0
GROUP=com.workday

POM_DESCRIPTION=A Reactive Android instrumentation test orchestrator with multi-library-modules-testing and test pooling/grouping support.
POM_URL=https://github.com/Workday/torque
POM_SCM_URL=https://github.com/Workday/torque
POM_SCM_CONNECTION=scm:[email protected]:Workday/torque.git
POM_SCM_DEV_CONNECTION=scm:[email protected]:Workday/torque.git
POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=hujim
POM_DEVELOPER_NAME=Jim Hu
109 changes: 109 additions & 0 deletions gradle/gradle-mvn-push.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/*
* Copyright 2013 Chris Banes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

apply plugin: 'maven'
apply plugin: 'signing'

def isReleaseBuild() {
return VERSION_NAME.contains("SNAPSHOT") == false
}

def getReleaseRepositoryUrl() {
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
}

def getSnapshotRepositoryUrl() {
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
: "https://oss.sonatype.org/content/repositories/snapshots/"
}

def getRepositoryUsername() {
return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
}

def getRepositoryPassword() {
return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
}

afterEvaluate { project ->
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

pom.groupId = GROUP
pom.artifactId = POM_ARTIFACT_ID
pom.version = VERSION_NAME

repository(url: getReleaseRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}
snapshotRepository(url: getSnapshotRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}

pom.project {
name POM_NAME
packaging POM_PACKAGING
description POM_DESCRIPTION
url POM_URL

scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEV_CONNECTION
}

licenses {
license {
name POM_LICENCE_NAME
url POM_LICENCE_URL
distribution POM_LICENCE_DIST
}
}

developers {
developer {
id POM_DEVELOPER_ID
name POM_DEVELOPER_NAME
}
}
}
}
}
}

signing {
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives sourcesJar
archives javadocJar
}
}
3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
include ':torque'
include ':torque-core'
include ':torque-gradle-plugin'
include ':torque-runner'
43 changes: 43 additions & 0 deletions torque-core/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apply plugin: 'kotlin'
apply plugin: 'org.junit.platform.gradle.plugin'
apply from: file('../gradle/gradle-mvn-push.gradle')

dependencies {
implementation libraries.kotlinStd
implementation libraries.kotlinReflect
implementation libraries.rxJava
implementation libraries.rxJava2
implementation libraries.rxJava2Interop
implementation libraries.jCommander
implementation(libraries.commanderOs) {
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-runtime'
}
implementation(libraries.commanderAndroid) {
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-runtime'
}
implementation libraries.apacheCommonsIo
implementation libraries.apacheCommonsLang
implementation libraries.gson
implementation libraries.dexParser
implementation libraries.kotlinCoroutines
implementation libraries.kotlinCoroutinesRx2
}

dependencies {
testImplementation libraries.spek
testImplementation libraries.junitPlatformRunner
testImplementation libraries.spekJunitPlatformEngine
testImplementation libraries.assertJ
testImplementation libraries.kotlinJunit
testImplementation libraries.mockk
}

junitPlatform {
platformVersion = versions.junitPlatform

filters {
engines {
include 'spek'
}
}
}
4 changes: 4 additions & 0 deletions torque-core/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
POM_ARTIFACT_ID=torque-core
POM_NAME=Torque Core
POM_PACKAGING=jar
POM_DESCRIPTION=Torque core library
Loading

0 comments on commit 21f46e1

Please sign in to comment.