Skip to content

chore: refactor

chore: refactor #9

Workflow file for this run

name: Canvas Native
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
env:
NPM_TAG: "pr"
EMULATOR_NAME: "runtime-emu"
NDK_VERSION: r23c
ANDROID_API: 29
ANDROID_ABI: x86_64
NDK_ARCH: linux
CARGO_TERM_COLOR: always
NDK_HOST: linux
jobs:
build:
name: Build
runs-on: ubuntu-22.04
outputs:
npm_version: ${{ steps.npm_version_output.outputs.NPM_VERSION }}
npm_tag: ${{ steps.npm_version_output.outputs.NPM_TAG }}
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Use Rust nightly
run: |
rustup default nightly
- name: Install Rust Component rust-src
run: |
rustup component add --toolchain nightly rust-src
- name: 'Install Rust target i686-linux-android'
shell: bash
run: |
rustup target add i686-linux-android
- name: 'Install Rust target x86_64-linux-android'
shell: bash
run: |
rustup target add x86_64-linux-android
- name: 'Install Rust target armv7-linux-androideabi'
shell: bash
run: |
rustup target add armv7-linux-androideabi
- name: 'Install Rust target aarch64-linux-android'
shell: bash
run: |
rustup target add aarch64-linux-android
- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: "https://registry.npmjs.org"
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
cache: gradle
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Setup NDK
run: |
echo "y" | sdkmanager "cmake;3.6.4111459"
wget https://dl.google.com/android/repository/android-ndk-$NDK_VERSION-$NDK_ARCH.zip
chmod +x android-ndk-$NDK_VERSION-$NDK_ARCH.zip
unzip -q android-ndk-$NDK_VERSION-$NDK_ARCH.zip
rm -rf android-ndk-$NDK_VERSION-$NDK_ARCH.zip
export ANDROID_NDK_HOME=`pwd`/android-ndk-$NDK_VERSION
export ANDROID_NDK_ROOT=$ANDROID_NDK
export NDK_PATH=$ANDROID_NDK
echo ANDROID_NDK_HOME=${ANDROID_NDK_HOME} >> $GITHUB_ENV
echo ANDROID_NDK=${ANDROID_NDK_HOME} >> $GITHUB_ENV
echo ${ANDROID_NDK_HOME} >> $GITHUB_PATH
export PATH=$PATH:$ANDROID_NDK/toolchains/llvm/prebuilt/$NDK_ARCH-x86_64/bin
export CC_armv7_linux_androideabi=armv7a-linux-androideabi21-clang
export CXX_armv7_linux_androideabi=armv7a-linux-androideabi21-clang++
export AR_armv7_linux_androideabi=llvm-ar
export CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=armv7a-linux-androideabi21-clang
export CC_aarch64_linux_android=aarch64-linux-android21-clang
export CXX_aarch64_linux_android=aarch64-linux-android21-clang++
export AR_aarch64_linux_android=llvm-ar
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android21-clang
export CC_i686_linux_android=i686-linux-android21-clang
export CXX_i686_linux_android=i686-linux-android21-clang++
export AR_i686_linux_android=llvm-ar
export CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android21-clang
export CC_x86_64_linux_android=x86_64-linux-android21-clang
export CXX_x86_64_linux_android=x86_64-linux-android21-clang++
export AR_x86_64_linux_android=llvm-ar
export CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=x86_64-linux-android21-clang
- name: Install Build Tools
run: |
sudo apt-get install pkg-config libssl-dev -y
- name: Build Canvas Native
run: |
make android