Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
e735c4f
Update dependency org.jetbrains.kotlinx:kotlinx-serialization-json to…
renovate[bot] Jun 27, 2023
155cbfe
Merge pull request #1060 from square/renovate/kotlinx.serialization.json
RBusarow Jun 27, 2023
9e9c491
Update dependency io.mockk:mockk to v1.13.5
renovate[bot] Jun 27, 2023
53313bf
Merge pull request #1057 from square/renovate/mockk
RBusarow Jun 27, 2023
7e26652
Update dependency org.jetbrains.kotlinx:atomicfu to v0.21.0
renovate[bot] Jun 27, 2023
934949d
Merge pull request #1058 from square/renovate/kotlinx.atomicfu
RBusarow Jun 27, 2023
8e99245
use delegating shard tasks for `connectedCheck`
RBusarow Jun 14, 2023
b44638f
Hash all source files for cache keys, and retry progressively smaller…
RBusarow Jun 27, 2023
0c0cbb3
add caching support for AVDs
RBusarow Jun 27, 2023
00a2ef0
Merge pull request #1025 from square/rick/connected_check_shards
RBusarow Jun 28, 2023
1065080
Update robolectric to v4.10.3
renovate[bot] Jun 28, 2023
118fe2e
Merge pull request #1062 from square/renovate/robolectric
RBusarow Jun 28, 2023
2c515f9
Update dependency org.mockito:mockito-core to v3.12.4
renovate[bot] Jun 28, 2023
2bcdc9b
Merge pull request #1061 from square/renovate/mockito-monorepo
RBusarow Jun 28, 2023
9e38ca2
Update dependency com.google.truth:truth to v1.1.5
renovate[bot] Jun 28, 2023
a4a696c
Merge pull request #1004 from square/renovate/truth
RBusarow Jun 28, 2023
ca9e81c
Update squareup.leakcanary to v2.11
renovate[bot] Jun 28, 2023
c8b00c1
Merge pull request #1063 from square/renovate/squareup.leakcanary
RBusarow Jun 28, 2023
240620c
Update dependency androidx.test.ext:truth to v1.5.0
renovate[bot] Jun 28, 2023
c721662
Merge pull request #1052 from square/renovate/androidx.test.truth.ext
RBusarow Jun 28, 2023
d7b38c9
Update dependency androidx.savedstate:savedstate to v1.2.1
renovate[bot] Jun 28, 2023
ff5649b
update dependencyGuard baseline
RBusarow Jun 28, 2023
35fa125
Merge pull request #1051 from square/renovate/androidx.savedstate
RBusarow Jun 28, 2023
f678699
Update dependency app.cash.turbine:turbine to v1
renovate[bot] Jun 28, 2023
c1bab40
add `PR_UPDATE_TOKEN` parameter to auto-fix CI jobs
RBusarow Jun 28, 2023
7975c05
exclude .dex files from caching
RBusarow Jun 28, 2023
65d5d74
Apply changes from dependencyGuardBaseline --refresh-dependencies
RBusarow Jun 28, 2023
43fc0a6
Merge pull request #1069 from square/renovate/major-turbine
RBusarow Jun 28, 2023
802da92
Update squareup.moshi to v1.15.0
renovate[bot] Jun 28, 2023
0bbb782
update dependencyGuard baseline for Moshi
RBusarow Jun 28, 2023
c955c13
Merge pull request #1064 from square/renovate/squareup.moshi
RBusarow Jun 28, 2023
a136289
Update dependency org.jetbrains:annotations to v24
renovate[bot] Jun 28, 2023
8b29aa5
Merge pull request #1071 from square/renovate/major-org.jetbrains
RBusarow Jun 28, 2023
ec5b535
Update vanniktech.publish to v0.25.2
renovate[bot] Jun 28, 2023
32b34f7
Apply changes from dependencyGuardBaseline --refresh-dependencies
renovate[bot] Jun 28, 2023
4be7e1b
Merge pull request #1065 from square/renovate/vanniktech.publish
RBusarow Jun 28, 2023
aeda0ca
Update dependency com.jakewharton.timber:timber to v5
renovate[bot] Jun 28, 2023
2a399fd
Merge pull request #1076 from square/renovate/major-timber
RBusarow Jun 28, 2023
3a7232b
Update squareup.leakcanary to v2.12
renovate[bot] Jun 29, 2023
72d0cea
Merge pull request #1078 from square/renovate/squareup.leakcanary
RBusarow Jun 29, 2023
424c286
Update dependency com.android.tools.build:gradle to v7.4.2
renovate[bot] Jun 29, 2023
bc5f53b
Merge pull request #1081 from square/renovate/deps.agp
RBusarow Jun 30, 2023
f55b9e6
Update androidTools to v7.4.2
renovate[bot] Jun 29, 2023
28b504c
Apply changes from dependencyGuardBaseline --refresh-dependencies
renovate[bot] Jun 29, 2023
cb7a333
Merge pull request #1080 from square/renovate/androidtools
RBusarow Jun 30, 2023
f74df73
Update dependency com.squareup.okio:okio to v3.3.0
renovate[bot] Jun 29, 2023
3edbb92
Apply changes from dependencyGuardBaseline --refresh-dependencies
renovate[bot] Jun 29, 2023
f0cceae
Merge pull request #1083 from square/renovate/squareup.okio
RBusarow Jun 30, 2023
618befe
Add complete tutorial 1
RotBolt Jun 22, 2023
b42502c
Add Tutorial 2
RotBolt Jun 22, 2023
7ac813b
Add Tutorial 3
RotBolt Jun 26, 2023
04372af
Add Tutorial 4
RotBolt Jun 27, 2023
5024550
Add Tutorial 5: Unit tests: actions and rendering
RotBolt Jul 4, 2023
59d9354
Add Tutorial 5: Unit test: composition test + integration test
RotBolt Jul 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/actions/gradle-task-with-commit/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ inputs :
runs:
using: 'composite'
steps:
- name: Check if PERSONAL_ACCESS_TOKEN is set
- name: Check if access token is set
id: can-push
shell: bash
run: |
if [[ "${{ inputs.personal-access-token }}" == '' ]]; then
echo "can_push=false" >> $GITHUB_OUTPUT
elif [[ "${{ env.GITHUB_REF_PROTECTED }}" == 'true' ]]; then
echo "can_push=false" >> $GITHUB_OUTPUT
elif [[ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]]; then
echo "can_push=false" >> $GITHUB_OUTPUT
else
Expand Down
42 changes: 34 additions & 8 deletions .github/actions/gradle-task/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ runs :
cache-read-only : false
gradle-home-cache-cleanup : true

