Add github action script

This commit is contained in:
世界 2020-06-25 17:30:33 +00:00
parent c725d042d0
commit ff318db69a
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
7 changed files with 373 additions and 1 deletions

1
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1 @@
patreon: NekoXDev

35
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -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.

View File

@ -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.

58
.github/scripts/build-relaybaton.sh vendored Normal file
View File

@ -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

196
.github/workflows/dev.yml vendored Normal file
View File

@ -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 <<EOF
export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" &&
./gradlew assembleFullFoss
EOF
ls TMessagesProj/build/outputs/apk
echo ::set-env name=APK_FILE::$(find TMessagesProj/build/outputs/apk -name "*universal*")
- uses: actions/upload-artifact@master
with:
name: NekoX-Foss
path: ${{ env.APK_FILE }}
- uses: actions/upload-artifact@master
with:
name: Boringssl Library
path: "TMessagesProj/jni/boringssl/build"
- uses: actions/upload-artifact@master
with:
name: Ffmpeg Library
path: "TMessagesProj/jni/ffmpeg/build"
v2rayBuild:
name: V2ray Build
runs-on: ubuntu-latest
if: "contains(github.event.head_commit.message, '[v]')"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.14
- name: Build V2ray
run: |
go env -w GOPATH=$HOME/go
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
go get -u github.com/golang/protobuf/protoc-gen-go
go get -v golang.org/x/mobile/cmd/...
go get -v go.starlark.net/starlark
go get -v github.com/refraction-networking/utls
go get -v github.com/gorilla/websocket
go get -v -insecure v2ray.com/core
go get github.com/2dust/AndroidLibV2rayLite
gomobile init
env GO111MODULE=off gomobile bind -v -ldflags='-s -w' github.com/2dust/AndroidLibV2rayLite
- uses: actions/upload-artifact@master
with:
name: libv2ray
path: libv2ray.aar
rbBuild:
name: RelayBaton Build
runs-on: ubuntu-latest
if: "contains(github.event.head_commit.message, '[rb]')"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.14
- uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build RelayBaton
run: bash .github/scripts/build-relaybaton.sh
- name: package
run: |
./gradlew relaybaton:assembleRelease
ls relaybaton/build/outputs/aar
- uses: actions/upload-artifact@master
with:
name: relaybaton
path: relaybaton/build/outputs/aar
ssBuild:
name: SS-Rust Build
runs-on: ubuntu-latest
if: "contains(github.event.head_commit.message, '[ss-rust]')"
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/setup-java@v1
with:
java-version: 1.8
- name: install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
- name: setup rust targets
run: rustup target install armv7-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android
- name: assemble
run: |
./gradlew ss-rust:assembleRelease
ls ss-rust/build/outputs/aar
- uses: actions/upload-artifact@master
with:
name: ss-rust
path: ss-rust/build/outputs/aar

62
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,62 @@
name: Release Build
on:
push:
tags:
- 'v*'
jobs:
releaseBuild:
name: Release Build
runs-on: ubuntu-latest
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: assembleRelease
run: |
export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}"
./gradlew TMessagesProj:assembleRelease \
TMessagesProj:assembleReleaseNoGcm \
TMessagesProj:bundleFullRelease
echo ::set-env name=AAB_FILE::$(find TMessagesProj/build/outputs/bundle -name "*.aab")
- name: Setup ghr
run: |
wget -O ghr.tar.gz https://github.com/tcnksm/ghr/releases/download/v0.13.0/ghr_v0.13.0_linux_amd64.tar.gz
tar xvzf ghr.tar.gz; rm ghr.tar.gz
sudo mv ghr*linux_amd64/ghr /usr/local/bin; rm -rf ghr*linux_amd64
- name: Upload apks
run: |
export GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}"
mkdir apks; find . -name "*.apk" -exec mv {} apks \;
ref="${{ github.ref }}"
ref=${ref/"refs/tags/"/}
msg="${{ github.event.head_commit.message }}"
ghr -delete -n "$ref" -b "$msg" "$ref" apks/
rm -rf $HOME/.ssh
mkdir -p $HOME/.ssh
echo "${{ secrets.SSH_KEY }}" > $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

View File

@ -313,7 +313,7 @@ android {
applicationVariants.all { variant -> applicationVariants.all { variant ->
variant.outputs.all { output -> variant.outputs.all { output ->
outputFileName = outputFileName.replace("TMessageProj","NekoX") outputFileName = outputFileName.replace("TMessagesProj","NekoX")
} }
def assembleTgVoipDexTaskName = "assemble${variant.name.capitalize()}TgVoipDex" def assembleTgVoipDexTaskName = "assemble${variant.name.capitalize()}TgVoipDex"