From 3af44f33cc69aaec96f0c7f182efdbbf959a6fed Mon Sep 17 00:00:00 2001 From: WhiredPlanck Date: Tue, 5 Dec 2023 00:30:13 +0800 Subject: [PATCH] ci: build on Ubunt, macOS and Windows --- .github/workflows/commit-ci.yml | 33 +++++++++++++++------- .github/workflows/pull-request-ci.yml | 40 ++++++++++++++++++++------- 2 files changed, 53 insertions(+), 20 deletions(-) diff --git a/.github/workflows/commit-ci.yml b/.github/workflows/commit-ci.yml index 3b729aadf7..7eb83b7b28 100644 --- a/.github/workflows/commit-ci.yml +++ b/.github/workflows/commit-ci.yml @@ -1,13 +1,20 @@ -name: commit ci +name: Commit on: [push] + env: CI_NAME: Commit CI jobs: build: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-22.04 + - macos-13 + - windows-2022 steps: - - name: Checkout - uses: actions/checkout@v3 + - name: Fetch source code + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -44,17 +51,23 @@ jobs: - name: Setup Android SDK uses: android-actions/setup-android@v3 - - name: Install dependency - run: ./script/dependency.sh + - name: Install Android NDK + run: | + sdkmanager --install "cmake;3.22.1" + + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 - - name: Build Trime - run: make debug + - name: Build Debug APK + run: | + ./gradlew spotlessCheck + ./gradlew :app:assembleDebug - name: Add JNI cache if: ${{ !steps.jni-cache.outputs.cache-hit }} run: cp -R app/build/intermediates/stripped_native_libs/debug/out/lib app/prebuilt - - name: Upload Trime artifact + - name: Upload APK artifact uses: actions/upload-artifact@v3 with: name: trime @@ -62,7 +75,7 @@ jobs: # keep 90 days retention-days: 90 - - name: Upload Trime artifact (ARM64_V8A only) + - name: Upload APK artifact (ARM64_V8A only) uses: actions/upload-artifact@v3 with: name: trime_arm64_v8a diff --git a/.github/workflows/pull-request-ci.yml b/.github/workflows/pull-request-ci.yml index 06607e7366..51ff1da878 100644 --- a/.github/workflows/pull-request-ci.yml +++ b/.github/workflows/pull-request-ci.yml @@ -1,13 +1,27 @@ -name: pull request ci -on: [pull_request] +name: Pull Request + +on: + pull_request: + types: + - opened + - reopened + # pull request's head branch was updated + - synchronize + env: CI_NAME: Pull Request CI jobs: build: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-22.04 + - macos-13 + - windows-2022 steps: - - name: Checkout - uses: actions/checkout@v3 + - name: Fetch source code + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -44,17 +58,23 @@ jobs: - name: Setup Android SDK uses: android-actions/setup-android@v3 - - name: Install dependency - run: ./script/dependency.sh + - name: Install Android NDK + run: | + sdkmanager --install "cmake;3.22.1" - - name: Build Trime - run: make debug + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + + - name: Build Debug APK + run: | + ./gradlew spotlessCheck + ./gradlew :app:assembleDebug - name: Add JNI cache if: ${{ !steps.jni-cache.outputs.cache-hit }} run: cp -R app/build/intermediates/stripped_native_libs/debug/out/lib app/prebuilt - - name: Upload Trime artifact + - name: Upload APK artifact uses: actions/upload-artifact@v3 with: name: trime.zip