actions: runs on windows
使用 Windows 執行 Workfolws 能比 Linux 節省1倍的 Actions 份額
This commit is contained in:
parent
307660038e
commit
094be621af
|
|
@ -8,8 +8,8 @@ on:
|
|||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
name: 構建
|
||||
runs-on: windows-latest
|
||||
env:
|
||||
CCACHE_COMPILERCHECK: '%compiler% -dumpmachine; %compiler% -dumpversion'
|
||||
CCACHE_NOHASHDIR: 'true'
|
||||
|
|
@ -17,114 +17,120 @@ jobs:
|
|||
CCACHE_BASEDIR: '${{ github.workspace }}'
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
- name: 檢出程式碼
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
ref: ${{ github.sha }}
|
||||
submodules: 'recursive'
|
||||
fetch-depth: 0
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cache CCACHE
|
||||
- name: 設定快取
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.ccache
|
||||
path: $env:USERPROFILE\.ccache
|
||||
key: ${{ runner.os }}-ccache-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-ccache-
|
||||
|
||||
- name: Write signing key if needed
|
||||
- name: 如果需要,則寫入簽名密鑰
|
||||
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
|
||||
shell: powershell
|
||||
run: |
|
||||
if [ ! -z "${{ secrets.KEY_STORE }}" ]; then
|
||||
echo androidStorePassword='${{ secrets.KEY_STORE_PASSWORD }}' >> gradle.properties
|
||||
echo androidKeyAlias='${{ secrets.ALIAS }}' >> gradle.properties
|
||||
echo androidKeyPassword='${{ secrets.KEY_PASSWORD }}' >> gradle.properties
|
||||
echo androidStoreFile='key.jks' >> gradle.properties
|
||||
echo ${{ secrets.KEY_STORE }} | base64 --decode > key.jks
|
||||
fi
|
||||
if (-not [string]::IsNullOrEmpty("${{ secrets.KEY_STORE }}")) {
|
||||
"androidStorePassword='${{ secrets.KEY_STORE_PASSWORD }}'" | Out-File -Append -FilePath gradle.properties
|
||||
"androidKeyAlias='${{ secrets.ALIAS }}'" | Out-File -Append -FilePath gradle.properties
|
||||
"androidKeyPassword='${{ secrets.KEY_PASSWORD }}'" | Out-File -Append -FilePath gradle.properties
|
||||
"androidStoreFile='key.jks'" | Out-File -Append -FilePath gradle.properties
|
||||
[System.Convert]::FromBase64String("${{ secrets.KEY_STORE }}") | Set-Content -Path key.jks -Encoding Byte
|
||||
}
|
||||
|
||||
- name: Checkout libxposed/api
|
||||
- name: 檢出 libxposed/api
|
||||
uses: actions/checkout@main
|
||||
with:
|
||||
repository: libxposed/api
|
||||
path: libxposed/api
|
||||
ref: 54582730315ba4a3d7cfaf9baf9d23c419e07006
|
||||
|
||||
- name: Checkout libxposed/service
|
||||
- name: 檢出 libxposed/service
|
||||
uses: actions/checkout@main
|
||||
with:
|
||||
repository: libxposed/service
|
||||
path: libxposed/service
|
||||
|
||||
- name: Setup Java
|
||||
- name: 設定 Java
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'adopt'
|
||||
|
||||
- name: Setup Gradle
|
||||
- name: 設定 Gradle
|
||||
uses: gradle/actions/setup-gradle@v5
|
||||
|
||||
- name: Setup Android SDK
|
||||
- name: 設定 Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
|
||||
- name: Setup ninja
|
||||
- name: 設定 ninja
|
||||
uses: seanmiddleditch/gha-setup-ninja@master
|
||||
with:
|
||||
version: 1.12.0
|
||||
|
||||
- name: Remove Android's cmake
|
||||
shell: bash
|
||||
run: rm -rf "$ANDROID_HOME/cmake"
|
||||
- name: 移除 Android 的 cmake
|
||||
shell: powershell
|
||||
run: Remove-Item -Path "$env:ANDROID_HOME\cmake" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
|
||||
- name: Setup build environment properties
|
||||
- name: 設定構建環境
|
||||
shell: powershell
|
||||
run: |
|
||||
# for libxposed/api build
|
||||
echo 'org.gradle.jvmargs=-Xmx2048m' >> libxposed/api/gradle.properties
|
||||
"org.gradle.jvmargs=-Xmx2048m" | Out-File -Append -FilePath libxposed/api/gradle.properties
|
||||
|
||||
# for main project build
|
||||
{
|
||||
echo 'org.gradle.parallel=true'
|
||||
echo 'org.gradle.jvmargs=-Xmx2048m'
|
||||
echo 'android.native.buildOutput=verbose'
|
||||
} >> gradle.properties
|
||||
"org.gradle.parallel=true" | Out-File -Append -FilePath gradle.properties
|
||||
"org.gradle.jvmargs=-Xmx2048m" | Out-File -Append -FilePath gradle.properties
|
||||
"android.native.buildOutput=verbose" | Out-File -Append -FilePath gradle.properties
|
||||
|
||||
# for libxposed dependencies build
|
||||
echo 'org.gradle.jvmargs=-Xmx2048m' >> libxposed/api/gradle.properties
|
||||
echo 'org.gradle.jvmargs=-Xmx2048m' >> libxposed/service/gradle.properties
|
||||
"org.gradle.jvmargs=-Xmx2048m" | Out-File -Append -FilePath libxposed/service/gradle.properties
|
||||
|
||||
- name: Grant execution permission to gradlew
|
||||
- name: 授予 gradlew 執行權限
|
||||
run: chmod +x gradlew
|
||||
|
||||
- name: Build dependencies with Gradle
|
||||
- name: 使用 Gradle 構建依賴項
|
||||
working-directory: libxposed
|
||||
shell: powershell
|
||||
run: |
|
||||
cd api
|
||||
echo 'org.gradle.jvmargs=-Xmx2048m' >> gradle.properties
|
||||
./gradlew :api:publishApiPublicationToMavenLocal
|
||||
"org.gradle.jvmargs=-Xmx2048m" | Out-File -Append -FilePath gradle.properties
|
||||
.\gradlew.bat :api:publishApiPublicationToMavenLocal
|
||||
|
||||
cd ../service
|
||||
echo 'org.gradle.jvmargs=-Xmx2048m' >> gradle.properties
|
||||
./gradlew :interface:publishInterfacePublicationToMavenLocal
|
||||
"org.gradle.jvmargs=-Xmx2048m" | Out-File -Append -FilePath gradle.properties
|
||||
.\gradlew.bat :interface:publishInterfacePublicationToMavenLocal
|
||||
|
||||
- name: Set short commit id
|
||||
run: echo "commit=$(echo ${{ github.sha }} | cut -c-7)" > $GITHUB_ENV
|
||||
- name: 設定 commit id
|
||||
shell: powershell
|
||||
run: |
|
||||
$commit = "${{ github.sha }}".Substring(0, 7)
|
||||
echo "commit=$commit" | Out-File -FilePath $env:GITHUB_ENV -Append
|
||||
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew buildAll
|
||||
- name: 使用 Gradle 構建
|
||||
run: .\gradlew.bat buildAll
|
||||
|
||||
- name: Upload Release artifact
|
||||
- name: 上傳 Release Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: npatch-release-${{ env.commit }}
|
||||
path: out/release/*
|
||||
retention-days: 7
|
||||
|
||||
- name: Upload Debug artifact
|
||||
- name: 上傳 Debug Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: npatch-debug-${{ env.commit }}
|
||||
path: out/debug/*
|
||||
retention-days: 7
|
||||
|
||||
- name: Upload mappings
|
||||
- name: 上傳 mappings
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: mappings-${{ env.commit }}
|
||||
|
|
@ -132,9 +138,9 @@ jobs:
|
|||
patch-loader/build/outputs/mapping
|
||||
manager/build/outputs/mapping
|
||||
|
||||
- name: Upload symbols
|
||||
- name: 上傳 symbols
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: symbols-${{ env.commit }}
|
||||
path: |
|
||||
patch-loader/build/symbols
|
||||
patch-loader/build/symbols
|
||||
|
|
@ -5,13 +5,13 @@ on:
|
|||
|
||||
jobs:
|
||||
clean:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: 删除 Gradle 缓存
|
||||
run: rm -rf ~/.gradle/caches/
|
||||
- name: 刪除 Gradle 緩存
|
||||
run: Remove-Item -Path $env:USERPROFILE\.gradle\caches -Recurse -Force -ErrorAction SilentlyContinue
|
||||
|
||||
- name: 删除 m2 缓存
|
||||
run: rm -rf ~/.m2/repository/
|
||||
- name: 刪除 m2 緩存
|
||||
run: Remove-Item -Path $env:USERPROFILE\.m2\repository -Recurse -Force -ErrorAction SilentlyContinue
|
||||
|
||||
- name: 删除 ccache 缓存
|
||||
run: rm -rf ~/.ccache/
|
||||
- name: 刪除 ccache 緩存
|
||||
run: Remove-Item -Path $env:USERPROFILE\.ccache -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Loading…
Reference in New Issue