Skip to content

Commit

Permalink
add susfs branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizumo-prjkt committed Jan 30, 2025
1 parent 44db63c commit 6cc6670
Show file tree
Hide file tree
Showing 7 changed files with 355 additions and 0 deletions.
135 changes: 135 additions & 0 deletions .github/workflows/build-manager-susfs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: Build Manager - SUSFS Branch

on:
push:
branches: [ "main_susfs", "ci" ]
paths:
- '.github/workflows/build-manager.yml'
- 'manager/**'
- 'kernel/**'
- 'userspace/ksud/**'
pull_request:
branches: [ "main" ]
paths:
- 'manager/**'
workflow_call:

jobs:
build-ksud:
strategy:
matrix:
include:
- target: aarch64-linux-android
os: ubuntu-latest
uses: ./.github/workflows/ksud.yml
with:
target: ${{ matrix.target }}
os: ${{ matrix.os }}

build-manager:
needs: build-ksud
runs-on: ubuntu-latest
environment: signing
defaults:
run:
working-directory: ./manager

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup need_upload
id: need_upload
run: |
if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then
echo "UPLOAD=true" >> $GITHUB_OUTPUT
else
echo "UPLOAD=false" >> $GITHUB_OUTPUT
fi
- name: Write key
if: ${{ ( github.event_name != 'pull_request' && github.ref == 'refs/heads/main' ) || github.ref_type == 'tag' }}
run: |
if [ ! -z "${{ secrets.KEYSTORE }}" ]; then
{
echo "KEYSTORE_PASSWORD=${{ secrets.KEYSTORE_PASSWORD }}"
echo "KEY_ALIAS=${{ secrets.KEY_ALIAS }}"
echo "KEY_PASSWORD=${{ secrets.KEY_PASSWORD }}"
echo "KEYSTORE_FILE=key.jks"
} >> gradle.properties
echo "${{ secrets.KEYSTORE }}" | base64 -d > key.jks
fi
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Setup Android SDK
uses: android-actions/setup-android@v3

- name: Download arm64 ksud
uses: actions/download-artifact@v4
with:
name: ksud-aarch64-linux-android
path: .

