-
Notifications
You must be signed in to change notification settings - Fork 315
133 lines (129 loc) · 4.47 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
name: Build
on:
push:
branches:
- main
- 'axt_**_release_branch'
pull_request:
branches:
- main
- 'axt_**_release_branch'
env:
cache-version: v1
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install Java 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- name: 'Cache Bazel files'
uses: actions/cache@v4
with:
path: ~/.cache/bazel
key: ${{ runner.os }}-${{ env.cache-version }}-bazel-build-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ env.cache-version }}-bazel-build-
- name: Build maven artifacts
run: bazelisk build //:axt_m2repository
shell: bash
- name: cp to upload dir
run: |
mkdir -p ~/download
cp bazel-bin/axt_m2repository.zip ~/download
shell: bash
- name: 'Upload local snapshot for tests'
uses: actions/upload-artifact@v4
with:
name: local-snapshot
path: ~/download
- name: 'Clean bazel cache'
# Don't cache the bazel/external directory, since it can be > 2GB
# and is expensive to restore and save
# According to the documentation, we should be able to exclude these via
# the actions/cache path, e.g. "!~/.cache/bazel/*/*/external/" but that
# doesn't seem to work.
run: |
rm -rf $(bazel info repository_cache)
rm -rf ~/.cache/bazel/*/*/external/
shell: bash
test:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install Java 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- name: 'Cache Bazel files'
uses: actions/cache@v4
with:
path: ~/.cache/bazel
key: ${{ runner.os }}-${{ env.cache-version }}-bazel-test-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ env.cache-version }}-bazel-test-
- name: Run Robolectric tests and fast tagged tests
run: bazelisk test --test_tag_filters=robolectric,fast --build_tag_filters=robolectric,fast --test_output=all ...
shell: bash
- name: 'Clean bazel cache'
# Don't cache the bazel/external directory, since it can be > 2GB
# and is expensive to restore and save
# According to the documentation, we should be able to exclude these via
# the actions/cache path, e.g. "!~/.cache/bazel/*/*/external/" but that
# doesn't seem to work.
run: |
rm -rf $(bazel info repository_cache)
rm -rf ~/.cache/bazel/*/*/external/
shell: bash
gradle-emulator-test:
runs-on: ubuntu-latest
needs: [build]
timeout-minutes: 20
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install Java 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- name: Gradle wrapper validation
uses: gradle/wrapper-validation-action@v2
- name: Enable KVM group perms
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: 'Cache Gradle files'
uses: gradle/gradle-build-action@v3
- name: 'Download local snapshot for tests'
uses: actions/download-artifact@v4
with:
name: local-snapshot
path: ~/download
- name: 'Install to local maven repo'
run: |
mkdir -p ~/.m2
unzip ~/download/axt_m2repository.zip -d ~/.m2/
shell: bash
- name: 'Setup Android SDK'
uses: android-actions/setup-android@v3
- name: 'Run gradle tests'
run: |
cd ${{ github.workspace }}/gradle-tests
./gradlew nexusOneDebugAndroidTest -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" --no-watch-fs --stacktrace
shell: bash
- name: 'Upload test reports'
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: test-reports
path: gradle-tests/**/build/reports/androidTests/