1
0
mirror of https://github.com/MGislv/NekoX.git synced 2024-06-30 10:14:04 +00:00

Add debug workflow

This commit is contained in:
世界 2021-02-18 10:32:07 +08:00
parent 06df6a63dd
commit 4611743ef3
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
11 changed files with 205 additions and 51 deletions

111
.github/workflows/debug.yml vendored Normal file
View File

@ -0,0 +1,111 @@
name: Debug build
on:
push:
branches:
- main
paths-ignore:
- '**.md'
- '.github/**'
- '!.github/workflows/debug.yml'
jobs:
native:
name: Native Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Android SDK Tools
uses: android-actions/setup-android@v2
- name: Native Cache
uses: actions/cache@main
with:
path: |
TMessagesProj/libs
TMessagesProj/src/main/libs
key: ${{ hashFiles('TMessagesProj/jni/**', 'ss-rust/src/main/rust/**') }}
- name: Check Cache
run: |
[ -f "TMessagesProj/libs/libv2ray.aar" ] && echo "Cache found." || echo "CONTINUE=true" >> $GITHUB_ENV
- name: Install NDK
if: env.CONTINUE
run: |
echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.3.6528147" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null
echo "sdk.dir=${ANDROID_HOME}" > local.properties
echo "ndk.dir=${ANDROID_HOME}/ndk/21.3.6528147" >> local.properties
- uses: actions/setup-go@v2
if: env.CONTINUE
with:
go-version: ^1.15
- name: Native Build
if: env.CONTINUE
run: |
./run init action
./run init libs
./run libs update
debug:
name: Debug Build
runs-on: ubuntu-latest
needs: native
strategy:
matrix:
flavor:
- FullRelease
- FullReleaseNoGcm
- FullAppleEmojiRelease
- FullAppleEmojiReleaseNoGcm
- MiniRelease
- MiniReleaseNoGcm
- MiniAppleEmojiRelease
- MiniAppleEmojiReleaseNoGcm
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Android SDK Tools
uses: android-actions/setup-android@v2
- name: Native Cache
uses: actions/cache@main
with:
path: |
TMessagesProj/libs
TMessagesProj/src/main/libs
key: ${{ hashFiles('TMessagesProj/jni/**', 'ss-rust/src/main/rust/**') }}
- name: Fix Gradle Memoery
run: |
sed -i -e "s/16384/6144/g" gradle.properties
echo "ndk.dir=${ANDROID_HOME}/ndk-bundle" > local.properties
- name: Gradle cache
uses: actions/cache@main
with:
path: ~/.gradle
key: gradle-${{ hashFiles('**/*.gradle') }}
- name: Debug Build
run: |
export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}"
export DEBUG_BUILD=true
./gradlew TMessagesProj:assemble${{ matrix.flavor }}
echo "APK_FILE=$(find TMessagesProj/build/outputs/apk -name '*arm64-v8a*.apk')" >> $GITHUB_ENV
echo "APK_FILE_ARMV7=$(find TMessagesProj/build/outputs/apk -name '*armeabi*.apk')" >> $GITHUB_ENV
echo "APK_FILE_X86=$(find TMessagesProj/build/outputs/apk -name '*x86-*.apk')" >> $GITHUB_ENV
echo "APK_FILE_X64=$(find TMessagesProj/build/outputs/apk -name '*x86_64*.apk')" >> $GITHUB_ENV
- uses: actions/upload-artifact@v2
name: Upload apk (arm64-v8a)
with:
name: NekoX-${{ matrix.flavor }}-arm64-v8a
path: ${{ env.APK_FILE }}
- uses: actions/upload-artifact@v2
name: Upload apk (armeabi-v7a)
with:
name: NekoX-${{ matrix.flavor }}-armeabi-v7a
path: ${{ env.APK_FILE_ARMV7 }}
- uses: actions/upload-artifact@v2
name: Upload apk (x86_64)
with:
name: NekoX-${{ matrix.flavor }}-x86_64
path: ${{ env.APK_FILE_X64 }}
- uses: actions/upload-artifact@v2
name: Upload apk (x86)
with:
name: NekoX-${{ matrix.flavor }}-x86
path: ${{ env.APK_FILE_X86 }}

