Skip to content

test2

test2 #17

Workflow file for this run

name: Build MacOS
on:
push:
branches:
- main
paths:
- '.github/workflows/build-macos.yml'
- 'src/**'
- 'include/**'
- 'example/**'
- 'CMakeLists.txt'
jobs:
build:
runs-on: macos-latest
strategy:
matrix:
arch: [x86_64, arm64]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Homebrew
run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- name: Update CMake
run: brew install cmake
- name: Download ONNX Runtime
run: |
if [ "${{ matrix.arch }}" == "x86_64" ]; then
wget https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.18.1/onnxruntime-osx-x86_64-static_lib-1.18.1.zip -O onnxruntime.zip
else
wget https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.18.1/onnxruntime-osx-arm64-static_lib-1.18.1.zip -O onnxruntime.zip
fi
mkdir -p onnxruntime
tar -xzf onnxruntime.zip -C onnxruntime --strip-components 1
mkdir -p lib
rsync -a onnxruntime/lib/ lib/
- name: Configure CMake
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} -DONNXRUNTIME_DIR=${PWD}/onnxruntime
- name: Build
run: cmake --build build --config Release
- name: Upload Build Artifacts
uses: actions/upload-artifact@v3
with:
name: macos-${{ matrix.arch }}
path: lib/
create-universal-dylibs:
needs: build
runs-on: macos-latest
steps:
- name: Download x86_64 Build Artifacts
uses: actions/download-artifact@v3
with:
name: macos-x86_64
path: macos-x86_64
- name: Download arm64 Build Artifacts
uses: actions/download-artifact@v3
with:
name: macos-arm64
path: macos-arm64
- name: Create Universal dylibs
run: |
mkdir -p universal/lib
for dylib in macos-x86_64/*.dylib; do
dylib_name=$(basename $dylib)
lipo -create macos-x86_64/$dylib_name macos-arm64/$dylib_name -output universal/$dylib_name
done
- name: Upload Universal dylibs
uses: actions/upload-artifact@v3
with:
name: macos-universal
path: universal/