forked from topjohnwu/Magisk
-
Notifications
You must be signed in to change notification settings - Fork 0
248 lines (220 loc) · 7.11 KB
/
act-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
242
243
244
245
246
247
248
#2023-10-15 20:00
name: act - Magisk Build - release
env:
TAG_NAME: "Magisk"
TAG_VERSION: "Magisk-v26.3.1"
TAG_BUILD: "-b"
TAG_REF: "0000000"
PROG_NAME: "Magisk"
PROG_VERSION: "v26.3.1"
VERSION: "26.3.1"
#signing keys env variable checks
ANDROID_SIGNING_KEY: '${{ secrets.ANDROID_SIGNING_KEY }}'
# signingKeyBase64: '${{ secrets.ANDROID_SIGNING_KEY }}'
# alias: '${{ secrets.ANDROID_ALIAS }}'
# keyStorePassword: '${{ secrets.ANDROID_KEY_STORE_PASSWORD }}'
# keyPassword: '${{ secrets.ANDROID_KEY_PASSWORD }}'
on:
# push:
# branches: [master]
# paths:
# - "app/**"
# - "native/**"
# - "stub/**"
# - "buildSrc/**"
# - "build.py"
# - "gradle.properties"
# - ".github/workflows/build.yml"
# pull_request:
# branches: [master]
workflow_dispatch:
inputs:
patch_ondk:
description: patch ondk url
type: boolean
default: true
required: true
build_debug:
description: build debug
type: boolean
default: false
required: true
symbols:
description: Upload symbols
type: boolean
default: false
required: true
run_tests:
description: Run tests
type: boolean
default: false
required: true
jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
# os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Check out
uses: deep-soft/checkout@v4
with:
submodules: "recursive"
fetch-depth: 0
- name: get version code
shell: bash
run: |
_version_code_=$(grep "magisk.versionCode" gradle.properties | awk -F"=" '{print $2}')
if [[ "$_version_code_" != "" ]]; then
echo "PROG_VERSION_CODE=$_version_code_" >> $GITHUB_ENV
_sver2_=${_version_code_:${#_version_code_}-2:2}
_ver_sver_=${_version_code_:0:${#_version_code_}-2}
_sver_=${_ver_sver_:${#_ver_sver_}-1:1}
_ver_=${_ver_sver_:0:-1}
_ver_sver_sver2_=$_ver_.$_sver_.$_sver2_
echo "VERSION=$_ver_sver_sver2_" >> $GITHUB_ENV
echo "PROG_VERSION=v$_ver_sver_sver2_" >> $GITHUB_ENV
fi
- name: print VERSION
shell: bash
run: |
echo "VERSION=${{ env.VERSION }}"
echo "PROG_VERSION=${{ env.PROG_VERSION }}"
- name: patch ondk url in build.py
if: ${{ inputs.patch_ondk }}
shell: bash
run: |
grep "/ondk/" build.py
sed -ibak "s!github.com\/topjohnwu\/ondk\/releases\/!github.com\/deep-soft\/ondk\/releases\/!" build.py
grep "/ondk/" build.py
- name: Set up JDK 17
uses: deep-soft/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
- name: Set up Python 3
uses: deep-soft/setup-python@v4
with:
python-version: "3.x"
- name: Set up sccache
uses: deep-soft/[email protected]
with:
variant: sccache
key: ${{ runner.os }}-${{ github.sha }}
restore-keys: ${{ runner.os }}
max-size: 10000M
- name: Cache Gradle dependencies
uses: deep-soft/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
!~/.gradle/caches/build-cache-*
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Cache build cache
uses: deep-soft/cache@v3
with:
path: |
~/.gradle/caches/build-cache-*
key: ${{ runner.os }}-build-cache-${{ github.sha }}
restore-keys: ${{ runner.os }}-build-cache-
- name: Set up NDK
run: python build.py -v ndk
- name: Build release
run: |
python build.py -vr all
- name: Copy apk to signed-apk
shell: bash
run: |
mkdir -p signed-apk;
cp ./out/app-release.apk ./signed-apk/${{ env.PROG_NAME }}-${{ env.PROG_VERSION }}.apk
# if [[ "${{ env.PROG_VERSION_CODE }}" == "" ]]; then
# cp ./out/app-release.apk ./signed-apk/${{ env.PROG_NAME }}-${{ env.PROG_VERSION }}.apk
# else
# cp ./out/app-release.apk ./signed-apk/${{ env.PROG_NAME }}-v${{ env.PROG_VERSION_CODE }}.apk
# fi;
- uses: deep-soft/sign-android-release@master
name: Sign app APK
if: env.ANDROID_SIGNING_KEY != null
id: sign-magisk
with:
releaseDirectory: ./signed-apk
signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }}
alias: ${{ secrets.ANDROID_ALIAS }}
keyStorePassword: ${{ secrets.ANDROID_KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}
env:
# override default build-tools version (29.0.3) -- optional
BUILD_TOOLS_VERSION: "34.0.0"
- name: Publish Release
continue-on-error: true
uses: deep-soft/action-gh-release@v1
with:
draft: true
tag_name: ${{ env.TAG_NAME }}-${{ env.PROG_VERSION }}
files: |
./out/*.apk
${{steps.sign-magisk.outputs.signedReleaseFile}}
- name: Publish Release
continue-on-error: true
uses: deep-soft/action-gh-release@v1
with:
draft: true
tag_name: ${{ env.TAG_NAME }}
files: |
${{steps.sign-magisk.outputs.signedReleaseFile}}
- name: Build debug
if: ${{ inputs.build_debug }}
run: |
python build.py -v all
- name: Stop gradle daemon
run: ./gradlew --stop
# Only upload artifacts built on Linux
- name: Upload build artifact
if: runner.os == 'Linux'
uses: deep-soft/upload-artifact@v3
with:
name: ${{ github.sha }}
path: out
- name: Upload mapping and native debug symbols
if: (${{ inputs.run_tests }} && runner.os == 'Linux')
uses: deep-soft/upload-artifact@v3
with:
name: ${{ github.sha }}-symbols
path: app/build/outputs
test:
name: Test on ${{ matrix.api }}
if: ${{ inputs.run_tests }}
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
api: [23, 26, 28, 29, 34]
steps:
- name: Check out
uses: deep-soft/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: deep-soft/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
- name: Set up Python 3
uses: deep-soft/setup-python@v4
with:
python-version: "3.x"
- name: Download build artifacts
uses: deep-soft/download-artifact@v3
with:
name: ${{ github.sha }}
path: out
- name: AVD test
run: |
# brew install coreutils bash
scripts/avd_test.sh ${{ matrix.api }}