This repository was archived by the owner on Oct 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
168 lines (144 loc) · 5.9 KB
/
deploy.yml
File metadata and controls
168 lines (144 loc) · 5.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
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 }}