lce-release #225
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: lce-release | |
on: | |
release: | |
types: [published] | |
tags: | |
- v* | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Version of the form 1.0.0(.devYYYYMMDD)" | |
required: true | |
env: | |
IMAGE_NAME: dev | |
jobs: | |
benchmark-binaries: | |
name: Build Benchmark Binaries for AArch64 and Android | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- uses: actions/cache@v3 | |
id: cache | |
with: | |
path: /tmp/lce_android | |
key: ${{ runner.os }}-${{ hashFiles('**/third_party/install_android.sh') }} | |
- name: Install pip dependencies | |
run: pip install numpy six --no-cache-dir | |
- name: Set Java version | |
run: echo "JAVA_HOME=${JAVA_HOME_8_X64}" >> $GITHUB_ENV | |
- name: Download and install Android NDK/SDK | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: ./third_party/install_android.sh | |
- name: Configure Bazel | |
run: LCE_SET_ANDROID_WORKSPACE=1 ANDROID_SDK_HOME="/tmp/lce_android" ANDROID_NDK_HOME="/tmp/lce_android/ndk/21.4.7075529" ./configure.py | |
shell: bash | |
- run: mkdir benchmark-binaries | |
- name: Build Benchmark utility for AArch64 | |
run: | | |
bazelisk build //larq_compute_engine/tflite/benchmark:lce_benchmark_model --config=aarch64 -c opt --copt=-O3 | |
cp bazel-bin/larq_compute_engine/tflite/benchmark/lce_benchmark_model benchmark-binaries/lce_benchmark_model_aarch64 | |
- name: Build Benchmark utility for AArch32 | |
run: | | |
bazelisk build //larq_compute_engine/tflite/benchmark:lce_benchmark_model --config=rpi3 -c opt --copt=-O3 | |
cp bazel-bin/larq_compute_engine/tflite/benchmark/lce_benchmark_model benchmark-binaries/lce_benchmark_model_aarch32 | |
- name: Build Benchmark utility for Android | |
run: | | |
bazelisk build //larq_compute_engine/tflite/benchmark:lce_benchmark_model --config=android_arm64 -c opt --copt=-O3 | |
cp bazel-bin/larq_compute_engine/tflite/benchmark/lce_benchmark_model benchmark-binaries/lce_benchmark_model_android_arm64 | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Benchmark-Binaries | |
path: benchmark-binaries | |
- name: Upload Release Asset AArch64 | |
if: github.event_name == 'release' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: benchmark-binaries/lce_benchmark_model_aarch64 | |
asset_name: lce_benchmark_model_aarch64 | |
asset_content_type: application/octet-stream | |
- name: Upload Release Asset AArch32 | |
if: github.event_name == 'release' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: benchmark-binaries/lce_benchmark_model_aarch32 | |
asset_name: lce_benchmark_model_aarch32 | |
asset_content_type: application/octet-stream | |
- name: Upload Release Asset Android | |
if: github.event_name == 'release' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: benchmark-binaries/lce_benchmark_model_android_arm64 | |
asset_name: lce_benchmark_model_android_arm64 | |
asset_content_type: application/octet-stream | |
android-aar: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- uses: actions/cache@v3 | |
id: cache | |
with: | |
path: /tmp/lce_android | |
key: ${{ runner.os }}-${{ hashFiles('**/third_party/install_android.sh') }} | |
- name: Install pip dependencies | |
run: pip install numpy six --no-cache-dir | |
- name: Set Java version | |
run: echo "JAVA_HOME=${JAVA_HOME_8_X64}" >> $GITHUB_ENV | |
- name: Download and install Android NDK/SDK | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: ./third_party/install_android.sh | |
- name: Configure Bazel | |
run: LCE_SET_ANDROID_WORKSPACE=1 ANDROID_SDK_HOME="/tmp/lce_android" ANDROID_NDK_HOME="/tmp/lce_android/ndk/21.4.7075529" ./configure.py | |
shell: bash | |
- name: Build LCE AAR | |
run: BUILDER=bazelisk ./larq_compute_engine/tflite/java/build_lce_aar.sh | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Android-AAR | |
path: lce-lite-*.aar | |
- name: Get Name of Artifact | |
if: github.event_name == 'release' | |
run: | | |
ASSET_NAME=$(ls lce-lite-*.aar | head -n 1) | |
echo "ASSET_NAME=${ASSET_NAME}" >> $GITHUB_ENV | |
- name: Upload Release Asset | |
if: github.event_name == 'release' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ${{ env.ASSET_NAME }} | |
asset_name: ${{ env.ASSET_NAME }} | |
asset_content_type: application/octet-stream |