Skip to content

Commit 1acad07

Browse files
authored
Merge pull request #2390 from embrace-io/vitaliyf/gradle-performance
Performance tweaks to various CI jobs
2 parents c887ff2 + f2b28ea commit 1acad07

File tree

6 files changed

+55
-208
lines changed

6 files changed

+55
-208
lines changed

.github/workflows/android-emulator-tests.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Run tests on android emulator
1+
name: Android
22

33
on:
44
workflow_dispatch:
@@ -17,14 +17,14 @@ permissions:
1717
contents: read
1818

1919
jobs:
20-
test:
20+
emulator:
2121
runs-on: ubuntu-latest
2222
timeout-minutes: 45
2323
strategy:
2424
matrix:
2525
api-level: [29]
26-
target: [default]
27-
26+
working-directory: ['.', 'examples/ExampleApp']
27+
fail-fast: false
2828
steps:
2929
- name: Checkout
3030
uses: actions/checkout@v4
@@ -57,30 +57,30 @@ jobs:
5757
key: avd-${{ matrix.api-level }}
5858

5959
- name: create AVD and generate snapshot for caching
60-
if: steps.avd-cache.outputs.cache-hit != 'true'
60+
if: ${{ steps.avd-cache.outputs.cache-hit != 'true' }}
6161
uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # v2.34.0
6262
with:
6363
api-level: ${{ matrix.api-level }}
6464
force-avd-creation: false
6565
disable-animations: false
66-
script: echo "Generated AVD snapshot for caching."
66+
script: echo 'Generated AVD snapshot for caching.'
6767

6868
- name: Run tests on android emulator
6969
uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # v2.34.0
7070
with:
71+
working-directory: ${{ matrix.working-directory }}
7172
api-level: ${{ matrix.api-level }}
72-
target: ${{ matrix.target }}
73+
target: default
7374
arch: x86_64
7475
profile: Nexus 6
75-
# Grab the failures from the device so we can include them in results.
76-
# Exit with non-zero so GH checks still fail.
76+
# Grab the failures from the device so we can include them in results. Exit with non-zero so GH checks still fail.
7777
script: ./gradlew connectedCheck --stacktrace || (adb logcat '[Embrace]:d' '*:S' -t 100000 > emulator_logcat.log && adb pull /storage/emulated/0/Android/data/io.embrace.android.embracesdk.test/cache/test_failure/ && exit 127)
7878

7979
- name: Archive Test Results
80-
if: always()
80+
if: ${{ always() && matrix.working-directory == '.' }}
8181
uses: actions/upload-artifact@v4
8282
with:
83-
name: android-emulator-test-results
83+
name: android-emulator-${{ matrix.working-directory }}-test-results
8484
path: |
8585
embrace-android-sdk/build/reports/androidTests/connected
8686
test_failure

.github/workflows/build-example-app.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/ci-gradle-2.yml

Lines changed: 0 additions & 63 deletions
This file was deleted.

.github/workflows/ci-gradle.yml

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,39 @@ concurrency:
1414
permissions:
1515
contents: read
1616

17+
env:
18+
DEPOT_RUNNER: depot-ubuntu-24.04-8
19+
1720
jobs:
18-
gradle-test:
21+
environment:
1922
runs-on: ubuntu-latest
23+
outputs:
24+
where: ${{ steps.choose.outputs.where }}
25+
steps:
26+
- id: choose
27+
run: |
28+
if [ ${GITHUB_ACTOR} != 'dependabot[bot]' ]; then
29+
echo "where=${DEPOT_RUNNER}" >> $GITHUB_OUTPUT
30+
else
31+
echo "where=ubuntu-latest" >> $GITHUB_OUTPUT
32+
fi
33+
34+
gradle:
35+
needs: environment
36+
runs-on: ${{ needs.environment.outputs.where }}
2037
timeout-minutes: 60
38+
strategy:
39+
matrix:
40+
gradle-task: ['test', 'assembleRelease', 'bundleReleaseExampleApp']
41+
fail-fast: false
2142
steps:
2243
- name: Free Disk Space (Ubuntu)
2344
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
45+
if: ${{ needs.environment.outputs.where == 'ubuntu-latest' }}
2446
with:
2547
tool-cache: false
26-
# keep android packages
2748
android: false
49+
2850
- name: Checkout Branch
2951
uses: actions/checkout@v4
3052
with:
@@ -51,21 +73,32 @@ jobs:
5173
- name: Fetch Robolectric dependencies
5274
run: /bin/sh .github/fetch-robolectric-dependencies.sh
5375

54-
# Build the entire project, run the tests, and run all static analysis
55-
- name: Gradle Build
76+
- name: Gradle (embrace-gradle-plugin-integration-tests:test)
77+
if: ${{ matrix.gradle-task == 'test' }}
78+
run: ./gradlew embrace-gradle-plugin-integration-tests:test --stacktrace
79+
80+
- name: Gradle (assembleRelease check -x embrace-gradle-plugin-integration-tests:test)
81+
if: ${{ matrix.gradle-task == 'assembleRelease' }}
5682
run: ./gradlew assembleRelease check -x embrace-gradle-plugin-integration-tests:test --stacktrace
5783

84+
- name: Gradle (assembleRelease check -x embrace-gradle-plugin-integration-tests:test)
85+
if: ${{ matrix.gradle-task == 'bundleReleaseExampleApp' }}
86+
working-directory: examples/ExampleApp
87+
run: ./gradlew bundleRelease
88+
5889
- name: Archive Test Results
59-
if: ${{ always() }}
90+
if: ${{ always() && matrix.gradle-task != 'bundleReleaseExampleApp' }}
6091
uses: actions/upload-artifact@v4
6192
with:
62-
name: test-results
93+
name: test-results-${{ matrix.gradle-task }}
6394
path: '**/build/reports/tests/**'
6495

6596
- name: Run Kover Code Coverage
97+
if: ${{ matrix.gradle-task == 'assembleRelease' }}
6698
run: ./gradlew koverXmlReportRelease
6799

68100
- uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
101+
if: ${{ matrix.gradle-task == 'assembleRelease' }}
69102
with:
70103
token: ${{ secrets.CODECOV_TOKEN }}
71104
fail_ci_if_error: false

.github/workflows/example-app-emulator-tests.yml

Lines changed: 0 additions & 84 deletions
This file was deleted.

gradle.properties

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
description="Embrace Android SDK"
2-
org.gradle.jvmargs=-Xmx4g -XX:+UseParallelGC -XX:MaxMetaspaceSize=2g
2+
org.gradle.jvmargs=-Xmx4096M -XX:+UseParallelGC -XX:MaxMetaspaceSize=2g -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx4096M"
33
org.gradle.parallel=true
4+
org.gradle.caching=true
5+
org.gradle.configuration-cache=true
6+
org.gradle.configuration-cache.problems=fail
7+
org.gradle.configuration-cache.parallel=true
48
version=7.8.0-SNAPSHOT
59
android.useAndroidX=true
610
android.experimental.enableArtProfiles=true
711
android.defaults.buildfeatures.buildconfig=false
8-
org.gradle.caching=true
9-
org.gradle.configuration-cache=true
10-
org.gradle.configuration-cache.problems=fail

0 commit comments

Comments
 (0)