Skip to content

v0.3.4

v0.3.4 #51

name: macos-precompile
on:
push:
tags:
- 'v*'
- 'precompile-test'
- 'precompile-test-macos'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
precompile:
runs-on: macos-11
env:
TFLITE_BEAM_PREFER_PRECOMPILED: "false"
elixir_version: "1.15.2"
name: macOS ${{ matrix.pair.arch }} - OTP ${{ matrix.pair.otp }}
strategy:
fail-fast: false
matrix:
include:
- pair:
otp: "25.3.2.3"
arch: x86_64
libedgetpu_library: darwin_x86_64
- pair:
otp: "25.3.2.3"
arch: aarch64
libedgetpu_library: darwin_arm64
- pair:
otp: "26.0.2"
arch: x86_64
libedgetpu_library: darwin_x86_64
- pair:
otp: "26.0.2"
arch: aarch64
libedgetpu_library: darwin_arm64
steps:
- uses: actions/checkout@v3
- name: Install Erlang and Elixir
run: |
brew install autoconf coreutils curl git openssl asdf
asdf plugin add erlang https://github.com/asdf-vm/asdf-erlang.git
asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git
export KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac"
asdf install erlang ${{ matrix.pair.otp }}
asdf install elixir ${{ env.elixir_version }}
asdf global erlang ${{ matrix.pair.otp }}
asdf global elixir ${{ env.elixir_version }}
source $(brew --prefix asdf)/libexec/asdf.sh
mix local.hex --force
mix local.rebar --force
wget https://s3.amazonaws.com/rebar3/rebar3 && chmod +x rebar3
./rebar3 local install
- name: Create precompiled library
run: |
source $(brew --prefix asdf)/libexec/asdf.sh
export PATH="~/.cache/rebar3/bin:$PATH"
export NIF_VERSION="$(erl -noshell -eval "io:format('~ts', [erlang:system_info(nif_version)])." -s erlang halt)"
if [ "${{ matrix.pair.arch }}" = "aarch64" ]; then
export TARGET_ARCH="${{ matrix.pair.arch }}"
export TARGET_OS="apple"
export TARGET_ABI="darwin"
export CPPFLAGS="-arch arm64"
export CMAKE_TFLITE_OPTIONS="-DCMAKE_OSX_ARCHITECTURES=arm64"
export TFLITE_BEAM_CORAL_LIBEDGETPU_LIBRARIES="aarch64"
fi
echo "TFLITE_BEAM_PREFER_PRECOMPILED: ${TFLITE_BEAM_PREFER_PRECOMPILED}"
echo "TARGET_ARCH: ${TARGET_ARCH}"
echo "TARGET_OS: ${TARGET_OS}"
echo "TARGET_ABI: ${TARGET_ABI}"
rebar3 deps
rebar3 compile
export PKG_NAME=tflite_beam-nif-${NIF_VERSION}-${{ matrix.pair.arch }}-apple-darwin-${GITHUB_REF##*/}
mkdir -p "${PKG_NAME}"
cp -a ./priv "${PKG_NAME}"
tar -czf "${PKG_NAME}.tar.gz" "${PKG_NAME}"
rm -rf "${PKG_NAME}"
mkdir -p artifacts
mv "${PKG_NAME}.tar.gz" artifacts
- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: artifacts/tflite_beam-*.tar.gz