forked from brainflow-dev/brainflow
-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (70 loc) · 2.98 KB
/
run_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
name: Run Android NDK
on: [push, pull_request]
jobs:
RunAndroid:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 4
matrix:
os: [ubuntu-latest]
env:
ANDROID_NDK_VERSION: 25.1.8937393
steps:
- name: Clone Repository
uses: actions/checkout@v2
- name: Install Ninja
run: |
sudo -H apt-get update -y
sudo -H apt-get install -y ninja-build zip unzip python3-setuptools python3-pygments
env:
DEBIAN_FRONTEND: noninteractive
- name: Setup Cmake
uses: jwlawson/[email protected]
with:
cmake-version: '3.16.x'
- name: Install NDK
run: |
echo "y" | sudo -H ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --install "ndk;${ANDROID_NDK_VERSION}" --sdk_root=${ANDROID_SDK_ROOT}
env:
DEBIAN_FRONTEND: noninteractive
# build for all ABIs
- name: Compile libusb
run: |
git clone --depth 1 --branch android https://github.com/xloem/libusb.git
cd libusb/android/jni
${ANDROID_HOME}/ndk/${ANDROID_NDK_VERSION}/ndk-build
- name: Compile libftdi
run: |
git clone --depth 1 --branch v1.5 git://developer.intra2net.com/libftdi
cd libftdi
git checkout 5c2c58e03ea999534e8cb64906c8ae8b15536c30 # tip of v1.5
for ABI in arm64-v8a armeabi-v7a x86 x86_64; do
mkdir $GITHUB_WORKSPACE/libftdi/build-$ABI
cd $GITHUB_WORKSPACE/libftdi/build-$ABI
cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=${ANDROID_HOME}/ndk/${ANDROID_NDK_VERSION}/build/cmake/android.toolchain.cmake -DANDROID_ABI=$ABI -DCMAKE_BUILD_TYPE=Release -DANDROID_NATIVE_API_LEVEL=android-24 -DEXAMPLES=OFF -DFTDI_EEPROM=OFF -DLIBUSB_LIBRARIES=$GITHUB_WORKSPACE/libusb/android/libs/$ABI/libusb1.0.so -DLIBUSB_INCLUDE_DIR=$GITHUB_WORKSPACE/libusb/libusb -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install-$ABI ..
ninja
ninja install
done
- name: Compile BrainFlow
run: |
for ABI in arm64-v8a armeabi-v7a x86 x86_64; do
mkdir $GITHUB_WORKSPACE/build-$ABI
cd $GITHUB_WORKSPACE/build-$ABI
cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=${ANDROID_HOME}/ndk/${ANDROID_NDK_VERSION}/build/cmake/android.toolchain.cmake -DANDROID_ABI=$ABI -DCMAKE_BUILD_TYPE=Release -DANDROID_NATIVE_API_LEVEL=android-24 -DCMAKE_FIND_ROOT_PATH=$GITHUB_WORKSPACE/install-$ABI -DUSE_LIBFTDI=ON ..
ninja
done
- name: Prepare Zip
run: |
cd $GITHUB_WORKSPACE/tools
zip -r jniLibs.zip jniLibs
- name: Install AWS CLI
run: sudo -H python3 -m pip install awscli==1.21.10
- name: Upload To AWS
if: ${{ github.event_name == 'push' && github.repository == 'brainflow-dev/brainflow' }}
run: |
cd $GITHUB_WORKSPACE/tools
aws s3 cp jniLibs.zip s3://brainflow/$GITHUB_SHA/
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}