Skip to content

Commit 8e77f90

Browse files
authored
Use gradle build cache action rather than manual cache usage. (#7944)
1 parent 2ee51ec commit 8e77f90

File tree

4 files changed

+19
-39
lines changed

4 files changed

+19
-39
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,10 @@ jobs:
2525
cancel-in-progress: true
2626
steps:
2727
- uses: actions/checkout@v3
28-
- uses: actions/cache@v3
28+
- name: Configure gradle
29+
uses: gradle/gradle-build-action@v2
2930
with:
30-
path: |
31-
~/.gradle/caches
32-
~/.gradle/wrapper
33-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
34-
restore-keys: |
35-
${{ runner.os }}-gradle-
31+
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
3632
- name: Assemble ${{ matrix.target }} debug apk
3733
run: ./gradlew assemble${{ matrix.target }}Debug $CI_GRADLE_ARG_PROPERTIES
3834
- name: Upload ${{ matrix.target }} debug APKs
@@ -50,14 +46,10 @@ jobs:
5046
cancel-in-progress: ${{ github.ref != 'refs/head/main' }}
5147
steps:
5248
- uses: actions/checkout@v3
53-
- uses: actions/cache@v3
49+
- name: Configure gradle
50+
uses: gradle/gradle-build-action@v2
5451
with:
55-
path: |
56-
~/.gradle/caches
57-
~/.gradle/wrapper
58-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
59-
restore-keys: |
60-
${{ runner.os }}-gradle-
52+
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
6153
- name: Assemble GPlay unsigned apk
6254
run: ./gradlew clean assembleGplayRelease $CI_GRADLE_ARG_PROPERTIES
6355
- name: Upload Gplay unsigned APKs

.github/workflows/nightly.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,10 @@ jobs:
1919
uses: actions/setup-python@v4
2020
with:
2121
python-version: 3.8
22-
- uses: actions/cache@v3
22+
- name: Configure gradle
23+
uses: gradle/gradle-build-action@v2
2324
with:
24-
path: |
25-
~/.gradle/caches
26-
~/.gradle/wrapper
27-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
28-
restore-keys: |
29-
${{ runner.os }}-gradle-
25+
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
3026
- name: Install towncrier
3127
run: |
3228
python3 -m pip install towncrier

.github/workflows/post-pr.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,25 +44,21 @@ jobs:
4444
uses: actions/setup-python@v4
4545
with:
4646
python-version: 3.8
47-
- uses: actions/cache@v3
47+
- uses: actions/setup-java@v3
4848
with:
49-
path: |
50-
~/.gradle/caches
51-
~/.gradle/wrapper
52-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
53-
restore-keys: |
54-
${{ runner.os }}-gradle-
49+
distribution: 'adopt'
50+
java-version: '11'
51+
- name: Configure gradle
52+
uses: gradle/gradle-build-action@v2
53+
with:
54+
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
5555
- name: Start synapse server
5656
uses: michaelkaye/setup-matrix-synapse@v1.0.4
5757
with:
5858
uploadLogs: true
5959
httpPort: 8080
6060
disableRateLimiting: true
6161
public_baseurl: "http://10.0.2.2:8080/"
62-
- uses: actions/setup-java@v3
63-
with:
64-
distribution: 'adopt'
65-
java-version: '11'
6662
- name: Run sanity tests on API ${{ matrix.api-level }}
6763
uses: reactivecircus/android-emulator-runner@v2
6864
with:

.github/workflows/tests.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,10 @@ jobs:
139139
# with:
140140
# distribution: 'adopt'
141141
# java-version: 11
142-
# - uses: actions/cache@v3
142+
# - name: Configure gradle
143+
# uses: gradle/gradle-build-action@v2
143144
# with:
144-
# path: |
145-
# ~/.gradle/caches
146-
# ~/.gradle/wrapper
147-
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
148-
# restore-keys: |
149-
# ${{ runner.os }}-gradle-
145+
# cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
150146
# - name: Build Android Tests
151147
# run: ./gradlew clean assembleAndroidTest $CI_GRADLE_ARG_PROPERTIES
152148

0 commit comments

Comments
 (0)