ci: Add CI #8
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: 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 | |
env: | |
BUILD_ABI: armeabi-v7a,arm64-v8a,x86,x86_64 | |
steps: | |
- name: Fetch source code | |
uses: actions/checkout@v4 | |
with: | |
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: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "temurin" | |
java-version: 17 | |
# will restore cache of dependencies and wrappers | |
cache: 'gradle' | |
- uses: Swatinem/rust-cache@v2 | |
- name: Add Rust components | |
run: | | |
rustup component add clippy rustfmt | |
rustup target add \ | |
aarch64-linux-android \ | |
armv7-linux-androideabi \ | |
i686-linux-android \ | |
x86_64-linux-android --toolchain stable-x86_64-unknown-linux-gnu | |
cargo install cbindgen | |
- name: Fetch JNI cache | |
uses: actions/cache@v4 | |
id: jni-cache | |
with: | |
path: "app/prebuilt" | |
key: afrim-jni | |
- name: Fetch submodules | |
run: | | |
git submodule update --init --recursive | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v3 | |
- name: Generate the C bindgen | |
run: | | |
make cbindgen | |
- name: Check code style | |
run: | | |
make style-check | |
# `make debug` works not well on Windows | |
- name: Build debug Afrim | |
run: | | |
./gradlew :app:assembleDebug | |
- name: Add JNI cache | |
shell: bash | |
run: cp -R app/build/intermediates/stripped_native_libs/debug/out/lib app/prebuilt | |
- name: Upload APK artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: afrim-debug | |
path: app/build/outputs/apk/debug/ | |
# keep 30 days | |
retention-days: 30 |