- name: Copy ksud to app jniLibs
run: |
cp -f ../aarch64-linux-android/release/ksud ../manager/app/src/main/jniLibs/arm64-v8a/libksud.so
- name: Build with Gradle
run: |
{
echo 'org.gradle.parallel=true'
echo 'org.gradle.vfs.watch=true'
echo 'org.gradle.jvmargs=-Xmx2048m'
echo 'android.native.buildOutput=verbose'
} >> gradle.properties
sed -i 's/org.gradle.configuration-cache=true//g' gradle.properties
./gradlew clean assembleRelease --stacktrace
- name: Upload build artifact
uses: actions/upload-artifact@v4
if: ${{ ( github.event_name != 'pull_request' && github.ref == 'refs/heads/main' ) || github.ref_type == 'tag' }}
with:
name: manager
path: manager/app/build/outputs/apk/release/*.apk

- name: Upload mappings
uses: actions/upload-artifact@v4
if: ${{ ( github.event_name != 'pull_request' && github.ref == 'refs/heads/main' ) || github.ref_type == 'tag' }}
with:
name: "mappings"
path: "manager/app/build/outputs/mapping/release/"

- name: Bot session cache
if: github.event_name != 'pull_request' && steps.need_upload.outputs.UPLOAD == 'true'
id: bot_session_cache
uses: actions/cache@v4
with:
path: scripts/ksubot.session
key: ${{ runner.os }}-bot-session

- name: Upload to telegram
if: github.event_name != 'pull_request' && steps.need_upload.outputs.UPLOAD == 'true'
env:
CHAT_ID: ${{ secrets.CHAT_ID }}
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
MESSAGE_THREAD_ID: ${{ secrets.MESSAGE_THREAD_ID }}
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
COMMIT_URL: ${{ github.event.head_commit.url }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
TITLE: Manager
run: |
if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then
export VERSION=$(git rev-list --count HEAD)
APK=$(find ./app/build/outputs/apk/release -name "*.apk")
bash $GITHUB_WORKSPACE/scripts/rsubot.sh $APK
fi
36 changes: 36 additions & 0 deletions .github/workflows/build-su-susfs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build SU - SUSFS Branch
on:
push:
branches: [ "main_susfs", "ci" ]
paths:
- '.github/workflows/build-su.yml'
- 'userspace/su/**'
- 'scripts/ksubot.py'
pull_request:
branches: [ "main" ]
paths:
- 'userspace/su/**'
jobs:
build-su:
name: Build userspace su
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup need_upload
id: need_upload
run: |
if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then
echo "UPLOAD=true" >> $GITHUB_OUTPUT
else
echo "UPLOAD=false" >> $GITHUB_OUTPUT
fi
- name: Build su
working-directory: ./userspace/su
run: $ANDROID_NDK/ndk-build
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4
with:
name: su
path: ./userspace/su/libs
36 changes: 36 additions & 0 deletions .github/workflows/clippy-susfs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Clippy check - SUSFS - Branch

on:
push:
branches:
- main_susfs
paths:
- '.github/workflows/clippy.yml'
- 'userspace/ksud/**'
pull_request:
branches:
- main
paths:
- '.github/workflows/clippy.yml'
- 'userspace/ksud/**'

env:
RUSTFLAGS: '-Dwarnings'

jobs:
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --force-non-host stable-x86_64-unknown-linux-gnu
- uses: Swatinem/rust-cache@v2
with:
workspaces: userspace/ksud

- name: Install cross
run: |
cargo install cross --git https://github.com/cross-rs/cross --rev 66845c1
- name: Run clippy
run: |
cross clippy --manifest-path userspace/ksud/Cargo.toml --target aarch64-linux-android --release
46 changes: 46 additions & 0 deletions .github/workflows/ksud-susfs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build ksud - SUSFS Branch
on:
workflow_call:
inputs:
target:
required: true
type: string
os:
required: false
type: string
default: ubuntu-latest
use_cache:
required: false
type: boolean
default: true
jobs:
build:
runs-on: ${{ inputs.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Download artifacts
uses: actions/download-artifact@v4

- name: Setup rustup
run: |
rustup update stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: userspace/ksud
cache-targets: false

- name: Install cross
run: |
cargo install cross --git https://github.com/cross-rs/cross --rev 66845c1
- name: Build ksud
run: CROSS_NO_WARNINGS=0 cross build --target ${{ inputs.target }} --release --manifest-path ./userspace/ksud/Cargo.toml

- name: Upload ksud artifact
uses: actions/upload-artifact@v4
with:
name: ksud-${{ inputs.target }}
path: userspace/ksud/target/**/release/ksud*
42 changes: 42 additions & 0 deletions .github/workflows/release-susfs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Release - SUSFS Branch
on:
push:
tags:
- "v*"
workflow_dispatch:

jobs:
build-manager:
uses: ./.github/workflows/build-manager.yml
secrets: inherit
release:
needs:
- build-manager
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Rename ksud
run: |
mkdir -p ksud
for dir in ./ksud-*; do
if [ -d "$dir" ]; then
echo "----- Rename $dir -----"
ksud_platform_name=$(basename "$dir")
find "$dir" -type f -name "ksud" -path "*/release/*" | while read -r ksud_file; do
if [ -f "$ksud_file" ]; then
mv "$ksud_file" "ksud/$ksud_platform_name"
fi
done
fi
done
- name: Display structure of downloaded files
run: ls -R

- name: release
uses: softprops/action-gh-release@v2
with:
files: |
manager/*.apk
ksud/ksud-*
33 changes: 33 additions & 0 deletions .github/workflows/rustfmt-susfs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Rustfmt check - SUSFS Branch

on:
push:
branches:
- 'main_susfs'
paths:
- '.github/workflows/rustfmt.yml'
- 'userspace/ksud/**'
pull_request:
branches:
- 'main'
paths:
- '.github/workflows/rustfmt.yml'
- 'userspace/ksud/**'

permissions:
checks: write

jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt

- uses: LoliGothick/rustfmt-check@master
with:
token: ${{ github.token }}
working-directory: userspace/ksud
27 changes: 27 additions & 0 deletions .github/workflows/shellcheck-susfs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: ShellCheck - SUSFS Branch

on:
push:
branches:
- 'main_susfs'
paths:
- '.github/workflows/shellcheck.yml'
- '**/*.sh'
pull_request:
branches:
- 'main'
paths:
- '.github/workflows/shellcheck.yml'
- '**/*.sh'

jobs:
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Run ShellCheck
uses: ludeeus/action-shellcheck@2.0.0
with:
ignore_names: gradlew
ignore_paths: ./userspace/ksud/src/installer.sh

0 comments on commit 6cc6670

Please sign in to comment.