Merge remote-tracking branch 'upstream/dev' into dev #291
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Debug build | |
on: | |
push: | |
branches: | |
- dev | |
paths-ignore: | |
- '**.md' | |
- '.github/**' | |
- '!.github/workflows/debug.yml' | |
jobs: | |
check: | |
name: Check Access | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Check access" | |
uses: "lannonbr/[email protected]" | |
with: | |
permission: "write" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ffmpeg: | |
name: Native Build (FFmpeg) | |
runs-on: ubuntu-latest | |
needs: check | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Fetch Status | |
run: | | |
sed -i 's/\/\///g' settings.gradle | |
git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status | |
git submodule status TMessagesProj/jni/libvpx > libvpx_status | |
- name: FFmpeg Cache | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
TMessagesProj/jni/ffmpeg/build | |
TMessagesProj/jni/libvpx/build | |
key: ${{ hashFiles('ffmpeg_status', 'libvpx_status', 'TMessagesProj/jni/*ffmpeg*.sh', 'TMessagesProj/jni/*libvpx*.sh', 'TMessagesProj/jni/patches/ffmpeg/*') }} | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Android SDK Tools | |
uses: android-actions/setup-android@v3 | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Install NDK | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
echo "y" | sudo ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null | |
echo "sdk.dir=${ANDROID_HOME}" > local.properties | |
echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties | |
- name: Native Build | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
sudo apt-get install yasm -y | |
./run init libs libvpx | |
./run init libs ffmpeg | |
boringssl: | |
name: Native Build (BoringSSL) | |
runs-on: ubuntu-latest | |
needs: check | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Fetch Status | |
run: | | |
sed -i 's/\/\///g' settings.gradle | |
git submodule status TMessagesProj/jni/boringssl > boringssl_status | |
- name: BoringSSL Cache | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
TMessagesProj/jni/boringssl/build | |
key: ${{ hashFiles('boringssl_status') }} | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Android SDK Tools | |
uses: android-actions/setup-android@v3 | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Install NDK | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
echo "y" | sudo ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null | |
echo "sdk.dir=${ANDROID_HOME}" > local.properties | |
echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties | |
- name: Native Build | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
./run init action boringssl | |
./run init libs boringssl | |
native: | |
name: Native Build (Telegram) | |
runs-on: ubuntu-latest | |
needs: | |
- ffmpeg | |
- boringssl | |
strategy: | |
matrix: | |
flavor: | |
- armeabi-v7a | |
- arm64-v8a | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Fetch Status | |
run: | | |
sed -i 's/\/\///g' settings.gradle | |
git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status | |
git submodule status TMessagesProj/jni/libvpx > libvpx_status | |
git submodule status TMessagesProj/jni/boringssl > boringssl_status | |
- name: Native Cache | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
TMessagesProj/src/main/libs | |
key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-${{ matrix.flavor }} | |
- name: Checkout Library | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
git submodule update --init 'TMessagesProj/jni/*' | |
- name: FFmpeg Cache | |
uses: actions/cache@v4 | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
path: | | |
TMessagesProj/jni/ffmpeg/build | |
TMessagesProj/jni/libvpx/build | |
key: ${{ hashFiles('ffmpeg_status', 'libvpx_status', 'TMessagesProj/jni/*ffmpeg*.sh', 'TMessagesProj/jni/*libvpx*.sh', 'TMessagesProj/jni/patches/ffmpeg/*') }} | |
- name: BoringSSL Cache | |
uses: actions/cache@v4 | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
path: | | |
TMessagesProj/jni/boringssl/build | |
key: ${{ hashFiles('boringssl_status') }} | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Android SDK Tools | |
uses: android-actions/setup-android@v3 | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Install NDK | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
echo "y" | sudo ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null | |
echo "sdk.dir=${ANDROID_HOME}" > local.properties | |
echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties | |
- name: Fix BoringSSL | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
cd TMessagesProj/jni | |
./patch_boringssl.sh | |
- name: Native Build | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
export NATIVE_TARGET="${{ matrix.flavor }}" | |
./run libs native | |
v2ray: | |
name: Native Build (V2ray) | |
runs-on: ubuntu-latest | |
needs: check | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Fetch Status | |
run: | | |
sed -i 's/\/\///g' settings.gradle | |
git submodule status v2ray > v2ray_status | |
- name: V2ray Cache | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
TMessagesProj/libs/libv2ray.aar | |
key: ${{ hashFiles('bin/libs/v2ray/*', 'v2ray_status') }} | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Android SDK Tools | |
uses: android-actions/setup-android@v3 | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Install NDK | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
echo "y" | sudo ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null | |
echo "sdk.dir=${ANDROID_HOME}" > local.properties | |
echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties | |
- name: Install Golang | |
uses: actions/setup-go@v5 | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
go-version: 1.21 | |
- name: Install Gomobile | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
go install golang.org/x/mobile/cmd/gomobile@latest | |
go install golang.org/x/mobile/cmd/gobind@latest | |
env: | |
GOPROXY: https://proxy.golang.org,direct | |
GO111MODULE: "on" | |
- name: Native Build | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: ./run libs v2ray | |
shadowsocks: | |
name: Native Build (Shadowsocks) | |
runs-on: ubuntu-latest | |
needs: check | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Fetch Status | |
run: | | |
sed -i 's/\/\///g' settings.gradle | |
git submodule status ss-rust/src/main/rust/shadowsocks-rust > shadowsocks_status | |
- name: Shadowsocks Cache | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
TMessagesProj/libs/ss-rust-release.aar | |
key: ${{ hashFiles('shadowsocks_status') }} | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Android SDK Tools | |
uses: android-actions/setup-android@v3 | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Install NDK | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
echo "y" | sudo ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null | |
echo "sdk.dir=${ANDROID_HOME}" > local.properties | |
echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties | |
- name: Install Rust | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: ./run init action shadowsocks | |
- name: Native Build | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: ./run libs shadowsocks | |
shadowsocksr: | |
name: Native Build (ShadowsocksR) | |
runs-on: ubuntu-latest | |
needs: check | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Fetch Status | |
run: | | |
sed -i 's/\/\///g' settings.gradle | |
git submodule status 'ssr-libev/*' > shadowsocksr_status | |
- name: ShadowsocksR Cache | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
TMessagesProj/libs/ssr-libev-release.aar | |
key: ${{ hashFiles('shadowsocksr_status') }} | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Android SDK Tools | |
uses: android-actions/setup-android@v3 | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Install NDK | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
echo "y" | sudo ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null | |
echo "sdk.dir=${ANDROID_HOME}" > local.properties | |
echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties | |
- name: Native Build | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: ./run libs ssr | |
build: | |
name: Gradle Build | |
runs-on: ubuntu-latest | |
needs: | |
- native | |
- v2ray | |
- shadowsocks | |
- shadowsocksr | |
strategy: | |
matrix: | |
flavor: | |
- FullRelease | |
- MiniRelease | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Android SDK Tools | |
uses: android-actions/setup-android@v3 | |
- name: Install NDK | |
run: | | |
echo "y" | sudo ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null | |
echo "sdk.dir=${ANDROID_HOME}" > local.properties | |
echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties | |
- name: Fetch Status | |
run: | | |
sed -i 's/\/\///g' settings.gradle | |
git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status | |
git submodule status TMessagesProj/jni/boringssl > boringssl_status | |
git submodule status ss-rust/src/main/rust/shadowsocks-rust > shadowsocks_status | |
git submodule status 'ssr-libev/*' > shadowsocksr_status | |
git submodule status v2ray > v2ray_status | |
- name: Native Cache (armeabi-v7a) | |
uses: actions/cache@v4 | |
with: | |
path: | | |
TMessagesProj/src/main/libs | |
key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-armeabi-v7a | |
- name: Native Cache (arm64-v8a) | |
uses: actions/cache@v4 | |
with: | |
path: | | |
TMessagesProj/src/main/libs | |
key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-arm64-v8a | |
- name: V2ray Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
TMessagesProj/libs/libv2ray.aar | |
key: ${{ hashFiles('bin/libs/v2ray/*', 'v2ray_status') }} | |
- name: Shadowsocks Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
TMessagesProj/libs/ss-rust-release.aar | |
key: ${{ hashFiles('shadowsocks_status') }} | |
- name: ShadowsocksR Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
TMessagesProj/libs/ssr-libev-release.aar | |
key: ${{ hashFiles('shadowsocksr_status') }} | |
- name: Configure Gradle | |
run: | | |
sed -i -e "s/16384/6144/g" gradle.properties | |
echo "sdk.dir=${ANDROID_HOME}" >> local.properties | |
- name: Gradle cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.gradle | |
key: gradle-${{ hashFiles('**/*.gradle') }} | |
- name: Debug Build | |
run: | | |
export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" | |
./gradlew TMessagesProj:assemble${{ matrix.flavor }} | |
APK=$(find TMessagesProj/build/outputs/apk -name '*arm64-v8a*.apk') | |
APK=$(dirname $APK) | |
echo "APK=$APK" >> $GITHUB_ENV | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.flavor }} | |
path: ${{ env.APK }} | |
upload: | |
name: Upload debug | |
if: github.event.inputs.upload != 'y' | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- telegram-bot-api | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Donwload 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: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Setup Python telebot | |
run: | | |
pip install telebot | |
- name: Send to Telegram | |
run: | | |
chmod +x telegram-bot-api-binary | |
function start() { | |
./telegram-bot-api-binary --api-id=11535358 --api-hash=33d372962fadb01df47e6ceed4e33cd6 --local 2>&1 > /dev/null & | |
} | |
start | |
curl http://127.0.0.1:8081/ || start | |
curl http://127.0.0.1:8081/ || start | |
curl http://127.0.0.1:8081/ || start | |
# send release via telegram bot api | |
export mini64=$(find artifacts -name "*mini-arm64-v8a.apk") | |
export mini32=$(find artifacts -name "*mini-armeabi-v7a.apk") | |
export full64=$(find artifacts -name "*full-arm64-v8a.apk") | |
export full32=$(find artifacts -name "*full-armeabi-v7a.apk") | |
touch ./Send_to_Telegram.py | |
sudo cat >./Send_to_Telegram.py <<EOL | |
import telebot | |
from telebot import apihelper | |
apihelper.API_URL = "http://localhost:8081/bot{0}/{1}" | |
tb = telebot.TeleBot('''${{ secrets.HELPER_BOT_TOKEN }}''') | |
file_paths = ("""${mini64}""", """${mini32}""", """${full64}""", """${full32}""") | |
print(file_paths) | |
list_captions = ("", "", "", """Test version, [${{ github.event.head_commit.message }}](${{ github.event.head_commit.url }})""") | |
for file, caption, message_id in zip(file_paths, list_captions, range(46, 50)): | |
media = telebot.types.InputMediaDocument(open(file, "rb"), caption=caption, parse_mode='Markdown') | |
for _ in range(3): | |
try: | |
tb.edit_message_media(chat_id='''${{ secrets.METADATA_CHANNEL_ID }}''', media=media, message_id=message_id) | |
except Exception as e: | |
print(e) | |
else: | |
break | |
tb.copy_messages(chat_id='''${{ secrets.HELPER_BOT_TARGET }}''', message_ids=list(range(46, 50)), from_chat_id='''${{ secrets.METADATA_CHANNEL_ID }}''') | |
EOL | |
python Send_to_Telegram.py | |
pkill telegram-bot | |
telegram-bot-api: | |
name: Telegram Bot API | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- 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 | |
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 |