mirror of
https://github.com/browsermt/bergamot-translator.git
synced 2024-09-11 05:35:33 +03:00
Adding ARM build on GitHub CI
This commit is contained in:
parent
cc7d7ceb24
commit
573b842211
138
.github/workflows/arm.yml
vendored
Normal file
138
.github/workflows/arm.yml
vendored
Normal file
@ -0,0 +1,138 @@
|
||||
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 marian on android via cmake
|
||||
run: |-
|
||||
mkdir -p build
|
||||
cd build
|
||||
NDK=${{ env.ndk }}
|
||||
ABI=${{ env.abi }}
|
||||
MINSDK_VERSION=${{ env.minsdk_version }}
|
||||
ANDROID_PLATFORM=${{ 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.
|
||||
)
|
||||
# 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 marian 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
|
Loading…
Reference in New Issue
Block a user