-
Notifications
You must be signed in to change notification settings - Fork 38
139 lines (125 loc) · 4.62 KB
/
arm.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: ARM
'on':
push:
branches:
- main
- ci-sandbox
pull_request:
branches:
- '**'
env:
ccache_basedir: ${{ github.workspace }}
ccache_dir: "${{ github.workspace }}/.ccache"
ccache_compilercheck: content
ccache_compress: 'true'
ccache_compresslevel: 9
ccache_maxsize: 200M
ccache_cmake: -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache
ndk: "${{ github.workspace }}/android-ndk-r23b"
abi: "arm64-v8a"
minsdk_version : 28
android_platform: 28
jobs:
ubuntu:
name: "arm-v8a cross-compile via Android NDK"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install prerequisites
run: |
wget -c --quiet https://dl.google.com/android/repository/android-ndk-r23b-linux.zip
unzip -qq android-ndk-r23b-linux.zip
sudo apt-get -y install ccache cmake
- name: Generate ccache_vars for ccache based on machine
shell: bash
id: ccache_vars
run: |-
echo "::set-output name=hash::$(echo ${{ env.ccache_compilercheck }})"
echo "::set-output name=timestamp::$(date '+%Y-%m-%dT%H.%M.%S')"
- name: Cache-op for build-cache through ccache
uses: actions/cache@v2
with:
path: ${{ env.ccache_dir }}
key: ccache-${{ matrix.identifier }}-${{ steps.ccache_vars.outputs.hash }}-${{ github.ref }}-${{ steps.ccache_vars.outputs.timestamp }}
restore-keys: |-
ccache-${{ matrix.identifier }}-${{ steps.ccache_vars.outputs.hash }}-${{ github.ref }}
ccache-${{ matrix.identifier }}-${{ steps.ccache_vars.outputs.hash }}
ccache-${{ matrix.identifier }}
- name: ccache environment setup
run: |-
echo "CCACHE_COMPILER_CHECK=${{ env.ccache_compilercheck }}" >> $GITHUB_ENV
echo "CCACHE_BASEDIR=${{ env.ccache_basedir }}" >> $GITHUB_ENV
echo "CCACHE_COMPRESS=${{ env.ccache_compress }}" >> $GITHUB_ENV
echo "CCACHE_COMPRESSLEVEL=${{ env.ccache_compresslevel }}" >> $GITHUB_ENV
echo "CCACHE_DIR=${{ env.ccache_dir }}" >> $GITHUB_ENV
echo "CCACHE_MAXSIZE=${{ env.ccache_maxsize }}" >> $GITHUB_ENV
- name: ccache prolog
run: |-
ccache -s # Print current cache stats
ccache -z # Zero cache entry
- name: Generate buildfiles for bergamot-translator on android via cmake
run: |-
mkdir -p build
cd build
NDK=${{ env.ndk }}
ABI=${{ env.abi }}
MINSDK_VERSION=${{ env.minsdk_version }}
ANDROID_PLATFORM=android-${{ env.android_platform }}
OTHER_ANDROID_ARGS=(
-DANDROID_ARM_NEON=TRUE
)
OTHER_MARIAN_ARGS=(
-DCOMPILE_CUDA=off
-DCOMPILE_CPU=on
-DCMAKE_HAVE_THREADS_LIBRARY=1
-DCMAKE_USE_WIN32_THREADS_INIT=0
-DCMAKE_USE_PTHREADS_INIT=1
-DTHREADS_PREFER_PTHREAD_FLAG=ON
-DBUILD_ARCH=armv8-a
# -DCOMPILE_WITHOUT_EXCEPTIONS=on # Apparently this can reduce the binary size, let's see.
-DSSPLIT_USE_INTERNAL_PCRE2=ON
)
# Additionally list variables finally configured.
cmake -L \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake \
-DANDROID_TOOLCHAIN=clang \
-DANDROID_ABI=$ABI \
-DANDROID_PLATFORM=$ANDROID_PLATFORM \
-DANDROID_NATIVE_API_LEVEL=$MINSDKVERSION \
-DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.8 \
-DANDROID_STL=c++_static \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache \
"${OTHER_ANDROID_ARGS[@]}" "${OTHER_MARIAN_ARGS[@]}" \
..
- name : Build bergamot-translator for android
working-directory: build
run: |-
make -j2
- name: ccache epilog
run: 'ccache -s # Print current cache stats'
- uses: actions/upload-artifact@v2
with:
path: ${{github.workspace}}/build/app/bergamot
# Disable release for now.
# release:
# name: Release Latest Build
# runs-on: ubuntu-latest
# needs: [ubuntu]
# if: github.ref == 'refs/heads/master'
# steps:
# - name: Download artifacts
# uses: actions/download-artifact@v2
#
# - name: Update GitHub prerelease
# uses: marvinpinto/action-automatic-releases@latest
# with:
# repo_token: ${{ secrets.GITHUB_TOKEN }}
# automatic_release_tag: latest
# prerelease: true
# title: "Latest Build"
# files: |
# artifact/marian-decoder