-
Notifications
You must be signed in to change notification settings - Fork 27
141 lines (122 loc) · 4.49 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
131
132
133
134
135
136
137
138
139
140
141
name: CI
on:
# Only run push on main
push:
branches:
- main
paths-ignore:
- 'docs/**'
- '*.md'
# Always run on PRs
pull_request:
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 }}
# Use macOS for emulator hardware acceleration
runs-on: 'ubuntu-latest'
timeout-minutes: 30
strategy:
fail-fast: false # We want to see all results
matrix:
agp: ['8.4.0', '8.5.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
# TODO AVD caching disabled due to https://github.com/ReactiveCircus/android-emulator-runner/issues/278
# - name: AVD cache
# uses: actions/cache@v3
# id: avd-cache
# if: matrix.job == 'instrumentation'
# with:
# path: |
# ~/.android/avd/*
# ~/.android/adbkey
# ~/.android/adbkey.pub
# key: avd-${{ env.API_LEVEL }}-${{ env.AVD_TARGET }}
#
# - name: Create AVD and generate snapshot for caching
# if: matrix.job == 'instrumentation' && steps.avd-cache.outputs.cache-hit != 'true'
# uses: reactivecircus/android-emulator-runner@v2
# with:
# api-level: ${{ env.API_LEVEL }}
# force-avd-creation: false
# emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
# disable-animations: true
# disable-spellchecker: true
# target: ${{ env.AVD_TARGET }}
# channel: canary # Necessary for ATDs
# script: echo "Generated AVD snapshot for caching."
- name: Run instrumentation tests
if: matrix.job == 'instrumentation'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.API_LEVEL }}
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
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) Bundle the build report
if: failure()
run: find . -type d -name 'reports' | zip -@ -r build-reports.zip
- name: (Fail-only) Upload the build report
if: failure()
uses: actions/upload-artifact@v3
with:
name: error-report-${{ matrix.job }}-${{ matrix.agp }}
path: build-reports.zip
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