ci: build on Ubunt, macOS and Windows #211
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Commit | |
on: [push] | |
env: | |
CI_NAME: Commit CI | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- ubuntu-22.04 | |
- macos-13 | |
- windows-2022 | |
steps: | |
- name: Fetch source code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get branch name | |
id: vars | |
run: | | |
echo ${GITHUB_REF#refs/*/} | |
echo CI_BRANCH=${GITHUB_REF#refs/*/} >> $GITHUB_ENV | |
- name: Calculate JNI cache hash | |
id: cache-hash | |
shell: bash | |
run: script/cache-hash.sh | |
- name: Fetch JNI cache | |
uses: actions/cache@v3 | |
id: jni-cache | |
with: | |
path: "app/prebuilt" | |
key: jni-debug-${{ steps.cache-hash.outputs.hash }} | |
- name: Fetch submodules | |
if: ${{ !steps.jni-cache.outputs.cache-hit }} | |
run: | | |
git submodule update --init --recursive | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: "temurin" | |
java-version: 17 | |
# will restore cache of dependencies and wrappers | |
cache: 'gradle' | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v3 | |
- name: Install Android NDK | |
run: | | |
sdkmanager --install "cmake;3.22.1" | |
- 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 }} | |
shell: bash | |
run: cp -R app/build/intermediates/stripped_native_libs/debug/out/lib app/prebuilt | |
- name: Upload APK artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: trime | |
path: app/build/outputs/apk/**/*.apk | |
# keep 90 days | |
retention-days: 90 | |
- 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 | |
# keep 90 days | |
retention-days: 90 | |
- name: Upload JNI artifact (librime_jni.so) | |
uses: actions/upload-artifact@v3 | |
with: | |
name: librime_jni | |
path: app/build/intermediates/stripped_native_libs/debug/out/lib/* | |
# keep 90 days | |
retention-days: 90 |