-
-
Notifications
You must be signed in to change notification settings - Fork 48
225 lines (209 loc) · 8.79 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
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
name: Build CI
on:
push:
branches:
- master
paths-ignore:
- '**.md'
- '**.txt'
- '.github/**'
- '!.github/workflows/**'
- "TMessagesProj/src/main/res/values**/**"
workflow_dispatch:
jobs:
build:
name: Gradle Build
if: ${{ github.event_name != 'pull_request' && success() && github.ref == 'refs/heads/master' }}
runs-on: ubuntu-24.04
env:
CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion"
CCACHE_NOHASHDIR: "true"
CCACHE_MAXSIZE: "10G"
CCACHE_HARDLINK: "true"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check out submodules
run: |
git -c submodule."libs/rust".update=none submodule update --init --recursive
- name: Setup cmake
uses: jwlawson/[email protected]
with:
cmake-version: '3.22.1'
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- name: Setup Gradle
uses: gradle/[email protected]
- name: Set up ccache
uses: hendrikmuhs/[email protected]
with:
key: ccache-stable
restore-keys: ccache-stable
- name: Setup Android SDK Tools
uses: android-actions/setup-android@v2
- name: Prepare Environment
run: |
echo "Removing large packages"
sudo apt-get remove -y '^dotnet-.*'
sudo apt-get remove -y '^llvm-.*'
sudo apt-get remove -y 'php.*'
sudo apt-get remove -y '^mongodb-.*'
sudo apt-get remove -y '^mysql-.*'
sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri
sudo apt-get autoremove -y
sudo apt-get clean
echo "Removing large directories"
sudo rm -rf /usr/share/dotnet/
sudo rm -rf /usr/local/graalvm/
sudo rm -rf /usr/local/.ghcup/
sudo rm -rf /usr/local/share/powershell
sudo rm -rf /usr/local/share/chromium
sudo rm -rf /usr/local/lib/node_modules
df -h
export ndkversion="27.0.12077973"
sudo apt-get install wget bison gcc make curl ninja-build -y
echo "y" | sdkmanager --install "ndk;$ndkversion" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null
wget https://github.com/qwq233/ollvm-bin/releases/download/18.0.0/clang-18 -O ${ANDROID_SDK_ROOT}/ndk/$ndkversion/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-18
chmod +x ${ANDROID_SDK_ROOT}/ndk/$ndkversion/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-18
touch ${ANDROID_SDK_ROOT}/ndk/$ndkversion/enable_ollvm
echo "sdk.dir=${ANDROID_HOME}" >> local.properties
- name: Debug Build
run: |
echo -e "RELEASE_KEY_PASSWORD=${{ secrets.RELEASE_KEY_PASSWORD }}\nRELEASE_KEY_ALIAS=${{ secrets.RELEASE_KEY_ALIAS }}\nRELEASE_STORE_PASSWORD=${{ secrets.RELEASE_STORE_PASSWORD }}">>local.properties
cat > service_account_credentials.json << EOF
${{ secrets.ANDROID_PUBLISHER_CREDENTIALS }}"
EOF
mkdir TMessagesProj/config/
echo ${{ secrets.KEYSTORE }} | base64 -d > TMessagesProj/config/release.keystore
echo ${{ secrets.GOOGLE_SERVICES_JSON }} | base64 -d > TMessagesProj/google-services.json
./gradlew :TMessagesProj:assembleRelease :TMessagesProj:uploadCrashlyticsSymbolFileRelease
echo "APK_FILE=$(find TMessagesProj/build/outputs/apk -name '*arm64*.apk')" >> $GITHUB_ENV
echo "APK_FILE_ARMV7=$(find TMessagesProj/build/outputs/apk -name '*arm32*.apk')" >> $GITHUB_ENV
- uses: actions/upload-artifact@v3
name: Upload apk (arm64-v8a)
with:
name: Nullgram-arm64-v8a
path: ${{ env.APK_FILE }}
- uses: actions/upload-artifact@v3
name: Upload apk (armeabi-v7a)
with:
name: Nullgram-armeabi-v7a
path: ${{ env.APK_FILE_ARMV7 }}
- name: Upload mapping
uses: actions/upload-artifact@v3
with:
name: mapping
path: TMessagesProj/build/outputs/mapping
play-build:
name: Gradle Build (Play Store)
runs-on: ubuntu-24.04
if: ${{ github.event_name != 'pull_request' && success() && github.ref == 'refs/heads/master' }}
env:
CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion"
CCACHE_NOHASHDIR: "true"
CCACHE_MAXSIZE: "5G"
CCACHE_HARDLINK: "true"
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Check out submodules
run: |
git -c submodule."libs/rust".update=none submodule update --init --recursive
- name: Setup cmake
uses: jwlawson/[email protected]
with:
cmake-version: '3.22.1'
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- name: Setup Gradle
uses: gradle/[email protected]
- name: Set up ccache
uses: hendrikmuhs/[email protected]
with:
key: ccache
restore-keys: ccache
- name: Setup Android SDK Tools
uses: android-actions/setup-android@v2
- name: Prepare Environment
run: |
echo "Removing large packages"
sudo apt-get remove -y '^dotnet-.*'
sudo apt-get remove -y '^llvm-.*'
sudo apt-get remove -y 'php.*'
sudo apt-get remove -y '^mongodb-.*'
sudo apt-get remove -y '^mysql-.*'
sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri
sudo apt-get autoremove -y
sudo apt-get clean
echo "Removing large directories"
sudo rm -rf /usr/share/dotnet/
sudo rm -rf /usr/local/graalvm/
sudo rm -rf /usr/local/.ghcup/
sudo rm -rf /usr/local/share/powershell
sudo rm -rf /usr/local/share/chromium
sudo rm -rf /usr/local/lib/node_modules
df -h
export ndkversion="27.0.12077973"
sudo apt-get install bison gcc make wget curl ninja-build -y
echo "y" | sdkmanager --install "ndk;$ndkversion" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null
wget https://github.com/qwq233/ollvm-bin/releases/download/18.0.0/clang-18 -O ${ANDROID_SDK_ROOT}/ndk/$ndkversion/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-18
chmod +x ${ANDROID_SDK_ROOT}/ndk/$ndkversion/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-18
touch ${ANDROID_SDK_ROOT}/ndk/$ndkversion/enable_ollvm
echo "sdk.dir=${ANDROID_HOME}" >> local.properties
- name: Debug Build
run: |
echo -e "RELEASE_KEY_PASSWORD=${{ secrets.RELEASE_KEY_PASSWORD }}\nRELEASE_KEY_ALIAS=${{ secrets.RELEASE_KEY_ALIAS }}\nRELEASE_STORE_PASSWORD=${{ secrets.RELEASE_STORE_PASSWORD }}">>local.properties
cat > service_account_credentials.json << EOF
${{ secrets.ANDROID_PUBLISHER_CREDENTIALS }}"
EOF
mkdir TMessagesProj/config/
echo ${{ secrets.KEYSTORE }} | base64 -d > TMessagesProj/config/release.keystore
echo ${{ secrets.GOOGLE_SERVICES_JSON }} | base64 -d > TMessagesProj/google-services.json
./gradlew :TMessagesProj:publishPlayBundle
upload:
name: Upload Release
if: ${{ github.event_name != 'pull_request' && success() && github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Donwload Artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Find apk
run: |
mkdir apks
find artifacts -name "*.apk" -exec cp {} apks \;
echo "APK_FILE_UPLOAD=$(find apks -name '*arm64*.apk')" >> $GITHUB_ENV
- name: Get APK Info
id: apk
uses: JantHsueh/get-apk-info-action@master
with:
apkPath: ${{ env.APK_FILE_UPLOAD }}
- name: Set up Telegram Bot API
uses: zjns/telegram-bot-server@v1
with:
api_id: 21724
api_hash: 3e0cb5efcd52300aec5994fdfc5bdc16
server-port: 8081
- name: Release
run: |
curl https://raw.githubusercontent.com/qwq233/qwq233/master/uploadCI.py -o uploadCI.py
python uploadCI.py
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
VERSION_CODE: ${{steps.apk.outputs.versionCode}}
VERSION_NAME: ${{steps.apk.outputs.versionNum}}
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}