Skip to content
This repository was archived by the owner on Jul 16, 2024. It is now read-only.

Commit

Permalink
Allow to write custom FlankRun tasks (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
CristianGM authored May 5, 2022
1 parent 8032371 commit 8406815
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 22 deletions.
40 changes: 23 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,12 @@ plugins {
}
```

add your firebase credentials to the rootroject as `ftl-credentials.json`
add your firebase credentials to the rootproject as `ftl-credentials.json`

That's it, run `./gradlew runFlank` and get the results.

# Optional configuration

## Changing the buildType to run

Android already provides a way for you to do it:
```
android {
...
testBuildType = "beta"
...
}
```

## Changing the credentials file

```
Expand All @@ -50,11 +39,6 @@ simpleFlank {
}
```

## debugging shards

`./gradlew runFlank -PdumpShards=true`


## changing Flank version

```
Expand All @@ -66,3 +50,25 @@ dependencies {
## Orchestrator

`simple-flank` will configure it automatically if you are using "ANDROIDX_TEST_ORCHESTRATOR"


# FAQ

## Can I change the buildType to run?

Android already provides a way for you to do it:
```
android {
...
testBuildType = "beta"
...
}
```

## How to debug shards?

`./gradlew runFlank -PdumpShards=true`

## What if I want to use a different flank config?

Feel free to [create your own task](docs/manual_tasks_creation.md) and provide the config yaml you want.
25 changes: 25 additions & 0 deletions docs/manual_tasks_creation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Creating test tasks manually

tasks.register<FlankRunTask>("myFlankRunTask") {
// `flankExecutable` is the configuration cotaining flank dependency
flankJarClasspath.from(flankExecutable)

// Set the credentials file
serviceAccountCredentials.set(...)

// Any string you want to use, usually the variant we are testing
// It will be used in the path to store the results in your build: "build/flank/$variant"
variant.set(...)

// The flank yaml file, it can be the output of a task or a file you created manually for example.
// It's important that you use relative paths to your apks if you wan't it to be cacheable
flankYaml.set(...)

// Do you want your task to be cacheable? defaults to false
hermeticTests.set(true)

// Set any Provider<RegularFile> that will provide the APKs
// Must be the same you used for the yaml
appApk(...)
testApk(...)
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ abstract class FlankDoctorTask : BaseFlankApkTask() {
.javaexec {
classpath = flankJarClasspath
mainClass.set("ftl.Main")
args = listOf("firebase", "test", "android", "doctor")
workingDir(projectLayout.buildDirectory.dir("flank/${variant.get()}").get().asFile)
args = listOf("firebase", "test", "android", "doctor", "-c=${flankYaml.get()}")
workingDir(projectLayout.buildDirectory.dir("flank/${variant.get()}").get())
}
.assertNormalExitValue()
}
Expand Down
5 changes: 2 additions & 3 deletions src/main/kotlin/io/github/flank/gradle/tasks/FlankRunTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,8 @@ abstract class FlankRunTask : BaseFlankApkTask() {
.javaexec {
classpath = flankJarClasspath
mainClass.set("ftl.Main")
environment(
mapOf("GOOGLE_APPLICATION_CREDENTIALS" to serviceAccountCredentials.get().asFile))
args = listOf("firebase", "test", "android", "run")
environment(mapOf("GOOGLE_APPLICATION_CREDENTIALS" to serviceAccountCredentials.get()))
args = listOf("firebase", "test", "android", "run", "-c=${flankYaml.get()}")
if (dumpShards.get()) args("--dump-shards")
if (dry.get()) args("--dry")

Expand Down

0 comments on commit 8406815

Please sign in to comment.