-
Notifications
You must be signed in to change notification settings - Fork 319
214 lines (203 loc) · 9.17 KB
/
push_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
name: main
on:
workflow_dispatch:
push:
branches: [ main ]
paths-ignore:
- '**.md'
- '**.txt'
- 'renovate.json'
- '.editorconfig'
- '.gitignore'
- '.github/**'
- '.idea/**'
- '!.github/workflows/**'
jobs:
build:
name: Build CI (Push)
runs-on: ubuntu-24.04
env:
CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion"
CCACHE_NOHASHDIR: "true"
CCACHE_HARDLINK: "true"
CCACHE_BASEDIR: "${{ github.workspace }}"
if: ${{ !startsWith(github.event.head_commit.message, '[skip ci]') }} && success() && github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: 'true'
fetch-depth: 0
- name: Config submodules
run: |
git -C "libs/LSPlant" config "submodule.test/src/main/jni/external/lsprism.update" none
git -C "libs/LSPlant" config "submodule.test/src/main/jni/external/lsparself.update" none
git -C "libs/LSPlant" config "submodule.docs/doxygen-awesome-css.update" none
git -C "libs/mmkv/MMKV" config "submodule.Python/pybind11.update" none
git submodule foreach git submodule update --init --recursive
- name: set up JDK 17
uses: actions/setup-java@v4.5.0
with:
java-version: '17'
distribution: 'adopt'
- name: Setup SDK
run: |
echo "ANDROID_HOME=${ANDROID_HOME}"
echo "ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT}"
mkdir -p "$ANDROID_HOME/licenses/"
echo > "$ANDROID_HOME/licenses/android-sdk-license"
echo -n 24333f8a63b6825ea9c5514f83c2829b004d1fee > "$ANDROID_HOME/licenses/android-sdk-license"
echo "sdk.dir=${ANDROID_HOME}" > local.properties
- name: Install ccache
run: |
sudo apt install -y ccache ninja-build
ccache -o max_size=1G
ccache -o hash_dir=false
ccache -o hard_link=true
ccache -o compiler_check='%compiler% -dumpmachine; %compiler% -dumpversion'
ccache -zp
- name: Cache Native Build
uses: actions/cache@v4.1.2
with:
path: |
~/.cache/ccache
~/.ccache
app/build/.lto-cache
key: native-cache-${{ github.sha }}
restore-keys: native-cache-
- name: Setup Gradle
uses: gradle/gradle-build-action@v3.5.0
- name: Build with Gradle
run: |
echo 'org.gradle.parallel=true' >> gradle.properties
echo 'org.gradle.vfs.watch=true' >> gradle.properties
sed -i 's/org.gradle.configuration-cache=true//g' gradle.properties
echo 'buildCache { local { removeUnusedEntriesAfterDays = 1 } }' >> settings.gradle.kts
echo ${{ secrets.SIGN_KEYSTORE_BASE64 }} | base64 -d > keystore.jks
./gradlew :app:synthesizeDistReleaseApksCI :app:extractReleaseNativeDebugMetadata
ccache -s
echo "APK_FILE_ARM32=$(find app/build/outputs/ci -name '*arm32.apk')" >> $GITHUB_ENV
echo "APK_FILE_ARM64=$(find app/build/outputs/ci -name '*arm64.apk')" >> $GITHUB_ENV
echo "APK_FILE_ARMALL=$(find app/build/outputs/ci -name '*armAll.apk')" >> $GITHUB_ENV
echo "APK_FILE_UNIVERSAL=$(find app/build/outputs/ci -name '*universal.apk')" >> $GITHUB_ENV
echo "SYMBOL_FILE=app/build/intermediates/native_debug_metadata/release/extractReleaseNativeDebugMetadata/out" >> $GITHUB_ENV
env:
KEYSTORE_PATH: "../keystore.jks"
KEYSTORE_PASSWORD: ${{ secrets.SIGN_KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.SIGN_ALIAS }}
KEY_PASSWORD: ${{ secrets.SIGN_KEY_PASSWORD }}
- name: Show Artifacts SHA256
run: |
echo "### Build Success :rocket:" >> $GITHUB_STEP_SUMMARY
echo "|ABI|SHA256|" >> $GITHUB_STEP_SUMMARY
echo "|:--------:|:----------|" >> $GITHUB_STEP_SUMMARY
arm32=($(sha256sum ${{ env.APK_FILE_ARM32 }}))
echo "|arm32|$arm32" >> $GITHUB_STEP_SUMMARY
arm64=($(sha256sum ${{ env.APK_FILE_ARM64 }}))
echo "|arm64|$arm64" >> $GITHUB_STEP_SUMMARY
armAll=($(sha256sum ${{ env.APK_FILE_ARMALL }}))
echo "|armAll|$armAll" >> $GITHUB_STEP_SUMMARY
universal=($(sha256sum ${{ env.APK_FILE_UNIVERSAL }}))
echo "|universal|$universal" >> $GITHUB_STEP_SUMMARY
- name: Upload Artifacts(arm32)
uses: actions/upload-artifact@v4
with:
path: ${{ env.APK_FILE_ARM32 }}
name: QAuxiliary-release-${{ github.event.head_commit.id }}-arm32
- name: Upload Artifacts(arm64)
uses: actions/upload-artifact@v4
with:
path: ${{ env.APK_FILE_ARM64 }}
name: QAuxiliary-release-${{ github.event.head_commit.id }}-arm64
- name: Upload Artifacts(armAll)
uses: actions/upload-artifact@v4
with:
path: ${{ env.APK_FILE_ARMALL }}
name: QAuxiliary-release-${{ github.event.head_commit.id }}-armAll
- name: Upload Artifacts(universal)
uses: actions/upload-artifact@v4
with:
path: ${{ env.APK_FILE_UNIVERSAL }}
name: QAuxiliary-release-${{ github.event.head_commit.id }}-universal
- name: Upload Artifacts(symbol)
uses: actions/upload-artifact@v4
with:
path: ${{ env.SYMBOL_FILE }}
name: QAuxiliary-release-${{ github.event.head_commit.id }}-symbol
upload-telegram:
name: Upload Release
if: ${{ success() && github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
needs:
- build
- telegram-bot-api
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Download Telegram Bot API Binary
uses: actions/download-artifact@v4
with:
name: telegram-bot-api-binary
path: .
- name: Release
env:
COMMIT_MESSAGE: |+
New push to GitHub\!
```
${{ github.event.head_commit.message }}
```by `${{ github.event.head_commit.author.name }}`
See commit detail [here](${{ github.event.head_commit.url }})
COMMIT_URL: ${{ github.event.head_commit.url }}
run: |
ESCAPED=`python3 -c 'import json,os,urllib.parse; msg = json.dumps(os.environ["COMMIT_MESSAGE"]); print(urllib.parse.quote(msg if len(msg) <= 1024 else json.dumps(os.environ["COMMIT_URL"])))'`
export arm32=$(find artifacts -name "*arm32.apk")
export arm64=$(find artifacts -name "*arm64.apk")
export armAll=$(find artifacts -name "*armAll.apk")
export universal=$(find artifacts -name "*universal.apk")
export SYMBOL_ZIP_NAME=$(echo $universal | sed 's/universal.apk/symbol.zip/')
find artifacts -name "*.so.dbg" -print | zip "$SYMBOL_ZIP_NAME" -@
chmod +x telegram-bot-api-binary
./telegram-bot-api-binary --api-id=21724 --api-hash=3e0cb5efcd52300aec5994fdfc5bdc16 --local 2>&1 > /dev/null &
curl -v "http://127.0.0.1:8081/bot${{ secrets.TELEGRAM_TOKEN }}/sendMediaGroup?chat_id=-1001732413298&media=%5B%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Farm64%22%7D%2C%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Farm32%22%7D%2C%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2FarmAll%22%7D%2C%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Funiversal%22%7D%2C%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Fsymbol%22%2C%22parse_mode%22%3A%22MarkdownV2%22%2C%22caption%22:${ESCAPED}%7D%5D" \
-F arm32="@$arm32" \
-F arm64="@$arm64" \
-F armAll="@$armAll" \
-F universal="@$universal" \
-F symbol="@$SYMBOL_ZIP_NAME"
pkill telegram-bot
telegram-bot-api:
name: Telegram Bot API
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Clone Telegram Bot API
run: |
git clone --recursive https://github.com/tdlib/telegram-bot-api.git
git status telegram-bot-api >> telegram-bot-api-status
- name: Cache Bot API Binary
id: cache-bot-api
uses: actions/cache@v4.1.2
with:
path: telegram-bot-api-binary
key: CI-telegram-bot-api-${{ hashFiles('telegram-bot-api-status') }}
- name: Compile Telegram Bot API
if: steps.cache-bot-api.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install make git zlib1g-dev libssl-dev gperf cmake g++
cd telegram-bot-api
rm -rf build
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=.. ..
cmake --build . --target install -j$(nproc)
cd ../..
ls -l telegram-bot-api/bin/telegram-bot-api*
cp telegram-bot-api/bin/telegram-bot-api telegram-bot-api-binary
- name: Upload Binary
uses: actions/upload-artifact@v4
with:
name: telegram-bot-api-binary
path: telegram-bot-api-binary