-
Notifications
You must be signed in to change notification settings - Fork 126
150 lines (129 loc) · 5.69 KB
/
Copy pathandroid-device-tests.yml
File metadata and controls
150 lines (129 loc) · 5.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: Android device tests
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened, ready_for_review, converted_to_draft, labeled, unlabeled]
push:
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
checks: write
pull-requests: read
jobs:
android-eligibility:
uses: ./.github/workflows/android-eligibility.yml
with:
event-name: ${{ github.event_name }}
ref: ${{ github.ref }}
pr-number: ${{ github.event.pull_request.number || '' }}
pr-head-repo: ${{ github.event.pull_request.head.repo.full_name || '' }}
pr-labels: ${{ toJson(github.event.pull_request.labels.*.name) }}
pr-draft: ${{ github.event.pull_request.draft || false }}
android-device-test-phase:
name: android-device-tests (${{ matrix.phase }})
needs: android-eligibility
if: ${{ needs.android-eligibility.outputs.should-run == 'true' }}
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
phase: [wallet-mobile, compose-demo, enterprise-mobile]
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
steps:
- name: Checkout all repos with ref fallback
uses: walt-id/waltid-identity/.github/actions/checkout-repos@73cf58a0edcc4c978304fdfd1a91372d34f65da2
with:
token: ${{ secrets.GH_ACCESS_TOKEN || github.token }}
ref: ${{ github.event.pull_request.head.ref || github.head_ref || github.ref_name }}
- name: Configure gradle
uses: walt-id/waltid-identity/.github/actions/gradle-setup-action@c95b601fc5095d5668eb8c906af992d8e00ed513
- name: Enable Android build in identity repo
uses: walt-id/waltid-identity/.github/actions/set-properties@00d4e55e9865cf17c6703d926dce4a4f6e1d404a
with:
file: 'waltid-identity/gradle.properties'
properties: 'enableAndroidBuild=true'
- name: Enable Android build in unified-build root
uses: walt-id/waltid-identity/.github/actions/set-properties@00d4e55e9865cf17c6703d926dce4a4f6e1d404a
with:
file: 'gradle.properties'
properties: 'enableAndroidBuild=true'
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Configure Android device test phase
id: android-device-phase
run: ./waltid-identity/.github/scripts/mobile-ci/configure-android-device-phase.sh "${{ matrix.phase }}"
- name: Preinstall Android emulator SDK packages
shell: bash
run: |
set -euo pipefail
retry_sdkmanager_install() {
local attempt
for attempt in 1 2 3; do
echo "sdkmanager install attempt ${attempt}: $*"
if "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --install "$@" --channel=0; then
return 0
fi
if [ "$attempt" -eq 3 ]; then
return 1
fi
sleep $((attempt * 20))
done
}
yes | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --licenses > /dev/null || true
retry_sdkmanager_install 'build-tools;37.0.0' platform-tools 'platforms;android-34'
retry_sdkmanager_install emulator
retry_sdkmanager_install 'system-images;android-34;default;x86_64'
- name: Build Enterprise Android mobile test artifacts
if: matrix.phase == 'enterprise-mobile'
run: ./waltid-identity/.github/scripts/mobile-ci/prepare-enterprise-android-mobile-tests.sh
- name: Run Android device tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 34
arch: x86_64
emulator-options: ${{ steps.android-device-phase.outputs.emulator_options }}
disable-animations: true
script: ${{ steps.android-device-phase.outputs.script }}
- name: Publish Android device test report
if: always() && steps.android-device-phase.outputs.report_paths != ''
uses: mikepenz/action-junit-report@v6
with:
update_check: true
job_name: android-device-tests (${{ matrix.phase }})
check_name: Android Device Test Report (${{ matrix.phase }})
report_paths: ${{ steps.android-device-phase.outputs.report_paths }}
detailed_summary: true
include_passed: false
include_skipped: false
require_tests: false
- name: Upload Android device test reports
if: always() && steps.android-device-phase.outputs.artifact_paths != ''
uses: actions/upload-artifact@v4
with:
name: android-device-test-reports-${{ matrix.phase }}
path: ${{ steps.android-device-phase.outputs.artifact_paths }}
retention-days: 30
android-device-tests:
runs-on: ubuntu-24.04
needs:
- android-eligibility
- android-device-test-phase
if: always()
steps:
- name: Check Android device test phases
run: |
if [ "${{ needs.android-eligibility.outputs.should-run }}" != "true" ]; then
echo "Android eligibility skipped this run: ${{ needs.android-eligibility.outputs.reason }}"
exit 0
fi
if [ "${{ needs.android-device-test-phase.result }}" != "success" ]; then
echo "::error::One or more Android device test phases failed."
exit 1
fi