This repository was archived by the owner on Oct 6, 2025. It is now read-only.
Update deployment branch for Raspberry Pi workflow to target object d… #26
Workflow file for this run
This file contains hidden or 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 and Deploy for Raspberry Pi | |
| on: | |
| push: | |
| branches: | |
| - 80-task-object-detection-in-cluster | |
| tags: | |
| - 'v*' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| # Optional: Increase timeout if the build is very long, although space is the main issue | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Initial disk space check | |
| run: | | |
| echo "--- Disk space BEFORE any cleanup ---" | |
| df -h | |
| echo "--- Docker images BEFORE any cleanup ---" | |
| docker images || true # Use || true to prevent job failure if no images | |
| - name: Free up disk space on runner | |
| run: | | |
| echo "--- Starting disk space cleanup ---" | |
| sudo rm -rf /usr/share/dotnet || true | |
| sudo rm -rf /opt/ghc || true | |
| sudo rm -rf /usr/local/share/boost || true | |
| sudo rm -rf /usr/lib/jvm || true | |
| sudo docker system prune -af || true # Force prune all dangling images/containers/volumes | |
| echo "--- Disk space AFTER cleanup ---" | |
| df -h | |
| echo "--- Docker images AFTER cleanup ---" | |
| docker images || true | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| # If your repository has submodules that are not needed for the Rasp build, set this to false. | |
| # Otherwise, keep it default or set to true if they are crucial. | |
| submodules: true | |
| - name: Check project directory size before Docker build context | |
| run: | | |
| echo "--- Size of the repository being copied to Docker context ---" | |
| du -sh . | |
| echo "Ensure you have a .dockerignore file to exclude unnecessary files!" | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| with: | |
| platforms: linux/arm64 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| driver: docker-container | |
| buildkitd-flags: --allow-insecure-entitlement network.host | |
| - name: Disk space check before Docker build | |
| run: | | |
| echo "--- Disk space BEFORE Docker buildx build ---" | |
| df -h | |
| echo "--- Docker images BEFORE Docker buildx build ---" | |
| docker images || true | |
| - name: Build Docker image | |
| run: | | |
| echo "--- Starting Docker build for rasp-app ---" | |
| docker buildx build \ | |
| --platform linux/arm64 \ | |
| -f deploy/dockerfiles/DockerfileDeployRasp \ | |
| --build-arg projectDir=/ \ | |
| --load \ | |
| -t rasp-app . | |
| echo "--- Docker build for rasp-app completed ---" | |
| - name: Disk space check after Docker image build | |
| run: | | |
| echo "--- Disk space AFTER Docker buildx build (and --load) ---" | |
| df -h | |
| echo "--- Docker images AFTER Docker buildx build ---" | |
| docker images | |
| echo "If 'rasp-app' image is very large, consider multi-stage Dockerfile builds." | |
| - name: Extract binaries from Docker image | |
| run: | | |
| echo "--- Starting binary extraction ---" | |
| docker create --name tmpapp rasp-app | |
| mkdir -p artifacts/bin | |
| docker cp tmpapp:/home/InstrumentClusterApp ./artifacts/bin/ | |
| docker cp tmpapp:/home/MiddleWareApp ./artifacts/bin/ | |
| docker rm tmpapp | |
| echo "--- Binary extraction completed ---" | |
| - name: Prepare artifacts | |
| run: | | |
| echo "--- Preparing artifacts ---" | |
| mkdir -p artifacts/config | |
| mkdir -p artifacts/fonts | |
| cp ./ZenohConfig/InstrumentClusterConfig.json ./artifacts/config/ | |
| cp ./ZenohConfig/MiddleWareConfig.json ./artifacts/config/ | |
| cp -r ./deploy/fonts/* ./artifacts/fonts/ | |
| # Be aware of the size of your repository for this step! | |
| # If the source code is huge, this zip can consume a lot of temp space. | |
| git archive --format=zip HEAD -o ./artifacts/source-code.zip | |
| echo "--- Disk space BEFORE zipping release-package.zip ---" | |
| df -h | |
| echo "--- Size of artifacts directory before final zip ---" | |
| du -sh artifacts/ | |
| cd artifacts | |
| zip -r ../release-package.zip * | |
| cd .. | |
| echo "--- Release package zipped ---" | |
| - name: Disk space check after all artifacts prepared | |
| run: | | |
| echo "--- Disk space AFTER all artifacts prepared (including zips) ---" | |
| df -h | |
| echo "--- Size of release-package.zip and source-code.zip ---" | |
| ls -lh release-package.zip artifacts/source-code.zip | |
| - name: Get latest tag and increment | |
| id: tag | |
| run: | | |
| git fetch --tags --force | |
| git fetch origin | |
| latest_tag=$(git tag --sort=-v:refname | head -n 1) | |
| if [ -z "$latest_tag" ]; then | |
| latest_tag="v1.0.0" | |
| fi | |
| major=$(echo $latest_tag | cut -d. -f1 | tr -d 'v') | |
| minor=$(echo $latest_tag | cut -d. -f2) | |
| patch=$(echo $latest_tag | cut -d. -f3) | |
| new_tag="v$major.$minor.$((patch + 1))" | |
| echo "new_tag=$new_tag" >> $GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ steps.tag.outputs.new_tag }} | |
| name: Release ${{ steps.tag.outputs.new_tag }} | |
| body: | | |
| ## Raspberry Pi Release | |
| **Includes:** | |
| - Compiled apps (`InstrumentClusterApp`, `MiddleWareApp`) | |
| - Zenoh config files | |
| - Fonts | |
| - Full source code zip | |
| **Instructions:** | |
| - Copy `InstrumentClusterApp` and `MiddleWareApp` to `$PI_PATH_BIN` | |
| - Copy configs to `$PI_PATH_ETC` | |
| - Copy fonts to `$PI_PATH_FONTS` | |
| files: | | |
| release-package.zip | |
| artifacts/source-code.zip | |
| artifacts/bin/* # Ensure this correctly captures the binaries. Consider listing them explicitly if it fails. | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.PAT_LUIS }} |