Skip to content

chore(deps): update actions/checkout action to v4 #59

chore(deps): update actions/checkout action to v4

chore(deps): update actions/checkout action to v4 #59

name: Build tensorflow-to-larod-artpec8 application
on:
workflow_dispatch:
push:
paths:
- 'tensorflow-to-larod-artpec8/**'
- '!tensorflow-to-larod-artpec8/README.md'
- '.github/workflows/tensorflow-to-larod-artpec8.yml'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- arch: aarch64
chip: artpec8
axis-os: 11.5.64
env:
EXREPO: acap-native-examples
EXNAME: tensorflow-to-larod-artpec8
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v2
- name: Build ${{ env.example }} application
env:
example: ${{ env.EXNAME }}
imagetag: ${{ env.EXREPO }}_${{ env.EXNAME }}:1.0
run: |
docker image rm -f $imagetag
cd $EXNAME
docker build --no-cache --tag $imagetag . --build-arg TRAIN_EPOCHS=1 --build-arg TUNE_EPOCHS=1
- name: Check if model file exists and its size
env:
imagetag: ${{ env.EXREPO }}_${{ env.EXNAME }}:1.0
buildpath: /env/training/models
modeldir: model
modelname: converted_model.tflite
run: |
found_error=no
[ -d $modeldir ] && rm -rf $modeldir
mkdir -p ./$modeldir
docker cp $(docker create $imagetag):$buildpath/$modelname ./$modeldir
if [ -f $modeldir/$modelname ]; then
echo "Model file exists"
# Check the file size
filesize=$(stat --printf="%s" $modeldir/$modelname)
minsize=$((1*1024*1024)) # 1MB
maxsize=$((10*1024*1024*1024)) # 10GB
if [ $filesize -ge $minsize ] && [ $filesize -le $maxsize ]; then
echo "Model file size ($filesize bytes) is within the expected range"
else
echo "Model file size ($filesize bytes) is out of the expected range"
found_error=yes
fi
else
echo "Model file does not exist, build directory contains"
ls -la $modeldir
found_error=yes
fi
# Cleanup
[ -d $modeldir ] && rm -rf $modeldir
docker image rm -f $imagetag
[ "$found_error" = no ] || {
echo "Error found during tests"
exit 1
}