Skip to content
This repository was archived by the owner on Feb 5, 2021. It is now read-only.
Merged
Changes from all commits
Commits
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
28 changes: 15 additions & 13 deletions .github/workflows/kotlin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ on:
pull_request:

env:
# Must use $HOME here, NOT a tilde, because of the order in which bash does expansion:
# Tilde happens before variables, so will be used literally, whereas $HOME will be
# recursively expanded.
GRADLE_CACHE_PATH: $HOME/.gradle/caches
GRADLE_HOME: ${{ github.workspace }}/gradle-home

jobs:
assemble:
Expand All @@ -29,7 +26,7 @@ jobs:
- name: Cache gradle dependencies
uses: actions/cache@v1
with:
path: ${{ env.GRADLE_CACHE_PATH }}
path: ${{ env.GRADLE_HOME }}/caches
# Include the SHA in the hash so this step always adds a cache entry. If we didn't use the SHA, the artifacts
# would only get cached once for each build config hash.
# Don't use ${{ runner.os }} in the key so we don't re-assemble for UI tests.
Expand All @@ -47,13 +44,13 @@ jobs:
# and there's no way to modify the cache after the job that created it finishes.
- name: Clean gradle build cache to assemble fresh
run: |
ls -lhrt $GRADLE_CACHE_PATH || true
rm -rf $GRADLE_CACHE_PATH/build-cache-1
ls -lhrt $GRADLE_CACHE_PATH || true
ls -lhrt "$GRADLE_HOME/caches" || true
rm -rf "$GRADLE_HOME/caches/build-cache-1"
ls -lhrt "$GRADLE_HOME/caches" || true

## Actual task
- name: Assemble with gradle
run: ./gradlew assemble --build-cache --no-daemon --stacktrace
run: ./gradlew assemble --build-cache --no-daemon --stacktrace --gradle-user-home "$GRADLE_HOME"

# Runs all check tasks in parallel.
check:
Expand Down Expand Up @@ -84,14 +81,14 @@ jobs:
- name: Cache build artifacts
uses: actions/cache@v1
with:
path: ${{ env.GRADLE_CACHE_PATH }}
path: ${{ env.GRADLE_HOME }}/caches
# Don't set restore-keys so cache is always only valid for the current build config.
# Also don't use ${{ runner.os }} in the key so we don't re-assemble for UI tests.
key: gradle-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/buildSrc/**') }}-${{ github.sha }}

## Actual task
- name: Check with Gradle
run: ./gradlew ${{ matrix.gradle-task }} --build-cache --no-daemon --stacktrace
run: ./gradlew ${{ matrix.gradle-task }} --build-cache --no-daemon --stacktrace --gradle-user-home "$GRADLE_HOME"

instrumentation-tests:
name: Instrumentation tests
Expand Down Expand Up @@ -119,7 +116,7 @@ jobs:
- name: Cache build artifacts
uses: actions/cache@v1
with:
path: ${{ env.GRADLE_CACHE_PATH }}
path: ${{ env.GRADLE_HOME }}/caches
# Don't set restore-keys so cache is always only valid for the current build config.
# Also don't use ${{ runner.os }} in the key so we don't re-assemble for UI tests.
key: gradle-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/buildSrc/**') }}-${{ github.sha }}
Expand All @@ -130,4 +127,9 @@ jobs:
with:
api-level: ${{ matrix.api-level }}
arch: x86_64
script: ./gradlew connectedCheck --build-cache --no-daemon --stacktrace
script: ./gradlew connectedCheck --build-cache --no-daemon --stacktrace --gradle-user-home "$GRADLE_HOME"
- name: Upload results
uses: actions/upload-artifact@v2
with:
name: instrumentation-test-results
path: ./**/build/reports/androidTests/connected/**