Files
mozc/.github/workflows/android.yaml
Yohei Yukawa f215eaf71a Extract out Android build instructions (#1191)
This is the first part towards removing the dependency on Docker from
our build instructions for Linux desktop and Android (#1181).

This commit makes it clear that you can build 'libmozc.so' on both Linux
and macOS by the same Bazel command with actually demonstrating it in

  .github/workflows/android.yaml

that 'libmozc.so' can be built on both Linux and macOS GitHub Actions
runners.

With above our 'Dockerfile' can stop setting up Android NDK since
'build_mozc_in_docker.md' does not mention Android any more.

This commit is only about the build instructions of 'libmozc.so' for
Android. There must be no difference in the final artifacts.

PiperOrigin-RevId: 729468755
2025-02-21 21:53:44 +09:00

98 lines
2.7 KiB
YAML

name: CI for Android
# https://github.com/google/mozc/blob/master/docs/build_mozc_for_android.md
# Run on push.
on: push
permissions: read-all
# Prevent previous workflows from running.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
env:
PYTHON_VENV_ROOT: ${{ github.workspace }}/src/python-venv
jobs:
build_on_linux:
# https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: setup
run: |
sudo apt-get update
- name: Setup Python
run: |
python3 -m venv ${PYTHON_VENV_ROOT}
source ${PYTHON_VENV_ROOT}/bin/activate
python3 -m pip install requests
- name: Try to restore update_deps cache
uses: actions/cache@v4
with:
path: src/third_party_cache
key: update_deps-${{ runner.os }}-${{ hashFiles('src/build_tools/update_deps.py') }}
- name: Install dependencies
working-directory: ./src
# This command uses src/third_party_cache as the download cache.
run: |
source ${PYTHON_VENV_ROOT}/bin/activate
python3 build_tools/update_deps.py
- name: build
working-directory: ./src
run: |
bazelisk build --config oss_android package --config release_build
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: native_libs.zip
path: src/bazel-bin/android/jni/native_libs.zip
if-no-files-found: warn
build_on_mac:
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md
runs-on: macos-14
timeout-minutes: 60
steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Setup Python
run: |
python3 -m venv ${PYTHON_VENV_ROOT}
source ${PYTHON_VENV_ROOT}/bin/activate
python3 -m pip install requests
- name: Try to restore update_deps cache
uses: actions/cache@v4
with:
path: src/third_party_cache
key: update_deps-${{ runner.os }}-${{ hashFiles('src/build_tools/update_deps.py') }}
- name: Install dependencies
working-directory: ./src
# This command uses src/third_party_cache as the download cache.
run: |
source ${PYTHON_VENV_ROOT}/bin/activate
python3 build_tools/update_deps.py
- name: build
working-directory: ./src
run: |
bazelisk build --config oss_android package --config release_build