-
Notifications
You must be signed in to change notification settings - Fork 27
130 lines (111 loc) · 4.1 KB
/
ci.yml
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
name: CI
on:
# Only run push on main
push:
branches:
- main
paths-ignore:
- 'docs/**'
- '*.md'
# Always run on PRs
pull_request:
concurrency:
group: 'ci-${{ github.event.merge_group.head_ref || github.head_ref }}-${{ github.workflow }}'
cancel-in-progress: true
env:
# Test on API 30 because that's the first version with ATDs
API_LEVEL: '30'
AVD_TARGET: 'aosp_atd'
jobs:
build:
name: ${{ matrix.job }} / AGP ${{ matrix.agp }} / OS ${{ matrix.os }}
# Use macOS for emulator hardware acceleration
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false # We want to see all results
matrix:
os: [ 'ubuntu-latest', 'windows-latest', 'macos-latest']
agp: ['8.5.0', '8.6.0-alpha08']
job: ['instrumentation', 'plugin']
env:
DEP_OVERRIDE_agp: ${{ matrix.agp }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Gradle Wrapper Validation
uses: gradle/actions/wrapper-validation@v3
- name: Install JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '21'
- name: Spot check
run: ./gradlew spotlessCheck
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Test plugin
id: gradle
if: matrix.job == 'plugin'
run: ./gradlew -p keeper-gradle-plugin check
- name: Assemble instrumentation tests
id: gradle-assemble-instrumentation
if: matrix.job == 'instrumentation'
run: ./gradlew :sample:minifyExternalStagingWithR8 validateL8 --stacktrace
- name: Enable KVM group perms
if: matrix.job == 'instrumentation' && matrix.os == 'ubuntu-latest'
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
if: matrix.job == 'instrumentation' && matrix.os == 'ubuntu-latest'
id: gradle-instrumentation-fork
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.API_LEVEL }}
arch: x86_64
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
disable-spellchecker: true
disk-size: 6000M
heap-size: 600M
target: 'aosp_atd'
channel: canary # Necessary for ATDs
script: |
adb uninstall com.slack.keeper.sample || true
adb uninstall com.slack.keeper.sample.androidTest || true
# Now proceed, with much of the build being cached up to this point
echo "Running instrumentation tests"
./gradlew connectedExternalStagingAndroidTest --stacktrace
adb uninstall com.slack.keeper.sample || true
adb uninstall com.slack.keeper.sample.androidTest || true
- name: (Fail-only) Upload the build reports
if: failure()
uses: actions/upload-artifact@v3
with:
name: error-report-${{ matrix.job }}-${{ matrix.agp }}-${{ matrix.os }}
path: |
keeper-gradle-plugin/build/reports
sample/build/reports
publish-snapshots:
name: Publish Snapshots
runs-on: 'ubuntu-latest'
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
needs: 'build'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '21'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Upload snapshot (main only)
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SonatypeUsername }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SonatypePassword }}
run: ./publish.sh