Skip to content

Commit

Permalink
Set build parameter to reduce binary file sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
flba-eb committed Jun 21, 2024
1 parent abe5f77 commit 66a3ab6
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
- name: test Zenoh
run: |
set -x
( cd zenoh && patch -p1 < ../zenoh-patch.diff )
sudo chown -R 1000 zenoh
time docker run \
-v $(realpath zenoh):/src \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ A container is created which contains a sysroot and image:
- Target is a QEMU image, simulating an aarch64 CPU
- Tests are executed on target using the script [run_on_target.sh](scripts/run_on_target.sh), which
uploads the file and runs it.
- WARNING: It only executes one (small) unit test to reduce the disk usage. Standard Github action runners run out of space otherwise.
- The zenoh build configuration is slightly changed to reduce disk space usage (especially debug symbols are disabled, see [patch](./zenoh-patch.diff) for details)
15 changes: 13 additions & 2 deletions scripts/test-zenoh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,21 @@ cd /src
ssh target "mkdir -p /tmp/test/a/b"
scp DEFAULT_CONFIG.json5 target:/tmp/test

# The runners sometimes run out of disk space, which is why it is monitored:
show_res_usage () {
set +ex
sleep 5
while true ; do
sleep 10
echo "$(echo ============ && df -h . && du -shc target/* && echo ============)"
done
}
show_res_usage &

# Run tests
if [[ "$*" == *"--only-one-test"* ]] ; then
# only run one small test, as we would run out of disk space otherwise (on standard Github action runners)
cd commons/zenoh-buffers
fi
df -h .
cargo t --target aarch64-unknown-linux-gnu --release

cargo t --target aarch64-unknown-linux-gnu -j1
19 changes: 19 additions & 0 deletions zenoh-patch.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff --git a/Cargo.toml b/Cargo.toml
index 4e1c6299..bf7d6efc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -204,8 +204,13 @@ zenoh-runtime = { version = "0.11.0", path = "commons/zenoh-runtime" }
zenoh-task = { version = "0.11.0", path = "commons/zenoh-task" }

[profile.dev]
-debug = true
-opt-level = 0
+debug = false
+debug-assertions = false
+lto = false
+strip = true
+incremental = false
+opt-level = "s"

[profile.fast]
inherits = "release"

0 comments on commit 66a3ab6

Please sign in to comment.