mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-25 02:55:33 +00:00
Fix GitHub actions
This commit is contained in:
parent
18340099b7
commit
ab78a81d15
17
.github/workflows/build.yml
vendored
17
.github/workflows/build.yml
vendored
@ -39,12 +39,17 @@ jobs:
|
|||||||
$oldAndroidPath = $env:ANDROID_SDK_ROOT
|
$oldAndroidPath = $env:ANDROID_SDK_ROOT
|
||||||
$sdk_root = "C:\Android"
|
$sdk_root = "C:\Android"
|
||||||
New-Item -Path $sdk_root -ItemType SymbolicLink -Value $oldAndroidPath
|
New-Item -Path $sdk_root -ItemType SymbolicLink -Value $oldAndroidPath
|
||||||
|
$ndk_ver = Select-String -Path "gradle.properties" -Pattern "^magisk.fullNdkVersion=" | % { $_ -replace ".*=" }
|
||||||
echo "ANDROID_SDK_ROOT=$sdk_root" >> $env:GITHUB_ENV
|
echo "ANDROID_SDK_ROOT=$sdk_root" >> $env:GITHUB_ENV
|
||||||
echo "ANDROID_HOME=$sdk_root" >> $env:GITHUB_ENV
|
echo "ANDROID_HOME=$sdk_root" >> $env:GITHUB_ENV
|
||||||
|
echo "MAGISK_NDK_VERSION=$ndk_ver" >> $env:GITHUB_ENV
|
||||||
|
|
||||||
- name: Set up GitHub env (Unix)
|
- name: Set up GitHub env (Unix)
|
||||||
if: runner.os != 'Windows'
|
if: runner.os != 'Windows'
|
||||||
run: echo ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT >> $GITHUB_ENV
|
run: |
|
||||||
|
ndk_ver=$(sed -n 's/^magisk.fullNdkVersion=//p' gradle.properties)
|
||||||
|
echo ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT >> $GITHUB_ENV
|
||||||
|
echo MAGISK_NDK_VERSION=$ndk_ver >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Cache Gradle
|
- name: Cache Gradle
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
@ -60,22 +65,22 @@ jobs:
|
|||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ env.ANDROID_SDK_ROOT }}/ndk/magisk
|
path: ${{ env.ANDROID_SDK_ROOT }}/ndk/magisk
|
||||||
key: ${{ runner.os }}-ndk-${{ hashFiles('gradle.properties') }}
|
key: ${{ runner.os }}-ndk-${{ env.MAGISK_NDK_VERSION }}
|
||||||
|
|
||||||
- name: Set up NDK
|
- name: Set up NDK
|
||||||
if: steps.ndk-cache.outputs.cache-hit != 'true'
|
if: steps.ndk-cache.outputs.cache-hit != 'true'
|
||||||
run: python3 build.py ndk
|
run: python build.py ndk
|
||||||
|
|
||||||
- name: Build release
|
- name: Build release
|
||||||
run: python3 build.py -vr all
|
run: python build.py -vr all
|
||||||
|
|
||||||
- name: Build debug
|
- name: Build debug
|
||||||
run: python3 build.py -v all
|
run: python build.py -v all
|
||||||
|
|
||||||
# Only upload artifacts built on Linux
|
# Only upload artifacts built on Linux
|
||||||
- name: Upload build artifact
|
- name: Upload build artifact
|
||||||
if: runner.os == 'Linux' && github.event_name != 'pull_request'
|
if: runner.os == 'Linux' && github.event_name != 'pull_request'
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: ${{ github.sha }}-artifact
|
name: ${{ github.sha }}
|
||||||
path: out
|
path: out
|
||||||
|
14
build.py
14
build.py
@ -4,18 +4,26 @@ import os
|
|||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
is_windows = os.name == 'nt'
|
is_windows = os.name == 'nt'
|
||||||
if is_windows:
|
is_ci = 'CI' in os.environ and os.environ['CI'] == 'true'
|
||||||
|
|
||||||
|
if not is_ci and is_windows:
|
||||||
import colorama
|
import colorama
|
||||||
colorama.init()
|
colorama.init()
|
||||||
|
|
||||||
|
|
||||||
def error(str):
|
def error(str):
|
||||||
print('\n' + '\033[41m' + str + '\033[0m' + '\n')
|
if is_ci:
|
||||||
|
print(f'\n ! {str}\n')
|
||||||
|
else:
|
||||||
|
print(f'\n\033[41m{str}\033[0m\n')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def header(str):
|
def header(str):
|
||||||
print('\n' + '\033[44m' + str + '\033[0m' + '\n')
|
if is_ci:
|
||||||
|
print(f'\n{str}\n')
|
||||||
|
else:
|
||||||
|
print(f'\n\033[44m{str}\033[0m\n')
|
||||||
|
|
||||||
|
|
||||||
def vprint(str):
|
def vprint(str):
|
||||||
|
Loading…
Reference in New Issue
Block a user