Skip to content

Commit

Permalink
ci: build on Ubuntu, macOS and Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiredPlanck authored and Bambooin committed Dec 8, 2023
1 parent 70c68d4 commit 7b30d1d
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 26 deletions.
44 changes: 30 additions & 14 deletions .github/workflows/commit-ci.yml
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -19,6 +26,7 @@ jobs:
- name: Calculate JNI cache hash
id: cache-hash
shell: bash
run: script/cache-hash.sh

- name: Fetch JNI cache
Expand All @@ -44,29 +52,37 @@ 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
# `make debug` works not well on Windows
- name: Build Debug APK
run: |
./gradlew spotlessCheck
./gradlew :app:assembleDebug
- name: Add JNI cache
if: ${{ !steps.jni-cache.outputs.cache-hit }}
shell: bash
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
path: app/build/outputs/apk/**/*.apk
name: trime-${{ matrix.os }}
path: app/build/outputs/apk/debug/
# 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
path: app/build/outputs/apk/**/*arm64-v8a-*.apk
name: trime-arm64-v8a-${{ matrix.os }}
path: app/build/outputs/apk/debug/*arm64-v8a-*.apk
# keep 90 days
retention-days: 90

Expand Down
47 changes: 35 additions & 12 deletions .github/workflows/pull-request-ci.yml
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -19,6 +33,7 @@ jobs:
- name: Calculate JNI cache hash
id: cache-hash
shell: bash
run: script/cache-hash.sh

- name: Fetch JNI cache
Expand All @@ -44,20 +59,28 @@ 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

# `make debug` works not well on Windows
- name: Build Debug APK
run: |
./gradlew spotlessCheck
./gradlew :app:assembleDebug
- name: Add JNI cache
if: ${{ !steps.jni-cache.outputs.cache-hit }}
shell: bash
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
path: app/build/outputs/apk/**/*.apk
name: trime-${{ matrix.os }}
path: app/build/outputs/apk/debug/
# keep 30 days
retention-days: 30

0 comments on commit 7b30d1d

Please sign in to comment.