Skip to content

Add test builds

Add test builds #13

name: Build APP x TARGET matrix
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
jobs:
prepare-model-artifact:
name: Prepare Edge Impulse model artifact
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build and deploy Edge Impulse model (FOMO)
id: build-deploy-fomo
uses: edgeimpulse/build-deploy@v2.0.0
with:
project_id: ${{ secrets['EDGE_IMPULSE_PROJECT_ID'] }}
api_key: ${{ secrets['EDGE_IMPULSE_API_KEY'] }}
engine: tflite
deployment_type: zip-linux
- name: Upload deployment artifact (FOMO)
uses: actions/upload-artifact@v4
with:
name: edge-impulse-deployment-fomo
path: ${{ steps.build-deploy-fomo.outputs.deployment_file_name }}
if-no-files-found: error
- name: Build and deploy Edge Impulse model (DRPAI)
id: build-deploy-drpai
uses: edgeimpulse/build-deploy@v2.0.0
with:
project_id: ${{ secrets['EDGE_IMPULSE_PROJECT_ID'] }}
api_key: ${{ secrets['EDGE_IMPULSE_API_KEY'] }}
engine: tflite
deployment_type: drp-ai-lib
- name: Upload deployment artifact (DRPAI)
uses: actions/upload-artifact@v4
with:
name: edge-impulse-deployment-drpai
path: ${{ steps.build-deploy-drpai.outputs.deployment_file_name }}
if-no-files-found: error
build-matrix:
needs: prepare-model-artifact
name: ${{ matrix.app }} on ${{ matrix.target.name }}
runs-on: ${{ matrix.target.runner }}
strategy:
fail-fast: false
matrix:
app:
- APP_COLLECT
- APP_CUSTOM
- APP_AUDIO
- APP_CAMERA
- APP_VIDEO
- APP_EIM
target:
- name: TARGET_LINUX_X86
runner: ubuntu-24.04
target_flags: TARGET_LINUX_X86=1 USE_FULL_TFLITE=1
cc: gcc
cxx: g++
deployment: zip-linux
- name: TARGET_LINUX_ARMV7
runner: ubuntu-24.04
target_flags: TARGET_LINUX_ARMV7=1 USE_FULL_TFLITE=1
cc: arm-linux-gnueabihf-gcc
cxx: arm-linux-gnueabihf-g++
deployment: zip-linux
- name: TARGET_LINUX_ARMV7_LEGACY
runner: ubuntu-24.04
target_flags: TARGET_LINUX_ARMV7_LEGACY=1 USE_FULL_TFLITE=1
cc: arm-linux-gnueabihf-gcc
cxx: arm-linux-gnueabihf-g++
deployment: zip-linux
- name: TARGET_LINUX_AARCH64
runner: ubuntu-24.04
target_flags: TARGET_LINUX_AARCH64=1 USE_FULL_TFLITE=1
cc: aarch64-linux-gnu-gcc
cxx: aarch64-linux-gnu-g++
deployment: zip-linux
# - name: TARGET_MAC_X86_64
# runner: macos-13
# target_flags: TARGET_MAC_X86_64=1 USE_FULL_TFLITE=1
# cc: clang
# cxx: clang++
# - name: TARGET_MAC_ARM64
# runner: macos-14
# target_flags: TARGET_MAC_ARM64=1 USE_FULL_TFLITE=1
# cc: clang
# cxx: clang++
- name: TARGET_JETSON_ORIN
runner: ubuntu-24.04
target_flags: TARGET_JETSON_ORIN=1
cc: aarch64-linux-gnu-gcc
cxx: aarch64-linux-gnu-g++
deployment: zip-linux
- name: TARGET_JETSON
runner: ubuntu-24.04
target_flags: TARGET_JETSON=1
cc: aarch64-linux-gnu-gcc
cxx: aarch64-linux-gnu-g++
deployment: zip-linux
- name: TARGET_RENESAS_RZV2L
runner: ubuntu-24.04
target_flags: TARGET_RENESAS_RZV2L=1
cc: aarch64-linux-gnu-gcc
cxx: aarch64-linux-gnu-g++
deployment: drp-ai-lib
- name: TARGET_RENESAS_RZG2L
runner: ubuntu-24.04
target_flags: TARGET_RENESAS_RZG2L=1
cc: aarch64-linux-gnu-gcc
cxx: aarch64-linux-gnu-g++
deployment: drp-ai-lib
- name: TARGET_TDA4VM
runner: ubuntu-24.04
target_flags: TARGET_TDA4VM=1
cc: aarch64-linux-gnu-gcc
cxx: aarch64-linux-gnu-g++
deployment: zip-linux
- name: TARGET_AM62A
runner: ubuntu-24.04
target_flags: TARGET_AM62A=1
cc: aarch64-linux-gnu-gcc
cxx: aarch64-linux-gnu-g++
deployment: zip-linux
- name: TARGET_AM68A
runner: ubuntu-24.04
target_flags: TARGET_AM68A=1
cc: aarch64-linux-gnu-gcc
cxx: aarch64-linux-gnu-g++
deployment: zip-linux
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: 'recursive'
- name: Install Linux dependencies
if: runner.os == 'Linux'
shell: bash
run: |
set -euxo pipefail
sudo apt-get update
sudo apt-get install -y make clang
target='${{ matrix.target.name }}'
app='${{ matrix.app }}'
if [[ "$target" == "TARGET_LINUX_ARMV7" || "$target" == "TARGET_LINUX_ARMV7_LEGACY" ]]; then
sudo apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
fi
if [[ "$target" == "TARGET_LINUX_AARCH64" || \
"$target" == "TARGET_RENESAS_RZV2L" || \
"$target" == "TARGET_RENESAS_RZG2L" || \
"$target" == "TARGET_TDA4VM" || \
"$target" == "TARGET_AM62A" || \
"$target" == "TARGET_AM68A" || \
"$target" == "TARGET_JETSON" || \
"$target" == "TARGET_JETSON_ORIN"
]]; then
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
fi
if [[ "$app" == "APP_AUDIO" ]]; then
sudo apt-get install -y libasound2-dev
fi
if [[ ("$app" == "APP_CAMERA" || "$app" == "APP_VIDEO") && "$target" == "TARGET_LINUX_X86" ]]; then
sudo apt-get install -y libopencv-dev
fi
- name: Install macOS dependencies
if: runner.os == 'macOS' && (matrix.app == 'APP_CAMERA' || matrix.app == 'APP_VIDEO')
shell: bash
run: |
set -euxo pipefail
brew update
brew install opencv
- name: Validate matrix combination
id: validate
shell: bash
run: |
set -euo pipefail
app='${{ matrix.app }}'
target='${{ matrix.target.name }}'
supported='true'
reason=''
if [[ "$target" == "TARGET_JETSON" || "$target" == "TARGET_JETSON_ORIN" ]]; then
supported='false'
reason='Jetson builds require TensorRT/CUDA runtime libraries that are not available on GitHub-hosted runners.'
fi
if [[ "$target" == "TARGET_TDA4VM" || "$target" == "TARGET_AM62A" || "$target" == "TARGET_AM68A" ]]; then
supported='false'
reason='TI TIDL builds require vendor SDK assets (for TIDL_TOOLS_PATH) not available in standard CI runners.'
fi
if [[ "$app" == "APP_AUDIO" && "$target" != "TARGET_LINUX_X86" ]]; then
supported='false'
reason='Audio app depends on ALSA and is only validated on native Linux x86 in this workflow.'
fi
if [[ "$app" == "APP_CAMERA" && "$target" != "TARGET_LINUX_X86" && "$target" != "TARGET_MAC_X86_64" && "$target" != "TARGET_MAC_ARM64" ]]; then
supported='false'
reason='Camera app depends on OpenCV and is validated only on native Linux/macOS runners in this workflow.'
fi
if [[ "$app" == "APP_VIDEO" && "$target" != "TARGET_LINUX_X86" && "$target" != "TARGET_MAC_X86_64" && "$target" != "TARGET_MAC_ARM64" ]]; then
supported='false'
reason='Video app depends on OpenCV and is validated only on native Linux/macOS runners in this workflow.'
fi
echo "supported=$supported" >> "$GITHUB_OUTPUT"
echo "reason=$reason" >> "$GITHUB_OUTPUT"
- name: Skip unsupported combination
if: steps.validate.outputs.supported != 'true'
shell: bash
run: |
echo "Skipping ${{ matrix.app }} + ${{ matrix.target.name }}"
echo "Reason: ${{ steps.validate.outputs.reason }}"
- name: Download deployment artifact (FOMO)
if: matrix.app != 'APP_COLLECT' && matrix.target.deployment == 'zip-linux' && steps.validate.outputs.supported == 'true'
uses: actions/download-artifact@v4
with:
name: edge-impulse-deployment-fomo
path: .
- name: Download deployment artifact (DRPAI)
if: matrix.app != 'APP_COLLECT' && matrix.target.deployment == 'drp-ai-lib' && steps.validate.outputs.supported == 'true'
uses: actions/download-artifact@v4
with:
name: edge-impulse-deployment-drpai
path: .
- name: Extract model and SDK
if: matrix.app != 'APP_COLLECT' && steps.validate.outputs.supported == 'true'
shell: bash
run: |
set -euxo pipefail
rm -rf edge-impulse-sdk/ model-parameters/ tflite-model/ temp/
mkdir -p temp/
deployment_file="$(find . -maxdepth 1 -type f -name '*.zip' | head -n 1)"
if [[ -z "$deployment_file" ]]; then
echo "No deployment zip file found after artifact download"
exit 1
fi
unzip -q "$deployment_file" -d temp
mv temp/* .
rm -rf "$deployment_file" temp
- name: Build
if: steps.validate.outputs.supported == 'true'
shell: bash
run: |
set -euxo pipefail
JOBS=2
if [[ "$RUNNER_OS" == "Linux" ]]; then
JOBS="$(nproc)"
elif [[ "$RUNNER_OS" == "macOS" ]]; then
JOBS="$(sysctl -n hw.ncpu)"
fi
${{ matrix.app }}=1 ${{ matrix.target.target_flags }} make clean
${{ matrix.app }}=1 ${{ matrix.target.target_flags }} make -j"$JOBS" CC=${{ matrix.target.cc }} CXX=${{ matrix.target.cxx }}