Fix macOS Universal build #60
Workflow file for this run
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: Build | |
on: | |
workflow_dispatch: | |
inputs: | |
tensorflow-version: | |
description: "TensorFlow version" | |
type: string | |
push: | |
tags: | |
- v*.*.* | |
env: | |
GCC_VERSION: 9 | |
CMAKE_VERSION: 3.26 | |
XCODE_VERSION: 14.2 | |
MACOSX_DEPLOYMENT_TARGET: 10.13 | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
name: Build | |
runs-on: ${{ matrix.runs-on }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- target: linux-aarch64-static_lib | |
runs-on: buildjet-4vcpu-ubuntu-2204-arm | |
build: > | |
PARALLEL_JOB_COUNT=2 | |
./build-static_lib.sh | |
post-build: tar -czvf $ARCHIVE_DIR/$ARCHIVE_NAME.tar.gz -C $OUTPUT_DIR . | |
- target: linux-x86_64-static_lib | |
runs-on: ubuntu-latest | |
build: ./build-static_lib.sh | |
post-build: tar -czvf $ARCHIVE_DIR/$ARCHIVE_NAME.tar.gz -C $OUTPUT_DIR . | |
- target: macos-aarch64-static_lib | |
runs-on: ghcr.io/cirruslabs/macos-ventura-xcode:14.2 | |
build: ./build-static_lib.sh | |
post-build: tar -czvf $ARCHIVE_DIR/$ARCHIVE_NAME.tar.gz -C $OUTPUT_DIR . | |
- target: macos-universal-static_lib | |
runs-on: ghcr.io/cirruslabs/macos-ventura-xcode:14.2 | |
build: ./build-macos-universal-static_lib.sh | |
post-build: tar -czvf $ARCHIVE_DIR/$ARCHIVE_NAME.tar.gz -C $OUTPUT_DIR . | |
- target: macos-x86_64-static_lib | |
runs-on: macos-latest | |
build: ./build-static_lib.sh | |
post-build: tar -czvf $ARCHIVE_DIR/$ARCHIVE_NAME.tar.gz -C $OUTPUT_DIR . | |
- target: windows-x86_64-static_lib | |
runs-on: windows-latest | |
build: ./build-static_lib.sh | |
post-build: 7z a $ARCHIVE_DIR/$ARCHIVE_NAME.zip $OUTPUT_DIR/* | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup GCC | |
if: runner.os == 'Linux' | |
uses: egor-tensin/setup-gcc@v1 | |
with: | |
version: ${{ env.GCC_VERSION }} | |
- name: Setup CMake | |
uses: lukka/get-cmake@latest | |
with: | |
cmakeVersion: ${{ env.CMAKE_VERSION }} | |
- name: Setup Xcode | |
if: runner.os == 'macOS' | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: ${{ env.XCODE_VERSION }} | |
- name: Set TensorFlow version | |
run: | | |
if ${{ startsWith(github.ref, 'refs/tags/v') }}; then | |
echo TENSORFLOW_VERSION=${GITHUB_REF_NAME#v} >> $GITHUB_ENV | |
elif [ -n "${{ inputs.tensorflow-version }}" ]; then | |
echo TENSORFLOW_VERSION=${{ inputs.tensorflow-version }} >> $GITHUB_ENV | |
else | |
echo TENSORFLOW_VERSION=$(cat TENSORFLOW_VERSION) >> $GITHUB_ENV | |
fi | |
- name: Set environment variables | |
run: | | |
echo OUTPUT_DIR=./output >> $GITHUB_ENV | |
echo ARCHIVE_DIR="${{ runner.temp }}" >> $GITHUB_ENV | |
echo ARCHIVE_NAME=tensorflowlite-${{ matrix.target }}-${{ env.TENSORFLOW_VERSION }} >> $GITHUB_ENV | |
- name: Build | |
run: ${{ matrix.build }} | |
- name: Post build | |
run: ${{ matrix.post-build }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.ARCHIVE_NAME }} | |
path: ${{ env.ARCHIVE_DIR }}/${{ env.ARCHIVE_NAME }}.* | |
release: | |
name: Release | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
- name: Release | |
uses: ncipollo/release-action@v1 | |
with: | |
omitName: true | |
body: "Official Release: [TensorFlow ${{ github.ref_name }}](https://github.com/tensorflow/tensorflow/releases/tag/${{ github.ref_name }})" | |
artifacts: "*/*.*" | |
allowUpdates: true | |
omitNameDuringUpdate: true | |
omitBodyDuringUpdate: true | |
omitPrereleaseDuringUpdate: true | |
omitDraftDuringUpdate: false |