From ff318db69af3febfc98a3f215d20c0f608848e7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Thu, 25 Jun 2020 17:30:33 +0000 Subject: [PATCH] Add github action script --- .github/FUNDING.yml | 1 + .github/ISSUE_TEMPLATE/bug_report.md | 35 ++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 +++ .github/scripts/build-relaybaton.sh | 58 +++++++ .github/workflows/dev.yml | 196 ++++++++++++++++++++++ .github/workflows/release.yml | 62 +++++++ TMessagesProj/build.gradle | 2 +- 7 files changed, 373 insertions(+), 1 deletion(-) create mode 100644 .github/FUNDING.yml create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/scripts/build-relaybaton.sh create mode 100644 .github/workflows/dev.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 000000000..77eca3a48 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +patreon: NekoXDev diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..17b27a198 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,35 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Logcat** +Settings - click version - "Enable Log", then click "Send Logs" to [@NekoXChat](https://t.me/NekoXChat) or just upload at issue. + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Smartphone (please complete the following information):** + - Device: [e.g. MI6] + - OS: [e.g. Android8.1] + - Version [e.g. 5.15.0] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 000000000..bbcbbe7d6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/scripts/build-relaybaton.sh b/.github/scripts/build-relaybaton.sh new file mode 100644 index 000000000..f85ea3037 --- /dev/null +++ b/.github/scripts/build-relaybaton.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash + +DEPS=$ANDROID_HOME/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin + +ANDROID_ARM_CC=$DEPS/armv7a-linux-androideabi16-clang +ANDROID_ARM_STRIP=$DEPS/arm-linux-androideabi-strip + +ANDROID_ARM64_CC=$DEPS/aarch64-linux-android21-clang +ANDROID_ARM64_STRIP=$DEPS/aarch64-linux-android-strip + +ANDROID_X86_CC=$DEPS/i686-linux-android16-clang +ANDROID_X86_STRIP=$DEPS/i686-linux-android-strip + +ANDROID_X86_64_CC=$DEPS/x86_64-linux-android21-clang +ANDROID_X86_64_STRIP=$DEPS/x86_64-linux-android-strip + +git clone https://github.com/cloudflare/tls-tris -b pwu/esni tls + +BASEDIR=$(realpath tls/_dev) + +GOENV="$(go env GOHOSTOS)_$(go env GOHOSTARCH)" + +BUILD_DIR=${BASEDIR}/GOROOT make -f $BASEDIR/Makefile >&2 + +export GOROOT="$BASEDIR/GOROOT/$GOENV" + +export GO111MOD=on +export CGO_ENABLED=1 +export GOOS=android + +PKG="github.com/iyouport-org/relaybaton/main" +OUTPUT="relaybaton" +LIB_OUTPUT="lib$OUTPUT.so" +AAR_OUTPUT="$OUTPUT.aar" + +go get -v $PKG + +ROOT="relaybaton/src/main/jniLibs" + +DIR="$ROOT/armeabi-v7a" +mkdir -p $DIR +env CC=$ANDROID_ARM_CC GOARCH=arm GOARM=7 go build -o $DIR/$LIB_OUTPUT -v $PKG +$ANDROID_ARM_STRIP $DIR/$LIB_OUTPUT + +DIR="$ROOT/arm64-v8a" +mkdir -p $DIR +env CC=$ANDROID_ARM64_CC GOARCH=arm64 go build -o $DIR/$LIB_OUTPUT -v $PKG +$ANDROID_ARM64_STRIP $DIR/$LIB_OUTPUT + +DIR="$ROOT/x86" +mkdir -p $DIR +env CC=$ANDROID_X86_CC GOARCH=386 go build -o $DIR/$LIB_OUTPUT -v $PKG +$ANDROID_X86_STRIP $DIR/$LIB_OUTPUT + +DIR="$ROOT/x86_64" +mkdir -p $DIR +env CC=$ANDROID_X86_64_CC GOARCH=amd64 go build -o $DIR/$LIB_OUTPUT -v $PKG +$ANDROID_X86_64_STRIP $DIR/$LIB_OUTPUT \ No newline at end of file diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml new file mode 100644 index 000000000..e19047d2f --- /dev/null +++ b/.github/workflows/dev.yml @@ -0,0 +1,196 @@ +name: Dev Branch Build + +on: + push: + paths-ignore: + - '**.md' + - '.github/**' + - '!.github/workflows/**' + branches: + - dev + +jobs: + canaryBuild: + name: Canary Build + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, '[s]')" + steps: + - uses: actions/checkout@v2 + - uses: actions/cache@v1 + with: + path: ~/.gradle + key: gradle-${{ hashFiles('**/*.gradle') }} + - uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Run Gradle Build + run: | + export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" + ./gradlew assembleFullRelease + echo ::set-env name=APK_FILE::$(find TMessagesProj/build/outputs/apk -name "*arm64-v8a*.apk") + echo ::set-env name=APK_FILE_ARMV7::$(find TMessagesProj/build/outputs/apk -name "*armeabi*.apk") + echo ::set-env name=APK_FILE_X86::$(find TMessagesProj/build/outputs/apk -name "*x86-*.apk") + echo ::set-env name=APK_FILE_X64::$(find TMessagesProj/build/outputs/apk -name "*x86_64*.apk") + - name: Upload Canary Apk + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.CANARY_CHANNEL }} + token: ${{ secrets.TELEGRAM_TOKEN }} + document: ${{ env.APK_FILE }} + - name: Upload Canary Apk ( armv7 ) + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.CANARY_CHANNEL }} + token: ${{ secrets.TELEGRAM_TOKEN }} + document: ${{ env.APK_FILE_ARMV7 }} + nativeBuild: + name: Native Build + runs-on: ubuntu-latest + if: "contains(github.event.head_commit.message, '[n]')" + steps: + - uses: actions/checkout@v2 + - uses: actions/cache@v1 + with: + path: ~/.gradle + key: native-${{ hashFiles('**/*.gradle') }} + restore-keys: | + ${{ runner.os }}-gradle- + - run: git submodule update --init --recursive + - uses: actions/cache@v1 + with: + path: TMessagesProj/jni/boringssl/build + key: boringssl-${{ hashFiles('TMessagesProj/jni/boringssl/.git') }} + - uses: actions/cache@v1 + with: + path: TMessagesProj/jni/ffmpeg/build + key: ffmpeg-${{ hashFiles('TMessagesProj/jni/ffmpeg/.git') }} + - uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Build native libraries + run: | + + cd TMessagesProj/jni + + while : + do + sudo apt-get install -y ninja-build && break + sleep 5 + done + + export NDK=$ANDROID_HOME/ndk-bundle + export NINJA_PATH=/usr/bin/ninja + export PATH=`echo $ANDROID_HOME/cmake/*/bin`:$PATH + + [ -d "ffmpeg/build" ] || ./build_ffmpeg_clang.sh + + ./patch_ffmpeg.sh + + ./patch_boringssl.sh + + [ -d "boringssl/build" ] || ./build_boringssl.sh + + - name: assemble + run: | + sudo bash < $HOME/.ssh/id_rsa + chmod 600 $HOME/.ssh/id_rsa + mv build/update.json apks + cd apks + rm *universal* + xz *.apk + export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" + git init + git config --global user.name "世界" + git config --global user.email "i@nekox.me" + git remote add origin "git@github.com:NekoX-Dev/Resources.git" + git add . --all + git commit -m 喵 + git push origin master -f + - uses: r0adkll/upload-google-play@master + with: + serviceAccountJsonPlainText: ${{ secrets.GOOGLE_ACCOUNT_SERVICE }} + packageName: nekox.messenger + releaseFile: ${{ env.AAB_FILE }} + track: production \ No newline at end of file diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index f88e4bd4c..4940c0172 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -313,7 +313,7 @@ android { applicationVariants.all { variant -> variant.outputs.all { output -> - outputFileName = outputFileName.replace("TMessageProj","NekoX") + outputFileName = outputFileName.replace("TMessagesProj","NekoX") } def assembleTgVoipDexTaskName = "assemble${variant.name.capitalize()}TgVoipDex"