# Calculate all the hashes for keys just one time.
# These should only be referenced before the actual task action, since that action
# may generate changes and we want the final cache key to reflect its current state.
- name : Calculate hashes
id : hashes
shell: bash
run : |
echo "lib_versions=${{ hashFiles('**/libs.versions.toml') }}" >> $GITHUB_OUTPUT
echo "gradle_props=${{ hashFiles('**/gradle.properties') }}" >> $GITHUB_OUTPUT
echo "gradle_kts=${{ hashFiles('**/*.gradle.kts') }}" >> $GITHUB_OUTPUT
echo "src_kt=${{ hashFiles('**/src/**/*.kt') }}" >> $GITHUB_OUTPUT

# Attempt to restore from the write-cache-key, or fall back to a partial match for the write key.
# Skipped if the write-cache-key wasn't set.
# This step's "cache_hit" output will only be true if an exact match was found.
Expand All @@ -51,9 +63,15 @@ runs :
with :
path : |
~/.gradle/caches/build-cache-1
./**/build/**
key : ${{runner.os}}-${{inputs.write-cache-key}}-${{hashFiles('**/*.gradle.kt*')}}-${{hashFiles('**/libs.versions.toml')}}-${{hashFiles('**/gradle.properties')}}
restore-keys : ${{runner.os}}-${{inputs.write-cache-key}}
~/.konan
./**/build/**/!(*.dex)
./**/.gradle
key : ${{runner.os}}-${{inputs.write-cache-key}}-${{steps.hashes.outputs.lib_versions}}-${{steps.hashes.outputs.gradle_props}}-${{steps.hashes.outputs.gradle_kts}}-${{steps.hashes.outputs.src_kt}}
restore-keys : |
${{runner.os}}-${{inputs.write-cache-key}}-${{steps.hashes.outputs.lib_versions}}-${{steps.hashes.outputs.gradle_props}}-${{steps.hashes.outputs.gradle_kts}}
${{runner.os}}-${{inputs.write-cache-key}}-${{steps.hashes.outputs.lib_versions}}-${{steps.hashes.outputs.gradle_props}}
${{runner.os}}-${{inputs.write-cache-key}}-${{steps.hashes.outputs.lib_versions}}
${{runner.os}}-${{inputs.write-cache-key}}

