forked from organicmaps/organicmaps
-
Notifications
You must be signed in to change notification settings - Fork 1
166 lines (148 loc) · 4.76 KB
/
Copy pathandroid-check.yaml
File metadata and controls
166 lines (148 loc) · 4.76 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: Android Check
on:
workflow_dispatch: # Manual trigger
push:
branches:
- master
pull_request:
paths-ignore:
- .gitignore
- .github/**
- '!.github/workflows/android-check.yaml' # Run check on self change
- '**/*_tests/**'
- CONTRIBUTORS
- LICENSE
- NOTICE
- README.md
- android/app/src/fdroid/**
- android/app/src/google/**
- iphone/**
- data/organic_maps_emoji/**
- data/strings/**
- docs/**
- generator/**
- packaging/**
- platform/*apple*
- platform/*_ios*
- platform/*_linux*
- platform/*_mac*
- platform/*qt*
- platform/*_win*
- qt*/**
- skin_generator/**
- tools/**
- track_generator/**
- xcode/**
env:
JAVA_HOME: /usr/lib/jvm/temurin-17-jdk-amd64 # Java 17 is required for Android Gradle 8 plugin
jobs:
lint:
name: Android Lint
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v6
- name: Lint
shell: bash
working-directory: android
run: ./gradlew lintAllModules
# Reviewdog is needed for the action below to report issues in the PR.
- name: Install reviewdog
uses: reviewdog/action-setup@v1
- name: Report Android Lint Results
uses: ilyagulya/android-lint-action@v0.12.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
lint_xml_file: android/build/reports/lint/lint.xml
reporter: github-pr-review
level: warning
- name: Upload Android Lint Report
uses: actions/upload-artifact@v7
with:
name: android-lint-report
path: android/build/reports/lint/lint.xml
retention-days: 30
android-check:
name: Build Android Debug
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
flavor: [WebDebug, FdroidDebug]
include:
- flavor: WebDebug
arch: arm64
run-tests: true
- flavor: FdroidDebug
arch: arm32
# Cancels previous jobs if the same branch or PR was updated again.
concurrency:
group: ${{ github.workflow }}-${{ matrix.flavor }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
steps:
- name: Install build tools and dependencies
shell: bash
run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build
- name: Checkout sources
uses: actions/checkout@v6
with:
# Needed for versioning script
fetch-depth: 200 # enough to get all commits for the current day
- name: Restore Boost submodule from cache
uses: actions/cache@v5
with:
path: |
3party/boost
.git/modules/3party/boost
key: boost-submodule
- name: Parallel submodules checkout
shell: bash
run: git submodule update --depth 1 --init --recursive --jobs=$(($(nproc) * 20))
- name: Configure repository
shell: bash
run: ./configure.sh
- name: Configure ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.workflow }}-${{ matrix.flavor }}
- name: Compile ${{ matrix.flavor }}
shell: bash
working-directory: android
env:
CMAKE_C_COMPILER_LAUNCHER: ccache
CMAKE_CXX_COMPILER_LAUNCHER: ccache
run: |
cmake --version
ninja --version
./gradlew -P${{ matrix.arch }} assemble${{ matrix.flavor }}
- name: Free disk space for emulator
if: matrix.run-tests == true
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force > /dev/null
- name: Enable KVM
if: matrix.run-tests == true
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 tests
if: matrix.run-tests == true
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 35
arch: x86_64
target: google_apis
script: |
cd android && ./gradlew -P${{ matrix.arch }} app:test${{ matrix.flavor }} sdk:testDebug sdk:connectedDebugAndroidTest
- name: Upload ${{ matrix.flavor }} apk
uses: actions/upload-artifact@v7
with:
name: android-${{ matrix.flavor }}
path: android/app/build/outputs/apk/**/OrganicMaps-*.apk
if-no-files-found: error
retention-days: 30