-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ee9a20
commit 973402c
Showing
95 changed files
with
6,050 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
name: Android CI | ||
|
||
on: | ||
push: | ||
branches: [ "main", "v*/**"] | ||
pull_request: | ||
branches: [ "main" , "v*/**"] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
cache: gradle | ||
|
||
- name: Install python pip dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install requests | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Prepare Env | ||
id: Prepare | ||
run: | | ||
GIT_COMMIT=$(git rev-parse HEAD) | ||
github_run_url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID | ||
echo "GIT_COMMIT=$GIT_COMMIT$">> $GITHUB_ENV | ||
echo "GITHUB_RUN_URL=$github_run_url">> $GITHUB_ENV | ||
echo "GIT_BRANCH=`git branch --show-current`" >> $GITHUB_ENV | ||
chmod +x robot.py | ||
# debug | ||
- name: Dump Env | ||
run: env | sort | ||
|
||
- name: Dump GitHub context | ||
env: | ||
GITHUB_CONTEXT: ${{ toJson(github) }} | ||
run: | | ||
echo "$GITHUB_CONTEXT" | ||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v4 | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
# - name: Build with Gradle | ||
# run: ./gradlew build | ||
- name: Build with Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
gradle-version: wrapper | ||
arguments: build | ||
|
||
- name: Prepare Artifact | ||
if: success() | ||
id: prepareArtifact | ||
run: | | ||
releaseArtifactName=`ls app/build/outputs/apk/release/*.apk | grep -Po "(?<=release/).*(?=\.apk)"` && echo "releaseArtifactName=$releaseArtifactName" >> $GITHUB_OUTPUT | ||
debugArtifactName=`ls app/build/outputs/apk/debug/*.apk | grep -Po "(?<=debug/).*(?=\.apk)"` && echo "debugArtifactName=$debugArtifactName" >> $GITHUB_OUTPUT | ||
- name: Upload Archive Release-Apk | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ steps.prepareArtifact.outputs.releaseArtifactName }} | ||
path: app/build/outputs/apk/release/*.apk | ||
|
||
- name: Upload Archive Debug-Apk | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ steps.prepareArtifact.outputs.debugArtifactName }} | ||
path: ./app/build/outputs/apk/debug/*.apk | ||
|
||
- name: Post Message | ||
env: | ||
CHAT_ID: ${{ secrets.TG_CI_CHAT_ID }} | ||
BOT_TOKEN: ${{ secrets.TG_CI_BOT_TOKEN }} | ||
run: | | ||
echo "github_run_url=$GITHUB_RUN_URL" | ||
echo '${{ toJson(github) }}'> github_context.txt | ||
if [ -f "robot.py" ]; then | ||
python robot.py -e ci | ||
fi | ||
# curl -X POST "https://api.telegram.org/bot$BOT_TOKEN/sendMessage" -d "chat_id=$CHAT_ID&text=CI编译完成${github_run_url}" | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Release-Robot | ||
|
||
on: | ||
release: | ||
types: [ published, edited ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [ "3.10" ] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
# debug | ||
- name: Dump Env | ||
run: env | sort | ||
|
||
- name: Dump GitHub context | ||
env: | ||
GITHUB_CONTEXT: ${{ toJson(github) }} | ||
run: | | ||
echo "$GITHUB_CONTEXT" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install requests | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
# GIT_TAG=$(git describe --exact-match --abbrev=0 --tags "${COMMIT}" 2> /dev/null || true) | ||
# https://github.com/actions/actions-runner-controller/blob/acbce4b70ad1cf719f3bab94e127ca38a1576228/hack/make-env.sh | ||
# GIT_TAG=${GITHUB_REF/refs\/tags\//} | ||
# 这个方式在commit没有tag时,结果类似于: refs/heads/main | ||
- name: Prepare Env | ||
id: Prepare | ||
run: | | ||
GIT_TAG=${GITHUB_REF/refs\/tags\//} | ||
GIT_COMMIT=$(git rev-parse HEAD) | ||
echo "GIT_COMMIT=$GIT_COMMIT$">> $GITHUB_ENV | ||
echo "GIT_TAG=$GIT_TAG">> $GITHUB_ENV | ||
echo "GITHUB_RUN_URL=$github_run_url">> $GITHUB_ENV | ||
echo "GIT_BRANCH=`git branch --show-current`" >> $GITHUB_ENV | ||
- name: Robot Post Message | ||
env: | ||
tag_name: ${{ github.event.release.tag_name }} | ||
chat_id: ${{ secrets.TG_CI_CHAT_ID }} | ||
bot_token: ${{ secrets.TG_CI_BOT_TOKEN }} | ||
github_user: ${{ github.actor }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
# github_release: ${{ toJson(github.event.release) }} | ||
run: | | ||
echo "${{ toJson(github) }}"> github_context.txt | ||
python robot.py -e release |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/caches | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
/.idea/navEditor.xml | ||
/.idea/assetWizardSettings.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild | ||
.cxx | ||
local.properties | ||
/.idea/** |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# MaskWechat | ||
|
||
[Source link / 项目地址](https://github.com/Mingyueyixi/PicCatcher) | ||
|
||
反馈问题可点击以上地址,发起issues | ||
|
||
|
||
## 介绍 | ||
|
||
Catch app's picture |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,200 @@ | ||
import org.json.JSONObject | ||
|
||
import java.text.SimpleDateFormat | ||
|
||
plugins { | ||
id 'com.android.application' | ||
id 'org.jetbrains.kotlin.android' | ||
} | ||
apply { | ||
from rootProject.file('props.gradle') | ||
} | ||
def buildInfoJson = { | ||
def p = "git branch --show-current".execute() | ||
//当前分支 | ||
def currentBranch = p.text.trim() | ||
p.destroy() | ||
//最后1个提交ID | ||
p = "git rev-parse HEAD".execute() | ||
def lastedCommit = p.text.trim() | ||
p.destroy() | ||
|
||
//github等服务器打包时,因时区不同,格式化的时间与本地时间对不上 | ||
//故直接保存毫秒 | ||
def buildTime = System.currentTimeMillis() | ||
|
||
def gitBranch = currentBranch | ||
def gitCommit = lastedCommit; | ||
|
||
def jsonObj = new JSONObject() | ||
jsonObj.put("time", buildTime) | ||
jsonObj.put("branch", gitBranch) | ||
jsonObj.put("commit", gitCommit) | ||
return jsonObj.toString() | ||
}() | ||
|
||
def writeBuildInfoJson(dirPath, jsonText) { | ||
println "----------Commit Info------------" | ||
|
||
def buildInfoPath = "$dirPath/build_info.json".replace("\\", "/") | ||
def jsonFile = file(buildInfoPath) | ||
jsonFile.parentFile.mkdirs() | ||
jsonFile.withWriter('utf-8') { | ||
it.write(jsonText) | ||
} | ||
println "commit info file: $buildInfoPath" | ||
|
||
} | ||
|
||
this.afterEvaluate { | ||
project.tasks.forEach { | ||
if (it.name.startsWith("process") && it.name.endsWith("JavaRes")) { | ||
//将构建信息打包到apk中,这个方法似乎不太靠谱,改为写入buildConfig | ||
it.doLast { | ||
println(">>> ${it.name} attach build json") | ||
writeBuildInfoJson(it.destinationDir.path, buildInfoJson) | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
android { | ||
namespace 'com.pic.catcher' | ||
compileSdk 35 | ||
|
||
defaultConfig { | ||
applicationId "com.pic.catcher" | ||
minSdk 24 | ||
targetSdk 35 | ||
versionCode 1001 | ||
versionName "1.0-dev" | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
|
||
buildConfigField "int", "VERSION_CODE", "${versionCode}" | ||
buildConfigField "String", "VERSION_NAME", "\"${versionName}\"" | ||
buildConfigField "String", "buildInfoJson64", "\"${buildInfoJson.bytes.encodeBase64()}\"" | ||
} | ||
// sourceSets { | ||
// main{ | ||
// resources{ | ||
// srcDir("src/main/reouserces") | ||
// } | ||
// } | ||
// } | ||
signingConfigs { | ||
alpha { | ||
storeFile file("${rootDir}/app/key-store-test.jks") | ||
storePassword "123456" | ||
keyAlias "piccatch" | ||
keyPassword "123456" | ||
} | ||
} | ||
buildTypes { | ||
debug { | ||
debuggable true | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
signingConfig signingConfigs.alpha | ||
} | ||
release { | ||
debuggable false | ||
minifyEnabled true | ||
shrinkResources true | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
signingConfig signingConfigs.alpha | ||
} | ||
|
||
} | ||
|
||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
kotlinOptions { | ||
jvmTarget = '1.8' | ||
} | ||
|
||
viewBinding { | ||
enabled = true | ||
} | ||
|
||
applicationVariants.all { variant -> | ||
def outputs = variant.outputs | ||
def size = outputs.size() | ||
def commit = new JSONObject(buildInfoJson).optString("commit").substring(0, 6) | ||
outputs.eachWithIndex { Object output, int index -> | ||
def fontName = "maskwechat-v${variant.versionName}-${commit}-${variant.name}" | ||
if (size == 1) { | ||
output.outputFileName = "${fontName}.apk" | ||
} else { | ||
output.outputFileName = "${fontName}-${index}.apk" | ||
} | ||
} | ||
// variant.properties.each { | ||
// println("${it.key} --》 ${it.value}") | ||
// } | ||
// println("------------"+ variant.outputs) | ||
|
||
// testOptions { | ||
// //使javaTest可以使用外部库的代码,例如android.jar | ||
// //但是,api实际没有结果。 | ||
// unitTests.returnDefaultValues = true | ||
// } | ||
} | ||
buildFeatures { | ||
buildConfig = true | ||
} | ||
} | ||
|
||
configurations.all { | ||
resolutionStrategy { | ||
force 'androidx.core:core:1.13.1' | ||
force 'androidx.arch.core:core-runtime:2.2.0' | ||
force 'androidx.lifecycle:lifecycle-runtime:2.6.2' | ||
force 'androidx.lifecycle:lifecycle-livedata-core:2.6.2' | ||
force 'androidx.lifecycle:lifecycle-livedata:2.6.2' | ||
force 'androidx.lifecycle:lifecycle-process:2.6.2' | ||
force 'androidx.activity:activity:1.5.1' | ||
force 'androidx.annotation:annotation-experimental:1.4.0' | ||
force 'org.jetbrains:annotations:23.0.0' | ||
force 'androidx.collection:collection:1.1.0' | ||
force 'androidx.concurrent:concurrent-futures:1.1.0' | ||
force 'androidx.arch.core:core-common:2.2.0' | ||
force 'androidx.test:core:1.5.0' | ||
force 'com.google.code.gson:gson:2.10.1' | ||
force 'com.google.guava:guava:32.0.1-jre' | ||
force 'junit:junit:4.13.2' | ||
force 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.20' | ||
force 'org.jetbrains.kotlin:kotlin-stdlib-common:2.0.20' | ||
force 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0' | ||
force 'org.jetbrains.kotlin:kotlin-stdlib:1.9.20' | ||
force 'androidx.test:monitor:1.6.0' | ||
force 'com.google.protobuf:protobuf-java:3.22.3' | ||
force 'androidx.startup:startup-runtime:1.1.1' | ||
} | ||
} | ||
|
||
|
||
|
||
dependencies { | ||
implementation(fileTree(dir: "libs", include: ["*.jar", "*.aar"])) | ||
implementation(deps['com.github.Mingyueyixi.frame-base-utils:core']) | ||
implementation(deps['com.github.Mingyueyixi.frame-ui:ui-appcompat']){ | ||
// exclude(group:'androidx.core', module:'core') | ||
} | ||
implementation(deps['com.github.Mingyueyixi.lposed:xposed-api2']) | ||
implementation(deps['com.github.Mingyueyixi.lposed:plugin']) | ||
implementation(deps['androidx.appcompat:appcompat']) | ||
compileOnly(deps['de.robv.android.xposed:api']) | ||
// compileOnly('com.tencent.wcdb:wcdb-android:1.1-19') | ||
// https://mvnrepository.com/artifact/com.tencent.wcdb/wcdb-android | ||
|
||
// https://mvnrepository.com/artifact/org.json/json | ||
// testImplementation 'org.json:json:20220924' | ||
|
||
testImplementation(deps['junit:junit']) | ||
androidTestImplementation(deps['androidx.test.ext:junit']) | ||
androidTestImplementation(deps['androidx.test.espresso:espresso-core']) | ||
} |
Binary file not shown.
Oops, something went wrong.