-
Notifications
You must be signed in to change notification settings - Fork 89
133 lines (112 loc) · 3.46 KB
/
Copy pathci.yml
File metadata and controls
133 lines (112 loc) · 3.46 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
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Format, lint, and build
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 17
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v6
- name: Check formatting
run: ./gradlew spotlessCheck
- name: Run Android lint
run: ./gradlew lint
- name: Build TrustKit library
run: ./gradlew :trustkit:assembleRelease
- name: Build Java demo app
run: ./gradlew :app:assembleDebug
- name: Build Kotlin demo app
run: ./gradlew :demoappkotlin:assembleDebug
- name: Upload build reports
if: failure()
uses: actions/upload-artifact@v7
with:
name: build-reports
path: |
**/build/reports/**
**/build/outputs/logs/**
if-no-files-found: ignore
retention-days: 7
instrumentation-tests:
name: Instrumentation tests (API ${{ matrix.api-level }})
needs: build
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
api-level:
- 27
- 36
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 17
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v6
- 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: Run instrumentation tests
uses: reactivecircus/android-emulator-runner@v2.37.0
with:
api-level: ${{ matrix.api-level }}
arch: x86_64
target: default
script: ./gradlew :trustkit:connectedDebugAndroidTest
- name: Upload instrumentation test reports
if: failure()
uses: actions/upload-artifact@v7
with:
name: instrumentation-reports-api-${{ matrix.api-level }}
path: |
trustkit/build/reports/androidTests/**
trustkit/build/outputs/androidTest-results/**
trustkit/build/outputs/managed_device_android_test_additional_output/**
if-no-files-found: ignore
retention-days: 7
ci-checks:
name: CI checks
runs-on: ubuntu-latest
if: ${{ always() }}
needs:
- build
- instrumentation-tests
steps:
- name: Verify required jobs succeeded
env:
BUILD_RESULT: ${{ needs.build.result }}
INSTRUMENTATION_TESTS_RESULT: ${{ needs.instrumentation-tests.result }}
run: |
if [[ "$BUILD_RESULT" != "success" || "$INSTRUMENTATION_TESTS_RESULT" != "success" ]]; then
echo "Build result: $BUILD_RESULT"
echo "Instrumentation tests result: $INSTRUMENTATION_TESTS_RESULT"
exit 1
fi
echo "All necessary CI jobs completed successfully"