-
Notifications
You must be signed in to change notification settings - Fork 5
95 lines (80 loc) · 2.76 KB
/
build_android.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
name: Build For Android
on:
push:
branches:
- "main"
- "*-workflow"
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
target: [android]
arch: [x86_64, arm64]
build_type: [release, debug]
include:
# Build type to cmake keyword.
- build_type: release
cmake_build_type_keyword: Release
- build_type: debug
cmake_build_type_keyword: RelWithDebInfo
# Define host for each target.
- os: ubuntu-latest
target: android
lib_suffix: so
# Define toolchain data.
- target: android
arch: arm64
cmake_arch_keyword: arm64-v8a
- target: android
arch: x86_64
cmake_arch_keyword: x86_64
steps:
- name: Check out code
uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup ninja
uses: seanmiddleditch/gha-setup-ninja@master
- name: Download IREE Host tools
id: iree-dist
uses: robinraju/[email protected]
with:
filename: iree-dist-*-linux-x86_64.tar.xz
repository: openxla/iree
latest: true
extract: false
- name: Extract IREE Host tools
shell: bash
run: |
if [ ! -d "${{ github.workspace }}/iree-dist" ]; then
mkdir "${{ github.workspace }}/iree-dist"
fi
tar -xf "${{ fromJson(steps.iree-dist.outputs.downloaded_files)[0] }}" -C "${{ github.workspace }}/iree-dist"
- name: Setup Android NDK
id: android-ndk
uses: nttld/[email protected]
with:
ndk-version: r25c
- name: Set up CMake for Android
if: matrix.target == 'android'
shell: bash
run: |
if [ ! -d "${{ github.workspace }}/build" ]; then
mkdir "${{ github.workspace }}/build"
fi
cd "${{ github.workspace }}/build"
cmake "${{ github.workspace }}" -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type_keyword }} \
-DIREE_HOST_BIN_DIR="${{ github.workspace }}/iree-dist/bin" \
-DCMAKE_TOOLCHAIN_FILE="${{ steps.android-ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake" \
-DANDROID_ABI=${{ matrix.cmake_arch_keyword }} \
-DIREE_ENABLE_WERROR_FLAG=OFF
- name: Build project
shell: bash
run: ninja -C "${{ github.workspace }}/build"
- name: Export artifact
uses: actions/upload-artifact@v2
with:
name: "${{ matrix.target }}.${{ matrix.build_type }}.${{ matrix.arch }}"
path: "${{ github.workspace }}/build/lib/*iree-gd*.${{ matrix.lib_suffix }}"
if-no-files-found: error