Skip to content

Commit

Permalink
Merge branch 'topjohnwu:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Terre31 authored Oct 20, 2024
2 parents 946cd4b + 455b13b commit 17054dd
Show file tree
Hide file tree
Showing 520 changed files with 5,907 additions and 5,328 deletions.
88 changes: 72 additions & 16 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,100 @@
name: Magisk Setup
inputs:
is-asset-build:
required: false
default: false
runs:
using: "composite"
steps:
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
java-version: "21"

- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Install GNU make
if: runner.os == 'macOS'
shell: bash
run: |
brew install make
echo 'GNUMAKE=gmake' >> "$GITHUB_ENV"
- name: Cache sccache
uses: actions/cache@v4
with:
path: .sccache
key: sccache-${{ runner.os }}-${{ github.sha }}
restore-keys: sccache-${{ runner.os }}-

- name: Set up sccache
uses: hendrikmuhs/[email protected]
shell: bash
env:
SCCACHE_DIRECT: false
SCCACHE_DIR: ${{ github.workspace }}/.sccache
SCCACHE_CACHE_SIZE: 2G
SCCACHE_IDLE_TIMEOUT: 0
run: |
bash $GITHUB_ACTION_PATH/sccache.sh
sccache --start-server
sccache -z
- name: Show sccache stats
uses: gacts/run-and-post-run@v1
with:
variant: sccache
key: ${{ runner.os }}-${{ github.sha }}
restore-keys: ${{ runner.os }}
max-size: 10000M
run: sccache -s
post: sccache -s

- name: Set GRADLE_USER_HOME
shell: bash
run: echo "GRADLE_USER_HOME=$GITHUB_WORKSPACE/.gradle" >> "$GITHUB_ENV"

- name: Cache Gradle dependencies
uses: actions/cache@v4
if: inputs.is-asset-build == 'true'
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
!~/.gradle/caches/build-cache-*
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: ${{ runner.os }}-gradle-
.gradle/caches
.gradle/wrapper
!.gradle/caches/build-cache-*
key: gradle-cache-${{ hashFiles('gradle/**') }}
restore-keys: gradle-cache-

- name: Cache build cache
- name: Restore Gradle dependencies
uses: actions/cache/restore@v4
if: inputs.is-asset-build == 'false'
with:
path: |
.gradle/caches
.gradle/wrapper
!.gradle/caches/build-cache-*
key: gradle-cache-${{ hashFiles('gradle/**') }}
restore-keys: gradle-cache-
enableCrossOsArchive: true

- name: Cache Gradle build cache
uses: actions/cache@v4
if: inputs.is-asset-build == 'true'
with:
path: |
.gradle/caches/build-cache-*
key: gradle-build-cache-${{ github.sha }}
restore-keys: gradle-build-cache-

- name: Restore Gradle build cache
uses: actions/cache/restore@v4
if: inputs.is-asset-build == 'false'
with:
path: |
~/.gradle/caches/build-cache-*
key: ${{ runner.os }}-build-cache-${{ github.sha }}
restore-keys: ${{ runner.os }}-build-cache-
.gradle/caches/build-cache-*
key: gradle-build-cache-${{ github.sha }}
restore-keys: gradle-build-cache-
enableCrossOsArchive: true

- name: Set up NDK
run: python build.py -v ndk
shell: bash
run: python build.py -v ndk
25 changes: 25 additions & 0 deletions .github/actions/setup/sccache.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

# Get latest sccache version
get_sccache_ver() {
curl -sL 'https://api.github.com/repos/mozilla/sccache/releases/latest' | jq -r .name
}

# $1=variant
# $2=install_dir
# $3=exe
install_from_gh() {
local ver=$(curl -sL 'https://api.github.com/repos/mozilla/sccache/releases/latest' | jq -r .name)
local url="https://github.com/mozilla/sccache/releases/download/${ver}/sccache-${ver}-$1.tar.gz"
local dest="$2/$3"
curl -L "$url" | tar xz -O --wildcards "*/$3" > $dest
chmod +x $dest
}

if [ $RUNNER_OS = "macOS" ]; then
brew install sccache
elif [ $RUNNER_OS = "Linux" ]; then
install_from_gh x86_64-unknown-linux-musl /usr/local/bin sccache
elif [ $RUNNER_OS = "Windows" ]; then
install_from_gh x86_64-pc-windows-msvc $USERPROFILE/.cargo/bin sccache.exe
fi
1 change: 1 addition & 0 deletions .github/ci.prop
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
abiList=arm64-v8a
123 changes: 87 additions & 36 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
paths:
- "app/**"
- "native/**"
- "stub/**"
- "buildSrc/**"
- "build.py"
- "gradle.properties"
Expand All @@ -18,20 +17,19 @@ on:
jobs:
build:
name: Build Magisk artifacts
runs-on: ubuntu-latest
env:
SCCACHE_DIRECT: false
runs-on: macos-14
strategy:
fail-fast: false
steps:
- name: Check out
uses: actions/checkout@v4
with:
submodules: "recursive"
fetch-depth: 0