# Attempt to restore from the restore-cache-key, or fall back to a partial match for the restore key.
# Skipped if the restore-cache-key wasn't set, or if the write-cache-key restore had an exact match.
Expand All @@ -63,9 +81,15 @@ runs :
with :
path : |
~/.gradle/caches/build-cache-1
./**/build/**
key : ${{runner.os}}-${{inputs.restore-cache-key}}-${{hashFiles('**/*.gradle.kt*')}}-${{hashFiles('**/libs.versions.toml')}}-${{hashFiles('**/gradle.properties')}}
restore-keys : ${{runner.os}}-${{inputs.restore-cache-key}}
~/.konan
./**/build/**/!(*.dex)
./**/.gradle
key : ${{runner.os}}-${{inputs.restore-cache-key}}-${{steps.hashes.outputs.lib_versions}}-${{steps.hashes.outputs.gradle_props}}-${{steps.hashes.outputs.gradle_kts}}-${{steps.hashes.outputs.src_kt}}
restore-keys : |
${{runner.os}}-${{inputs.restore-cache-key}}-${{steps.hashes.outputs.lib_versions}}-${{steps.hashes.outputs.gradle_props}}-${{steps.hashes.outputs.gradle_kts}}
${{runner.os}}-${{inputs.restore-cache-key}}-${{steps.hashes.outputs.lib_versions}}-${{steps.hashes.outputs.gradle_props}}
${{runner.os}}-${{inputs.restore-cache-key}}-${{steps.hashes.outputs.lib_versions}}
${{runner.os}}-${{inputs.restore-cache-key}}

- uses : gradle/wrapper-validation-action@v1

Expand All @@ -92,8 +116,10 @@ runs :
with :
path : |
~/.gradle/caches/build-cache-1
./**/build/**
key : ${{runner.os}}-${{inputs.write-cache-key}}-${{hashFiles('**/*.gradle.kt*')}}-${{hashFiles('**/libs.versions.toml')}}-${{hashFiles('**/gradle.properties')}}
~/.konan
./**/build/**/!(*.dex)
./**/.gradle
key : ${{runner.os}}-${{inputs.write-cache-key}}-${{hashFiles('**/libs.versions.toml')}}-${{hashFiles('**/gradle.properties')}}-${{hashFiles('**/*.gradle.kts')}}-${{hashFiles('**/src/**/*.kt')}}

- name : Upload heap dump
if : failure()
Expand Down
88 changes: 88 additions & 0 deletions .github/actions/gradle-tasks-with-emulator/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name : Run Android Instrumentation Tests with Artifact and AVD Caching
description: This action sets up Gradle, runs a preparatory task, runs Android tests on an emulator, and uploads test results.

inputs:
prepare-task:
description: 'Gradle task for preparing necessary artifacts. Supports multi-line input.'
required: true
test-task:
description: 'Gradle task for running instrumentation tests. Supports multi-line input.'
required: true
api-level :
description : 'The Android SDK api level, like `29`'
required : true
build-root-directory :
description : 'Path to the root directory of the build'
required : false
java-version :
description : 'The Java version to set up.'
default : '11'
distribution :
description : 'The JDK distribution to use.'
default : 'zulu'
restore-cache-key :
description : 'The unique identifier for the associated cache. Any other consumers or producers for this cache must use the same name.'
default : 'null'
write-cache-key :
description : 'The unique identifier for the associated cache. Any other consumers or producers for this cache must use the same name.'
default : 'null'

runs :
using : 'composite'
steps :

# Create or fetch the artifacts used for these tests.
- name : Run ${{ inputs.prepare-task }}
uses : ./.github/actions/gradle-task
with :
build-root-directory : ${{ inputs.build-root-directory }}
distribution : ${{ inputs.distribution }}
java-version : ${{ inputs.java-version }}
restore-cache-key : ${{ inputs.restore-cache-key }}
task : ${{ inputs.prepare-task }}
write-cache-key : ${{ inputs.write-cache-key }}

# Get the AVD if it's already cached.
- name: AVD cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}

# If the AVD cache didn't exist, create an AVD and cache it.
- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ inputs.api-level }}
arch : x86_64
disable-animations: false
emulator-boot-timeout: 12000
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
force-avd-creation: false
profile : Galaxy Nexus
ram-size: 4096M
script: echo "Generated AVD snapshot."

# Run the actual emulator tests.
# At this point every task should be up-to-date and the AVD should be ready to go.
- name: run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ inputs.api-level }}
arch : x86_64
disable-animations: true
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
force-avd-creation: false
profile : Galaxy Nexus
script : ./gradlew ${{ inputs.test-task }}

- name : Upload results
if : ${{ always() }}
uses : actions/upload-artifact@v3
with :
name : instrumentation-test-results
path : ./**/build/reports/androidTests/connected/**
Loading