bump artifact upload action to v3 #2322
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/actions-setup-cmake@v1.4 | |
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 }} |