blob: c0ca0d1d626d61825d8c047ca30f75ef2c3ec063 [file] [log] [blame]
# Copyright 2024 The IREE Authors
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# Workflow for Android cross-compilation and test jobs.
# The concurrency of this workflow is controlled by the caller's job.
name: PkgCI Test Android
on:
workflow_call:
inputs:
artifact_run_id:
type: string
default: ""
write-caches:
required: true
type: string
workflow_dispatch:
inputs:
artifact_run_id:
type: string
default: ""
write-caches:
required: true
type: string
permissions:
contents: read
jobs:
android_arm64:
runs-on: ubuntu-20.04
env:
PACKAGE_DOWNLOAD_DIR: ${{ github.workspace }}/.packages
VENV_DIR: ${{ github.workspace }}/.venv
IREE_TARGET_BUILD_DIR: build-android-arm_64
CC: clang
CXX: clang++
steps:
# General setup.
- name: "Checking out repository"
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: "Checking out runtime submodules"
run: ./build_tools/scripts/git/update_runtime_submodules.sh
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.1.0
with:
# Must match the subset of versions built in pkgci_build_packages.
python-version: "3.11"
- name: ccache
uses: hendrikmuhs/ccache-action@ed74d11c0b343532753ecead8a951bb09bb34bc9 # v1.2.14
with:
key: ${{ github.job }}
save: ${{ inputs.write-caches == 1 }}
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: linux_x86_64_release_packages
path: ${{ env.PACKAGE_DOWNLOAD_DIR }}
- name: Setup base venv
run: |
./build_tools/pkgci/setup_venv.py ${VENV_DIR} \
--artifact-path=${PACKAGE_DOWNLOAD_DIR} \
--fetch-gh-workflow=${{ inputs.artifact_run_id }}
- name: Install build dependencies
run: sudo apt update && sudo apt install -y ninja-build
- uses: nttld/setup-ndk@afb4c9964b521afb97c864b7d40b11e6911bd410 # v1.5.0
with:
ndk-version: r25b
- name: Build for Android
env:
IREE_HOST_BIN_DIR: ${{ env.VENV_DIR }}/bin
IREE_READ_REMOTE_CCACHE: 0
IREE_WRITE_REMOTE_CCACHE: 0
IREE_READ_LOCAL_CCACHE: 1
IREE_WRITE_LOCAL_CCACHE: ${{ inputs.write-caches }}
run: build_tools/cmake/build_android.sh
# TODO: run tests on physical devices or emulators
# * Emulators can run on the same host that ran the build
# * Physical devices could either
# A) be connected to a self-hosted build machine that runs the compiler,
# connects over ADB, and run tests
# B) be connected to a self-hosted run machine that downloads already
# compiled artifacts from a build machine and just connects over ADB
# to run tests