Skip to content

Commit

Permalink
Merge pull request #89 from KuhakuPixel/devel
Browse files Browse the repository at this point in the history
Add Github Action
  • Loading branch information
KuhakuPixel authored Mar 11, 2024
2 parents 600aeee + ed856c2 commit a0384c4
Show file tree
Hide file tree
Showing 3 changed files with 162 additions and 5 deletions.
151 changes: 151 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
name: AceTheGame CI
on: [push]

jobs:
ACE:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: "true"

- name: "install compiler and build tools"
run: sudo apt-get install build-essential

- name: create build directory
working-directory: ./ACE
run: mkdir build

# TODO: run unit tests on android emulator
# debug
- name: debug build
working-directory: ./ACE/build
run: |
cmake -DCMAKE_BUILD_TYPE=Debug ../
make -j${nproc}
- name: debug unit test
working-directory: ./ACE/build
run: ./test/test_ace -s

# release
- name: release build
working-directory: ./ACE/build
run: |
cmake -DCMAKE_BUILD_TYPE=Release ../
make -j${nproc}
- name: release unit test
working-directory: ./ACE/build
run: ./test/test_ace -s

Modder-linux:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: "true"

- name: "install build dependecies"
run: sudo apt-get install openjdk-17-jdk-headless apktool gradle

- name: generating code for injection
working-directory: ./Modder/injector
run: python3 ./gen_smali.py

- name: build
working-directory: ./Modder
# only build no testing
run: ./gradlew build -x test

- name: test
working-directory: ./Modder
# only build no testing
run: ./gradlew test
Modder-windows:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
with:
submodules: "true"

- uses: actions/setup-python@v5
with:
python-version: '3.10'

- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'

- name: "install build tools"
run: choco install apktool --version=2.5.0

- name: "install pkgconfig"
run: choco install pkgconfiglite

- name: generating code for injection
working-directory: ./Modder/injector
run: python3 ./gen_smali.py

- name: build
working-directory: ./Modder
# only build no testing
run: ./gradlew build -x test

- name: test
working-directory: ./Modder
# only build no testing
run: ./gradlew test



ATG:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: "true"

- name: "install build dependecies"
run: sudo apt-get install openjdk-17-jdk-headless fd-find

- name: "setup JAVA_HOME to java 17"
working-directory: /usr/lib/jvm
# find where java-17 is at /usr/lib/jvm then set JAVA_HOME to its path
# https://stackoverflow.com/questions/57968497/how-do-i-set-an-env-var-with-a-bash-expression-in-github-actions
run: |
fdfind java-17 | xargs readlink -f | awk '{print "JAVA_HOME="$1""}' >> $GITHUB_ENV
echo $JAVA_HOME
- name: build
working-directory: ./ATG
# only build no testing
run: |
echo $JAVA_HOME
./gradlew assembleDebug
# TODO: run unit tests both pure unit tests and instrumented one


billing-hack:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: "true"

- name: "install build dependecies"
run: sudo apt-get install openjdk-17-jdk-headless fd-find

- name: "setup JAVA_HOME to java 17"
working-directory: /usr/lib/jvm
# find where java-17 is at /usr/lib/jvm then set JAVA_HOME to its path
# https://stackoverflow.com/questions/57968497/how-do-i-set-an-env-var-with-a-bash-expression-in-github-actions
run: |
fdfind java-17 | xargs readlink -f | awk '{print "JAVA_HOME="$1""}' >> $GITHUB_ENV
echo $JAVA_HOME
- name: build
working-directory: ./billing-hack
# only build no testing
run: ./gradlew assembleDebug
15 changes: 10 additions & 5 deletions Modder/injector/gen_smali.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
import tempfile

# ============================= paths ==================
APK_SOURCE_ROOT_DIR = "./apk_source/hello-libs"
APK_SOURCE_ROOT_DIR = os.path.join("apk_source", "hello-libs")
APK_BUILT_OUTPUT_PATH = (
"apk_source/hello-libs/app/build/outputs/apk/debug/app-debug.apk"
os.path.join("apk_source", "hello-libs", "app","build","outputs","apk", "debug", "app-debug.apk")
)

OUT_CODE_FOR_INJECT_DIR = (
"../../Modder/modder/src/main/resources/AceAndroidLib/code_to_inject"
os.path.join("..", "..", "Modder","modder","src","main", "resources", "AceAndroidLib", "code_to_inject")
)
SMALI_RELATIVE_DIR = "smali/com/AceInjector"
SMALI_RELATIVE_DIR = os.path.join("smali", "com", "AceInjector")

OUT_SMALI_DIR = os.path.join(OUT_CODE_FOR_INJECT_DIR, SMALI_RELATIVE_DIR)
OUT_SMALI_DIR_ZIPPED_FILE = OUT_SMALI_DIR
Expand All @@ -59,7 +59,12 @@ def cp_folder(src: str, dest: str):
generated_native_lib_dir = os.path.join(temp_decompiled_apk_dir, "lib")

print("Generating temporary apk")
subprocess.run("gradle assembleDebug", cwd=APK_SOURCE_ROOT_DIR, shell=True)


if os.name == "posix":
subprocess.run("./gradlew assembleDebug", cwd=APK_SOURCE_ROOT_DIR, shell=True)
else:
subprocess.run("gradlew assembleDebug", cwd=APK_SOURCE_ROOT_DIR, shell=True)

# decode without resources and
# put the smali results in smali folder
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

<br>

[![AceTheGame CI](https://github.com/KuhakuPixel/AceTheGame/actions/workflows/main.yml/badge.svg)](https://github.com/KuhakuPixel/AceTheGame/actions/workflows/main.yml)
[![Github All Releases](https://img.shields.io/github/downloads/KuhakuPixel/AceTheGame/total.svg)]()

## Ace The Game
Expand Down

0 comments on commit a0384c4

Please sign in to comment.