-
-
Notifications
You must be signed in to change notification settings - Fork 377
97 lines (83 loc) · 2.46 KB
/
pull-request-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# SPDX-FileCopyrightText: 2015 - 2024 Rime community
#
# SPDX-License-Identifier: GPL-3.0-or-later
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: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-24.04
- macos-15
- windows-2022
env:
BUILD_ABI: armeabi-v7a,arm64-v8a,x86,x86_64
steps:
- name: Fetch source code
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Get branch name
id: vars
shell: bash
run: |
echo ${GITHUB_REF#refs/*/}
echo CI_BRANCH=${GITHUB_REF#refs/*/} >> $GITHUB_ENV
- name: Install macOS dependency
if: startsWith(matrix.os, 'macos')
run: |
brew install coreutils clang-format
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 17
# will restore cache of dependencies and wrappers
cache: 'gradle'
- name: Calculate JNI cache hash
id: cache-hash
run: |
./gradlew :app:calculateNativeCacheHash
- name: Fetch JNI cache
uses: actions/cache@v4
id: jni-cache
with:
path: "app/prebuilt"
key: ${{ matrix.os }}-trime-jni-debug-${{ steps.cache-hash.outputs.native-cache-hash }}
- name: Fetch submodules
if: ${{ !steps.jni-cache.outputs.cache-hit }}
run: |
git submodule update --init --recursive
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Check code style
if: ${{ !startsWith(matrix.os, 'windows') }}
run: |
make style-lint
# `make debug` works not well on Windows
- name: Build debug Trime
run: |
./gradlew :app:assembleDebug
- name: Add JNI cache
if: ${{ !steps.jni-cache.outputs.cache-hit }}
shell: bash
run: cp -R app/build/intermediates/merged_native_libs/debug/mergeDebugNativeLibs/out/lib app/prebuilt
- name: Upload APK artifact
uses: actions/upload-artifact@v4
with:
name: trime-${{ matrix.os }}
path: app/build/outputs/apk/debug/
# keep 30 days
retention-days: 30