146 lines
3.5 KiB
YAML
Raw Normal View History

name: Magisk Build
on:
push:
2023-05-10 00:10:19 -07:00
branches: [master]
2020-12-28 16:38:25 -08:00
paths:
2023-05-10 00:10:19 -07:00
- "app/**"
- "native/**"
- "stub/**"
- "buildSrc/**"
- "build.py"
- "gradle.properties"
- ".github/workflows/build.yml"
pull_request:
2023-05-10 00:10:19 -07:00
branches: [master]
workflow_dispatch:
jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
2023-05-10 00:10:19 -07:00
os: [ubuntu-latest, windows-latest, macos-latest]
2021-09-07 22:50:47 -07:00
env:
2022-09-22 10:10:47 +08:00
NDK_CCACHE: ccache
2021-09-08 16:40:33 +08:00
CCACHE_DIR: ${{ github.workspace }}/.ccache
2022-09-22 10:10:47 +08:00
CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion"
RUSTC_WRAPPER: sccache
steps:
- name: Check out
2022-10-18 23:05:16 +08:00
uses: actions/checkout@v3
with:
2023-05-10 00:10:19 -07:00
submodules: "recursive"
fetch-depth: 0
2022-10-18 23:05:16 +08:00
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
2023-05-10 00:10:19 -07:00
distribution: "temurin"
java-version: "17"
- name: Set up Python 3
2022-10-18 23:05:16 +08:00
uses: actions/setup-python@v4
with:
2023-05-10 00:10:19 -07:00
python-version: "3.x"
2021-09-07 22:50:47 -07:00
- name: Set up ccache
2022-09-22 10:10:47 +08:00
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ runner.os }}-${{ github.sha }}
restore-keys: ${{ runner.os }}
- name: Set up sccache
uses: hendrikmuhs/ccache-action@v1.2
with:
variant: sccache
key: ${{ runner.os }}-${{ github.sha }}
restore-keys: ${{ runner.os }}
2021-09-08 01:16:26 -07:00
- name: Cache Gradle dependencies
2022-10-18 23:05:16 +08:00
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
2021-09-08 01:16:26 -07:00
!~/.gradle/caches/build-cache-*
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: ${{ runner.os }}-gradle-
2021-09-08 01:16:26 -07:00
- name: Cache build cache
2022-10-18 23:05:16 +08:00
uses: actions/cache@v3
2021-09-07 22:50:47 -07:00
with:
2021-09-08 01:16:26 -07:00
path: |
~/.gradle/caches/build-cache-*
key: ${{ runner.os }}-build-cache-${{ github.sha }}
restore-keys: ${{ runner.os }}-build-cache-
2021-09-07 22:50:47 -07:00
- name: Set up NDK
2021-09-08 01:16:26 -07:00
run: python build.py -v ndk
- name: Build release
2021-09-07 22:50:47 -07:00
run: |
python build.py -vr all
- name: Build debug
2021-09-07 22:50:47 -07:00
run: |
python build.py -v all
- name: Stop gradle daemon
run: ./gradlew --stop
# Only upload artifacts built on Linux
- name: Upload build artifact
if: runner.os == 'Linux'
2022-10-18 23:05:16 +08:00
uses: actions/upload-artifact@v3
with:
2020-12-25 15:54:47 -08:00
name: ${{ github.sha }}
path: out
- name: Upload mapping and native debug symbols
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
with:
name: ${{ github.sha }}-symbols
path: app/build/outputs
2023-04-25 04:54:46 +08:00
2023-05-10 00:10:19 -07:00
test:
name: Test on ${{ matrix.api }}
runs-on: macos-latest
needs: build
strategy:
fail-fast: false
matrix:
api: [23, 26, 28, 29, 33]
steps:
- name: Check out
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: ${{ github.sha }}
path: out
2023-04-25 04:54:46 +08:00
- name: AVD test
run: |
brew install coreutils
2023-05-10 00:10:19 -07:00
scripts/avd_test.sh ${{ matrix.api }}