forked from ReactiveCircus/FlowBinding
-
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.
- Loading branch information
1 parent
d04f560
commit ae343fd
Showing
7 changed files
with
144 additions
and
100 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,91 @@ | ||
name: Build | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
CI: true | ||
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dkotlin.incremental=false | ||
TERM: dumb | ||
|
||
jobs: | ||
assemble: | ||
name: Assemble | ||
runs-on: ubuntu-latest | ||
env: | ||
JAVA_TOOL_OPTIONS: -Xmx4g | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: gradle/wrapper-validation-action@v1 | ||
# TODO remove the following once android-30 platform is pre-installed in GitHub Actions VMs | ||
- name: Install android-30 platform | ||
run: | | ||
sudo chown $USER:$USER $ANDROID_HOME -R | ||
$ANDROID_HOME/tools/bin/sdkmanager --install "platforms;android-30" > /dev/null | ||
- uses: actions/setup-java@v1 | ||
with: | ||
java-version: 14 | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }} | ||
- run: | | ||
./gradlew assemble | ||
checks: | ||
name: Checks (unit tests and static analysis) | ||
runs-on: ubuntu-latest | ||
env: | ||
JAVA_TOOL_OPTIONS: -Xmx4g | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: gradle/wrapper-validation-action@v1 | ||
# TODO remove the following once android-30 platform is pre-installed in GitHub Actions VMs | ||
- name: Install android-30 platform | ||
run: | | ||
sudo chown $USER:$USER $ANDROID_HOME -R | ||
$ANDROID_HOME/tools/bin/sdkmanager --install "platforms;android-30" > /dev/null | ||
- uses: actions/setup-java@v1 | ||
with: | ||
java-version: 14 | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }} | ||
- run: | | ||
./gradlew check -PslimTests | ||
deploy-snapshot: | ||
name: Deploy snapshot | ||
needs: [assemble, checks] | ||
if: github.ref == 'refs/heads/main' | ||
runs-on: ubuntu-latest | ||
env: | ||
JAVA_TOOL_OPTIONS: -Xmx4g | ||
ORG_GRADLE_PROJECT_SONATYPE_NEXUS_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | ||
ORG_GRADLE_PROJECT_SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: gradle/wrapper-validation-action@v1 | ||
# TODO remove the following once android-30 platform is pre-installed in GitHub Actions VMs | ||
- name: Install android-30 platform | ||
run: | | ||
sudo chown $USER:$USER $ANDROID_HOME -R | ||
$ANDROID_HOME/tools/bin/sdkmanager --install "platforms;android-30" > /dev/null | ||
- uses: actions/setup-java@v1 | ||
with: | ||
java-version: 14 | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }} | ||
- run: | | ||
./gradlew clean androidSourcesJar androidJavadocsJar uploadArchives --no-daemon --no-parallel |
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
37 changes: 37 additions & 0 deletions
37
buildSrc/src/main/kotlin/reactivecircus/flowbinding/SlimTests.kt
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,37 @@ | ||
package reactivecircus.flowbinding | ||
|
||
import com.android.build.gradle.LibraryExtension | ||
import com.android.build.gradle.internal.dsl.BaseAppModuleExtension | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.findByType | ||
import org.gradle.language.nativeplatform.internal.BuildType | ||
|
||
/** | ||
* When the "slimTests" project property is provided, disable the unit test tasks | ||
* on `release` build type to avoid running the same tests repeatedly | ||
* in different build variants. | ||
* | ||
* Examples: | ||
* `./gradlew test -PslimTests` will run unit tests for `debug` build variants | ||
* in Android App and Library projects, and all tests in JVM projects. | ||
*/ | ||
@Suppress("UnstableApiUsage") | ||
internal fun Project.configureSlimTests() { | ||
if (providers.gradleProperty(SLIM_TESTS_PROPERTY).forUseAtConfigurationTime().isPresent) { | ||
// disable unit test tasks on the release build type for Android Library projects | ||
extensions.findByType<LibraryExtension>()?.run { | ||
onVariants.withBuildType(BuildType.RELEASE.name) { | ||
unitTest { enabled = false } | ||
} | ||
} | ||
|
||
// disable unit test tasks on the release build type for Android Application projects. | ||
extensions.findByType<BaseAppModuleExtension>()?.run { | ||
onVariants.withBuildType(BuildType.RELEASE.name) { | ||
unitTest { enabled = false } | ||
} | ||
} | ||
} | ||
} | ||
|
||
private const val SLIM_TESTS_PROPERTY = "slimTests" |