Skip to content

Commit 7b30d1d

Browse files
WhiredPlanckBambooin
authored andcommitted
ci: build on Ubuntu, macOS and Windows
1 parent 70c68d4 commit 7b30d1d

File tree

2 files changed

+65
-26
lines changed

2 files changed

+65
-26
lines changed

.github/workflows/commit-ci.yml

+30-14
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
name: commit ci
1+
name: Commit
22
on: [push]
3+
34
env:
45
CI_NAME: Commit CI
56
jobs:
67
build:
7-
runs-on: ubuntu-latest
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
os:
12+
- ubuntu-22.04
13+
- macos-13
14+
- windows-2022
815
steps:
9-
- name: Checkout
10-
uses: actions/checkout@v3
16+
- name: Fetch source code
17+
uses: actions/checkout@v4
1118
with:
1219
fetch-depth: 0
1320

@@ -19,6 +26,7 @@ jobs:
1926
2027
- name: Calculate JNI cache hash
2128
id: cache-hash
29+
shell: bash
2230
run: script/cache-hash.sh
2331

2432
- name: Fetch JNI cache
@@ -44,29 +52,37 @@ jobs:
4452
- name: Setup Android SDK
4553
uses: android-actions/setup-android@v3
4654

47-
- name: Install dependency
48-
run: ./script/dependency.sh
55+
- name: Install Android NDK
56+
run: |
57+
sdkmanager --install "cmake;3.22.1"
58+
59+
- name: Setup Gradle
60+
uses: gradle/gradle-build-action@v2
4961

50-
- name: Build Trime
51-
run: make debug
62+
# `make debug` works not well on Windows
63+
- name: Build Debug APK
64+
run: |
65+
./gradlew spotlessCheck
66+
./gradlew :app:assembleDebug
5267
5368
- name: Add JNI cache
5469
if: ${{ !steps.jni-cache.outputs.cache-hit }}
70+
shell: bash
5571
run: cp -R app/build/intermediates/stripped_native_libs/debug/out/lib app/prebuilt
5672

57-
- name: Upload Trime artifact
73+
- name: Upload APK artifact
5874
uses: actions/upload-artifact@v3
5975
with:
60-
name: trime
61-
path: app/build/outputs/apk/**/*.apk
76+
name: trime-${{ matrix.os }}
77+
path: app/build/outputs/apk/debug/
6278
# keep 90 days
6379
retention-days: 90
6480

65-
- name: Upload Trime artifact (ARM64_V8A only)
81+
- name: Upload APK artifact (ARM64_V8A only)
6682
uses: actions/upload-artifact@v3
6783
with:
68-
name: trime_arm64_v8a
69-
path: app/build/outputs/apk/**/*arm64-v8a-*.apk
84+
name: trime-arm64-v8a-${{ matrix.os }}
85+
path: app/build/outputs/apk/debug/*arm64-v8a-*.apk
7086
# keep 90 days
7187
retention-days: 90
7288

.github/workflows/pull-request-ci.yml

+35-12
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
1-
name: pull request ci
2-
on: [pull_request]
1+
name: Pull Request
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
# pull request's head branch was updated
9+
- synchronize
10+
311
env:
412
CI_NAME: Pull Request CI
513
jobs:
614
build:
7-
runs-on: ubuntu-latest
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
matrix:
18+
os:
19+
- ubuntu-22.04
20+
- macos-13
21+
- windows-2022
822
steps:
9-
- name: Checkout
10-
uses: actions/checkout@v3
23+
- name: Fetch source code
24+
uses: actions/checkout@v4
1125
with:
1226
fetch-depth: 0
1327

@@ -19,6 +33,7 @@ jobs:
1933
2034
- name: Calculate JNI cache hash
2135
id: cache-hash
36+
shell: bash
2237
run: script/cache-hash.sh
2338

2439
- name: Fetch JNI cache
@@ -44,20 +59,28 @@ jobs:
4459
- name: Setup Android SDK
4560
uses: android-actions/setup-android@v3
4661

47-
- name: Install dependency
48-
run: ./script/dependency.sh
62+
- name: Install Android NDK
63+
run: |
64+
sdkmanager --install "cmake;3.22.1"
4965
50-
- name: Build Trime
51-
run: make debug
66+
- name: Setup Gradle
67+
uses: gradle/gradle-build-action@v2
68+
69+
# `make debug` works not well on Windows
70+
- name: Build Debug APK
71+
run: |
72+
./gradlew spotlessCheck
73+
./gradlew :app:assembleDebug
5274
5375
- name: Add JNI cache
5476
if: ${{ !steps.jni-cache.outputs.cache-hit }}
77+
shell: bash
5578
run: cp -R app/build/intermediates/stripped_native_libs/debug/out/lib app/prebuilt
5679

57-
- name: Upload Trime artifact
80+
- name: Upload APK artifact
5881
uses: actions/upload-artifact@v3
5982
with:
60-
name: trime.zip
61-
path: app/build/outputs/apk/**/*.apk
83+
name: trime-${{ matrix.os }}
84+
path: app/build/outputs/apk/debug/
6285
# keep 30 days
6386
retention-days: 30

0 commit comments

Comments
 (0)