41
.github/workflows/native.yml vendored Normal file
View File

@ -0,0 +1,41 @@
name: Native build
on:
push:
branches:
- dev
paths:
- 'TMessagesProj/jni/**'
- 'ss-rust/src/main/rust/**'
jobs:
native:
name: Native Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Android SDK Tools
uses: android-actions/setup-android@v2
- name: Install NDK
run: |
echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.3.6528147" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null
echo "sdk.dir=${ANDROID_HOME}" > local.properties
echo "ndk.dir=${ANDROID_HOME}/ndk/21.3.6528147" >> local.properties
- uses: actions/setup-go@v2
with:
go-version: ^1.15
- name: Native Cache
uses: actions/cache@main
with:
path: |
TMessagesProj/libs
TMessagesProj/src/main/libs
key: ${{ hashFiles('TMessagesProj/jni/**', 'ss-rust/src/main/rust/**') }}
- name: Fix Gradle Memoery
run: sed -i -e "s/16384/6144/g" gradle.properties
- name: Native Build
run: |
test -f TMessagesProj/libs/libv2ray.aar && exit 0
./run init action
./run init libs
./run libs update

View File

@ -2,6 +2,8 @@
NekoX is an **free and open source** third-party Telegram client, based on Telegram-FOSS with features added.
[![Continuous integration](https://github.com/NekoX-Dev/NekoX/workflows/Debug%20build/badge.svg?branch=main)](https://github.com/NekoX-Dev/NekoX/actions)
- [Google Play Store](https://play.google.com/store/apps/details?id=nekox.messenger)
- [Update News Telegram](https://t.me/NekogramX)
- [GitHub Feedback](https://github.com/NekoX-Dev/NekoX/issues)

View File

@ -1,7 +1,14 @@
import cn.hutool.core.util.RuntimeUtil
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
def verName = "7.4.2-rc07"
if (System.getenv("DEBUG_BUILD") == "true") {
verName += "-" + RuntimeUtil.execForStr("git log --pretty=format:'%h' -n 1)")
}
def verCode = 188
def officialVer = "7.4.2"
@ -115,15 +122,13 @@ def alias = null
def pwd = null
Properties properties
if (project.rootProject.file('local.properties').exists()) {
def base64 = System.getenv("LOCAL_PROPERTIES")
if (base64 != null && !base64.isBlank()) {
properties = new Properties()
properties.load(new ByteArrayInputStream(Base64.decoder.decode(base64)))
} else if (project.rootProject.file('local.properties').exists()) {
properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
} else {
def base64 = System.getenv("LOCAL_PROPERTIES")
if (base64 != null && !base64.isBlank()) {
properties = new Properties()
properties.load(new ByteArrayInputStream(Base64.decoder.decode(base64)))
}
}
if (properties != null) {
@ -139,7 +144,7 @@ pwd = pwd ?: System.getenv("ALIAS_PASS")
android {
compileSdkVersion 30
buildToolsVersion '30.0.3'
ndkVersion '21.3.6528147'
ndkVersion rootProject.ext.ndkVersion
defaultConfig.applicationId = "nekox.messenger"

10
bin/init/action.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
sudo apt-get install bison gcc make curl ninja-build -y
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain none -y
echo "source \$HOME/.cargo/env" >>$HOME/.bashrc && source $HOME/.cargo/env
git submodule update --init --recursive
cd ss-rust/src/main/rust/shadowsocks-rust
rustup target install armv7-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android

View File

@ -1,20 +0,0 @@
#!/bin/bash
function sudodo() {
sudo $@ || $@
}
sudodo apt-get install bison gcc make curl ninja-build -y
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
source $HOME/.gvm/scripts/gvm
gvm install go1.15.6 -B
gvm use go1.15.6 --default
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain none -y
echo "source \$HOME/.cargo/env" >> $HOME/.bashrc && source $HOME/.cargo/env
git submodule update --init --recursive
cd ss-rust/src/main/rust/shadowsocks-rust
rustup target install armv7-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android

View File

@ -1,6 +1,6 @@
#!/bin/bash
bin/libs/v2ray.sh || exit 1
bin/libs/ss.sh || exit 1
bin/libs/ssr.sh || exit 1
bin/libs/v2ray.sh || exit 1
bin/libs/native.sh || exit 1
bin/libs/native.sh || exit 1

View File

@ -3,25 +3,28 @@
V2RAY_CORE_VERSION="4.34.0"
source "bin/init/env.sh"
v2rayCore="$(go env GOPATH)/src/v2ray.com/core"
#v2rayCore="$(go env GOPATH)/src/v2ray.com/core"
#
#if [ ! -f "$v2rayCore/go.mod" ]; then
# git clone https://github.com/v2fly/v2ray-core.git "$v2rayCore" -b "v$V2RAY_CORE_VERSION" --depth 1
#fi
#
#cd "$v2rayCore"
#git fetch origin "v$V2RAY_CORE_VERSION"
#git checkout -b master
#git reset "v$V2RAY_CORE_VERSION" --hard
if [ ! -d "$v2rayCore" ]; then
mkdir -p "$v2rayCore"
git clone https://github.com/v2fly/v2ray-core.git "$v2rayCore" -b "v$V2RAY_CORE_VERSION" --depth 1
cd "$v2rayCore"
else
cd "$v2rayCore"
git fetch origin "v$V2RAY_CORE_VERSION" && git reset "v$V2RAY_CORE_VERSION" --hard || git clone https://github.com/v2fly/v2ray-core.git "$v2rayCore" -b "v$V2RAY_CORE_VERSION" --depth 1
fi
export PATH="$PATH/$(go env $GOPATH/bin)"
go mod download -x
cd "$PROJECT/TMessagesProj/libs"
export GO111MOUDLE=on
go get -v golang.org/x/mobile/cmd/...
go get -d github.com/2dust/AndroidLibV2rayLite
export PATH="$PATH:$(go env GOPATH)/bin"
gomobile init
gomobile bind -v -ldflags='-s -w' github.com/2dust/AndroidLibV2rayLite || exit 1
cd "$PROJECT/build"
[ -d "v2ray" ] || git clone https://github.com/2dust/AndroidLibV2rayLite v2ray
cd v2ray
git reset --hard && git clean -fdx
sed -i -e "s|go 1.14|go 1.15|g" go.mod
go mod download -x
gomobile bind -v -ldflags='-s -w' . || exit 1
rm *-sources.jar
/bin/cp -f libv2ray.aar "$PROJECT/TMessagesProj/libs"

View File

@ -13,16 +13,18 @@ buildscript {
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.0'
classpath 'gradle.plugin.org.mozilla.rust-android-gradle:plugin:0.8.3'
classpath 'com.github.triplet.gradle:play-publisher:3.0.0'
classpath 'cn.hutool:hutool-core:5.5.8'
}
}
/*static String detectNdkVersion() {
static String detectNdkVersion() {
def version = "21.3.6528147"
def androidHome = System.getenv("ANDROID_HOME")
if (androidHome == null) return version
if (new File(androidHome, "ndk/$version").isDirectory()) return version
def versionFile = new File(androidHome,"ndk-bundle/source.properties")
@ -40,7 +42,7 @@ ext {
ndkVersion = detectNdkVersion()
}*/
}
allprojects {
repositories {

View File

@ -7,7 +7,7 @@ plugins {
android {
ndkVersion = "21.3.6528147"
ndkVersion = rootProject.extra.get("ndkVersion").toString()
compileSdkVersion(30)
defaultConfig {

View File

@ -5,7 +5,7 @@ plugins {
android {
compileSdkVersion 30
buildToolsVersion '30.0.3'
ndkVersion "21.3.6528147"
ndkVersion rootProject.ext.ndkVersion
defaultConfig {
minSdkVersion 16