-
Notifications
You must be signed in to change notification settings - Fork 64
142 lines (119 loc) · 4 KB
/
build.yml
File metadata and controls
142 lines (119 loc) · 4 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
name: CI Build
on:
workflow_dispatch:
pull_request:
push:
merge_group:
jobs:
build:
name: 構建
runs-on: ubuntu-latest
env:
CCACHE_COMPILERCHECK: '%compiler% -dumpmachine; %compiler% -dumpversion'
CCACHE_NOHASHDIR: 'true'
CCACHE_HARDLINK: 'true'
CCACHE_BASEDIR: '${{ github.workspace }}'
steps:
- name: 檢出程式碼
uses: actions/checkout@v5
with:
ref: ${{ github.sha }}
submodules: 'recursive'
fetch-depth: 0
- name: 設定快取
uses: actions/cache@v4
with:
path: ~/.ccache
key: ${{ runner.os }}-ccache-${{ github.sha }}
restore-keys: |
${{ runner.os }}-ccache-
- name: 如果需要,則寫入簽名密鑰
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
run: |
if [ ! -z "${{ secrets.KEY_STORE }}" ]; then
echo androidStorePassword='${{ secrets.KEY_STORE_PASSWORD }}' >> gradle.properties
echo androidKeyAlias='${{ secrets.ALIAS }}' >> gradle.properties
echo androidKeyPassword='${{ secrets.KEY_PASSWORD }}' >> gradle.properties
echo androidStoreFile='key.jks' >> gradle.properties
echo ${{ secrets.KEY_STORE }} | base64 --decode > key.jks
fi
- name: 檢出 libxposed/api
uses: actions/checkout@main
with:
repository: libxposed/api
path: libxposed/api
ref: 54582730315ba4a3d7cfaf9baf9d23c419e07006
- name: 檢出 libxposed/service
uses: actions/checkout@main
with:
repository: libxposed/service
path: libxposed/service
- name: 設定 Java
uses: actions/setup-java@v5
with:
java-version: '21'
distribution: 'adopt'
- name: 設定 Gradle
uses: gradle/actions/setup-gradle@v5
- name: 設定 Android SDK
uses: android-actions/setup-android@v3
- name: 設定 ninja
uses: seanmiddleditch/gha-setup-ninja@master
with:
version: 1.12.1
- name: 移除 Android 的 cmake
shell: bash
run: rm -rf "$ANDROID_HOME/cmake"
- name: 設定構建環境
run: |
# for libxposed/api build
echo 'org.gradle.jvmargs=-Xmx2048m' >> libxposed/api/gradle.properties
# for main project build
{
echo 'org.gradle.parallel=true'
echo 'org.gradle.jvmargs=-Xmx2048m'
echo 'android.native.buildOutput=verbose'
} >> gradle.properties
# for libxposed build
echo 'org.gradle.jvmargs=-Xmx2048m' >> libxposed/api/gradle.properties
echo 'org.gradle.jvmargs=-Xmx2048m' >> libxposed/service/gradle.properties
- name: 授予 gradlew 執行權限
run: chmod +x gradlew
- name: 使用 Gradle 構建依賴項
working-directory: libxposed
run: |
cd api
echo 'org.gradle.jvmargs=-Xmx2048m' >> gradle.properties
./gradlew :api:publishApiPublicationToMavenLocal
cd ../service
echo 'org.gradle.jvmargs=-Xmx2048m' >> gradle.properties
./gradlew :interface:publishInterfacePublicationToMavenLocal
- name: 設定 commit id
run: echo "commit=$(echo ${{ github.sha }} | cut -c-7)" > $GITHUB_ENV
- name: 使用 Gradle 構建
run: ./gradlew buildAll
- name: 上傳 Release Artifact
uses: actions/upload-artifact@v5
with:
name: npatch-release-${{ env.commit }}
path: out/release/*
retention-days: 14
- name: 上傳 Debug Artifact
uses: actions/upload-artifact@v5
with:
name: npatch-debug-${{ env.commit }}
path: out/debug/*
retention-days: 7
- name: 上傳 mappings
uses: actions/upload-artifact@v5
with:
name: mappings-${{ env.commit }}
path: |
patch-loader/build/outputs/mapping
manager/build/outputs/mapping
- name: 上傳 symbols
uses: actions/upload-artifact@v5
with:
name: symbols-${{ env.commit }}
path: |
patch-loader/build/symbols