- name: Setup environment
uses: ./.github/actions/setup
with:
is-asset-build: true

- name: Build release
run: ./build.py -vr all
Expand All @@ -53,53 +51,47 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: ${{ github.sha }}-symbols
path: app/build/outputs
path: app/apk/build/outputs
compression-level: 9

test-build:
name: Test building on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
SCCACHE_DIRECT: false
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-14]
os: [windows-latest, ubuntu-latest]
steps:
- name: Check out
uses: actions/checkout@v4
with:
submodules: "recursive"
fetch-depth: 0

- name: Setup environment
uses: ./.github/actions/setup

- name: Build debug
run: python build.py -v all
- name: Test build
run: python build.py -v -c .github/ci.prop all

- name: Stop gradle daemon
run: ./gradlew --stop

test:
name: Test x86_64 on API ${{ matrix.api }}
avd-test:
name: Test API ${{ matrix.version }} (x86_64)
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
api: [23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34]
version: [23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34]
type: [""]
include:
- version: 35
type: "google_apis"

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

- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Download build artifacts
uses: actions/download-artifact@v4
Expand All @@ -113,28 +105,33 @@ jobs:
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: AVD test
run: scripts/avd_test.sh ${{ matrix.api }}
- name: Run AVD test
timeout-minutes: 10
env:
AVD_TEST_LOG: 1
run: scripts/avd_test.sh ${{ matrix.version }} ${{ matrix.type }}

- name: Upload logs on error
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: "avd-logs-${{ matrix.version }}"
path: |
kernel.log
logcat.log
test-32:
name: Test x86 on API ${{ matrix.api }}
avd-test-32:
name: Test API ${{ matrix.version }} (x86)
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
api: [23, 24, 25, 26, 27, 28, 29, 30]
version: [23, 24, 25, 26, 27, 28, 29, 30]

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

- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Download build artifacts
uses: actions/download-artifact@v4
Expand All @@ -148,7 +145,61 @@ jobs:
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: AVD test
- name: Run AVD test
timeout-minutes: 10
env:
FORCE_32_BIT: 1
run: scripts/avd_test.sh ${{ matrix.api }}
AVD_TEST_LOG: 1
run: scripts/avd_test.sh ${{ matrix.version }}

- name: Upload logs on error
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: "avd32-logs-${{ matrix.version }}"
path: |
kernel.log
logcat.log
cf_test:
name: Test ${{ matrix.device }}
runs-on: ubuntu-24.04
needs: build
env:
CF_HOME: /home/runner/aosp_cf_phone
strategy:
fail-fast: false
matrix:
include:
- branch: "aosp-main"
device: "aosp_cf_x86_64_phone"
- branch: "aosp-main-throttled"
device: "aosp_cf_x86_64_phone_pgagnostic"

steps:
- name: Check out
uses: actions/checkout@v4

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: ${{ github.sha }}
path: out

- name: Setup Cuttlefish environment
run: |
scripts/cuttlefish.sh setup
scripts/cuttlefish.sh download ${{ matrix.branch }} ${{ matrix.device }}
- name: Run Cuttlefish test
timeout-minutes: 10
run: su $USER -c 'scripts/cuttlefish.sh test'

- name: Upload logs on error
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: "cvd-logs-${{ matrix.device }}"
path: |
/home/runner/aosp_cf_phone/cuttlefish/instances/cvd-1/logs
/home/runner/aosp_cf_phone/cuttlefish/instances/cvd-1/cuttlefish_config.json
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ out
*.jks
*.apk
/config.prop
/notes.md
/update.sh
/dict.txt
/app/dict.txt

# Built binaries
native/out

# Android Studio / Gradle
*.iml
.gradle
.idea
/local.properties
/.idea
/build
/captures
6 changes: 0 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[submodule "selinux"]
path = native/src/external/selinux
url = https://github.com/topjohnwu/selinux.git
[submodule "busybox"]
path = native/src/external/busybox
url = https://github.com/topjohnwu/ndk-busybox.git
[submodule "lz4"]
path = native/src/external/lz4
url = https://github.com/lz4/lz4.git
Expand All @@ -13,9 +10,6 @@
[submodule "xz"]
path = native/src/external/xz
url = https://github.com/xz-mirror/xz.git
[submodule "pcre"]
path = native/src/external/pcre
url = https://android.googlesource.com/platform/external/pcre
[submodule "libcxx"]
path = native/src/external/libcxx
url = https://github.com/topjohnwu/libcxx.git
Expand Down
Loading

0 comments on commit 17054dd

Please sign in to comment.