Skip to content

Commit b23dfb5

Browse files
committed
CI: Update GitHub Actions workflows
This commit updates the GitHub Actions workflows for Continuous Integration (CI) and Continuous Deployment (CD). Key changes: - Updated `actions/checkout`, `actions/setup-java`, `actions/cache`, `actions/upload-artifact`, `gradle/actions/setup-gradle`, `gradle/actions/wrapper-validation` and `reactivecircus/android-emulator-runner` to their latest versions. - Switched from `macos-latest` to `ubuntu-latest` for the `build_test_publish_job` in the CD workflow. - Standardized Java setup to JDK 17 with 'oracle' distribution. - Improved Gradle caching configuration. - Updated Android UI test job: - Runs on `ubuntu-latest`. - Updated the matrix of API levels for testing. - Added KVM enablement for hardware acceleration. - Implemented AVD caching to speed up emulator startup. - Modified emulator options for better stability and performance. - Renamed artifact uploads for clarity.
1 parent d3bb4eb commit b23dfb5

2 files changed

Lines changed: 79 additions & 42 deletions

File tree

.github/workflows/cd.yml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,29 @@ on:
88
jobs:
99
build_test_publish_job:
1010
name: Build-Test-Publish job
11-
runs-on: macos-latest
11+
runs-on: ubuntu-latest
1212
steps:
13-
- name: Checkout
14-
uses: actions/checkout@v2
15-
- uses: actions/setup-java@v1
13+
- name: Check out
14+
uses: actions/checkout@v4
15+
- name: Set up JDK 17
16+
uses: actions/setup-java@v4
1617
with:
17-
java-version: '17'
18-
- name: Cache gradle
19-
uses: actions/cache@v1
18+
distribution: 'oracle'
19+
java-version: 17
20+
- name: Setup Gradle
21+
uses: gradle/actions/setup-gradle@v4
2022
with:
21-
path: ~/.gradle/caches
22-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
23-
restore-keys: |
24-
${{ runner.os }}-gradle-
23+
cache-read-only: false
24+
cache-overwrite-existing: true
2525
- name: Decrypt large secret
2626
run: ./.github/scripts/decrypt_secret.sh
2727
env:
2828
LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}
2929
- name: Build, Test & Upload to Google Play
3030
run: bundle exec fastlane build_bundle_publish
31-
- name: Archive output artifacts
32-
uses: actions/upload-artifact@v2
31+
- name: Archive build artifacts
32+
if: always()
33+
uses: actions/upload-artifact@v4
3334
with:
3435
name: output-artifacts
3536
path: |

.github/workflows/ci.yml

Lines changed: 65 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,24 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@v2
19-
- uses: actions/setup-java@v1
18+
uses: actions/checkout@v4
19+
- name: Gradle Wrapper Validation
20+
uses: gradle/actions/wrapper-validation@v4
21+
- name: Set up JDK 17
22+
uses: actions/setup-java@v4
2023
with:
21-
java-version: '17'
22-
- name: Cache gradle
23-
uses: actions/cache@v1
24+
distribution: 'oracle'
25+
java-version: 17
26+
- name: Setup Gradle
27+
uses: gradle/actions/setup-gradle@v4
2428
with:
25-
path: ~/.gradle/caches
26-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
27-
restore-keys: |
28-
${{ runner.os }}-gradle-
29+
cache-read-only: false
30+
cache-overwrite-existing: true
2931
- name: Build
3032
run: ./gradlew build
31-
- name: Archive output artifacts
32-
if: ${{ always() }}
33-
uses: actions/upload-artifact@v2
33+
- name: Archive build-output artifacts
34+
if: always()
35+
uses: actions/upload-artifact@v4
3436
with:
3537
name: output-artifacts
3638
path: |
@@ -39,33 +41,67 @@ jobs:
3941
android_ui_test_job:
4042
name: Android UI-tests on emulator
4143
needs: build_job
42-
runs-on: macos-latest
44+
runs-on: ubuntu-latest
4345
continue-on-error: true
4446
strategy:
4547
fail-fast: false
4648
matrix:
47-
api-level: [16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33]
49+
api-level: [ 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36 ]
50+
target: [ default ]
4851
steps:
49-
- uses: actions/checkout@v1
50-
- uses: actions/setup-java@v1
52+
- name: Check out
53+
uses: actions/checkout@v4
54+
- name: Set up JDK 17
55+
uses: actions/setup-java@v4
56+
with:
57+
distribution: 'oracle'
58+
java-version: 17
59+
- name: Setup Gradle
60+
uses: gradle/actions/setup-gradle@v4
5161
with:
52-
java-version: '17'
53-
- name: Cache gradle
54-
uses: actions/cache@v1
62+
cache-read-only: false
63+
cache-overwrite-existing: true
64+
- name: Enable KVM
65+
run: |
66+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
67+
sudo udevadm control --reload-rules
68+
sudo udevadm trigger --name-match=kvm
69+
- name: AVD cache
70+
uses: actions/cache@v4
71+
id: avd-cache
5572
with:
56-
path: ~/.gradle/caches
57-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
58-
restore-keys: |
59-
${{ runner.os }}-gradle-
60-
- name: Run debug UI-tests on emulator
73+
path: |
74+
~/.android/avd/*
75+
~/.android/adb*
76+
key: avd-${{ matrix.api-level }}-${{ matrix.target }}
77+
- name: Create AVD and generate snapshot for caching
78+
if: steps.avd-cache.outputs.cache-hit != 'true'
6179
uses: reactivecircus/android-emulator-runner@v2
6280
with:
6381
api-level: ${{ matrix.api-level }}
64-
target: google_apis
65-
script: ./gradlew :app:connectedCheck -PtestBuildType=debug
66-
- name: Run release UI-tests on emulator
82+
target: ${{ matrix.target }}
83+
arch: x86_64
84+
profile: Nexus 6
85+
force-avd-creation: false
86+
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
87+
disable-animations: false
88+
script: echo "Generated AVD snapshot for caching."
89+
- name: Run UI-tests on emulator
6790
uses: reactivecircus/android-emulator-runner@v2
6891
with:
6992
api-level: ${{ matrix.api-level }}
70-
target: google_apis
71-
script: ./gradlew :app:connectedCheck -PtestBuildType=release
93+
target: ${{ matrix.target }}
94+
arch: x86_64
95+
profile: Nexus 6
96+
force-avd-creation: false
97+
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
98+
disable-animations: true
99+
script: ./gradlew :app:connectedCheck
100+
- name: Archive ui-tests-output artifacts
101+
if: always()
102+
uses: actions/upload-artifact@v4
103+
with:
104+
name: output-ui-tests-artifacts-${{ matrix.api-level }}-${{ matrix.target }}
105+
path: |
106+
app/build/outputs
107+
app/build/reports

0 commit comments

Comments
 (0)