This repository has been archived by the owner on Oct 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
241 lines (231 loc) · 7.93 KB
/
build.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
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
name: Build and test
on:
push:
branches: [ "dev", "main" ]
paths-ignore:
- '**.md'
pull_request:
branches: [ "dev" ]
paths-ignore:
- '**.md'
workflow_dispatch: { }
env:
# Misc
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Publishing credentials
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MVN_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MVN_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MVN_SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.MVN_SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MVN_SIGNING_KEY_PASSWORD }}
# Build configuration
BUILD_JAVA_VERSION: '17'
BUILD_JAVA_DIST: 'temurin'
BUILD_IS_RELEASE: ${{ github.ref == 'refs/heads/main' }}
PublishToMaven: ${{ github.ref == 'refs/heads/main' }}
DEBUG_INFO_PATH: '**/build/debug-symbols/**/*.debug_info'
# APT
ATS_SUDO: sudo
ATS_APT_UPDATE: apt-get update
ATS_APT_UPGRADE: apt-get upgrade -y
ATS_APT_INSTALL: apt-get install
ATS_APT_DEPS: build-essential cargo nodejs cmake ninja-build
jobs:
build_release_apk:
name: Build Release APK
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: ${{ env.BUILD_JAVA_VERSION }}
distribution: ${{ env.BUILD_JAVA_DIST }}
- name: Setup NDK
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r25
- name: Change Gradle wrapper permissions
run: chmod +x ./gradlew
- name: Install dependencies
run: $ATS_SUDO $ATS_APT_UPDATE && $ATS_SUDO $ATS_APT_UPGRADE && $ATS_SUDO $ATS_APT_INSTALL $ATS_APT_DEPS
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o rustup-init.sh
sh rustup-init.sh -y
- name: Restore cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Assemble Release
run: ./gradlew assembleRelease generateDebugSymbolsRelease --parallel --stacktrace
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
- name: Upload APK
uses: actions/upload-artifact@v4
with:
name: app-release
path: app/build/outputs/apk/release/app-release.apk
- name: Upload debug symbols
uses: actions/upload-artifact@v4
with:
name: debug-symbols
path: ${{ env.DEBUG_INFO_PATH }}
unit_test_debug:
name: Run local tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: ${{ env.BUILD_JAVA_VERSION }}
distribution: ${{ env.BUILD_JAVA_DIST }}
- name: Setup NDK
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r25
- name: Change Gradle wrapper permissions
run: chmod +x ./gradlew
- name: Install dependencies
run: $ATS_SUDO $ATS_APT_UPDATE && $ATS_SUDO $ATS_APT_UPGRADE && $ATS_SUDO $ATS_APT_INSTALL $ATS_APT_DEPS
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o rustup-init.sh
sh rustup-init.sh -y
- name: Restore cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Run debug tests
run: ./gradlew testDebug --continue --parallel --stacktrace
env:
ANDROIDIDE_TEST: true
- name: Upload Test Reports
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: test-results-unit-tests
path: '**/build/reports/tests/'
publish:
name: Publish release
runs-on: ubuntu-latest
needs: [ build_release_apk, unit_test_debug ]
if: ${{ always() && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && needs.build_release_apk.result == 'success' && needs.unit_test_debug.result == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: ${{ env.BUILD_JAVA_VERSION }}
distribution: ${{ env.BUILD_JAVA_DIST }}
- name: Setup NDK
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r25
- name: Change Gradle wrapper permissions
run: chmod +x ./gradlew
- name: Install dependencies
run: $ATS_SUDO $ATS_APT_UPDATE && $ATS_SUDO $ATS_APT_UPGRADE && $ATS_SUDO $ATS_APT_INSTALL $ATS_APT_DEPS
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o rustup-init.sh
sh rustup-init.sh -y
- name: Restore cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts/
- name: List downloaded artifacts
run: ls -laR
working-directory: artifacts/
- name: Archive debug symbols
run: |
zip -r debug-symbols.zip . -i $DEBUG_INFO_PATH
working-directory: artifacts/
- name: Publish release
id: publish_release
run: ./gradlew nyxMake nyxMark nyxPublish publish release --stacktrace
- name: Archive Nyx state file
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: .nyx-state-${{ github.job }}.json
path: build/nyx-state.json
publish_snapshots:
name: Publish package snapshots
runs-on: ubuntu-latest
needs: [ build_release_apk ]
if: ${{ always() && github.ref != 'refs/heads/main' && github.event_name != 'pull_request' && needs.build_release_apk.result == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: ${{ env.BUILD_JAVA_VERSION }}
distribution: ${{ env.BUILD_JAVA_DIST }}
- name: Setup NDK
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r25
- name: Change Gradle wrapper permissions
run: chmod +x ./gradlew
- name: Install dependencies
run: $ATS_SUDO $ATS_APT_UPDATE && $ATS_SUDO $ATS_APT_UPGRADE && $ATS_SUDO $ATS_APT_INSTALL $ATS_APT_DEPS
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o rustup-init.sh
sh rustup-init.sh -y
- name: Restore cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Publish snapshots
run: ./gradlew publishAllPublicationsToMavenCentralRepository --stacktrace