From 3f21a215a530117f9d3ffa1c8c7ba49edf63ed10 Mon Sep 17 00:00:00 2001 From: Geovane Fedrecheski Date: Tue, 26 Nov 2024 17:23:50 +0100 Subject: [PATCH 1/2] feat: configure builds from env var --- README.md | 2 +- swarmake/main.py | 9 +++++---- swarmake/swarmake.toml | 10 +++------- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 7fca016..4ece6d3 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ swarmake run lakers ## Deploy Deploy a Swarm of DotBots: ```bash -swarmake deploy move --monitor +TARGET_APP=move swarmake deploy --monitor ``` The command above will: diff --git a/swarmake/main.py b/swarmake/main.py index 1cf0dca..2331683 100755 --- a/swarmake/main.py +++ b/swarmake/main.py @@ -130,11 +130,9 @@ def list(): @main.command() @click.option('-m', '--monitor', default=False, is_flag=True, help="Tell swarmit to monitor the event logs right after the experiment starts") -@click.argument("firmware_name") -def deploy(firmware_name, monitor): +def deploy(monitor): """Deploy a firmware to a set of DotBots.""" dotbot_project = load_project_config("dotbot") - swarmit_project = load_project_config("swarmit") # if needed, build dotbot and swarmit projects res = cmd.execute(dotbot_project.list_outputs_cmd, directory=dotbot_project.build_dir) @@ -153,7 +151,10 @@ def deploy(firmware_name, monitor): # deploy the firmware to the devices using swarmit res = cmd.execute("swarmit stop") # make sure experiment is not running - time.sleep(1) + if not res: + logging.warning("Failed to stop the experiment") + return + time.sleep(2) res = cmd.execute_pretty(f"swarmit flash -y $PWD/build/dotbot/{dotbot_project.output_dir}/*.bin") time.sleep(1) if not res: diff --git a/swarmake/swarmake.toml b/swarmake/swarmake.toml index 09a8cb5..0ceff10 100644 --- a/swarmake/swarmake.toml +++ b/swarmake/swarmake.toml @@ -1,13 +1,9 @@ [projects.dotbot] repo = "DotBot-firmware" # if the project name is different from the repo name -build = """ -BUILD_TARGET=dotbot-v2 BUILD_CONFIG=Debug DOCKER_TARGETS="swarmit_motors" make docker -""" -list-outputs = """ -ls -l swarmit/motors/Output/dotbot-v2/Debug/Exe -""" -output-dir = "swarmit/motors/Output/dotbot-v2/Debug/Exe" +build = "BUILD_TARGET=dotbot-v2 BUILD_CONFIG=Debug DOCKER_TARGETS=swarmit_$TARGET_APP make docker" +list-outputs = "ls -l swarmit/$TARGET_APP/Output/dotbot-v2/Debug/Exe" +output-dir = "swarmit/$TARGET_APP/Output/dotbot-v2/Debug/Exe" [projects.pydotbot] repo = "PyDotBot" From 392008d80e0fdfe134b5b31c4726548dd513ac83 Mon Sep 17 00:00:00 2001 From: Geovane Fedrecheski Date: Tue, 26 Nov 2024 17:27:35 +0100 Subject: [PATCH 2/2] fix: adjust ci for dotbot --- .github/workflows/main.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index add8c38..ee6728b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -136,4 +136,8 @@ jobs: - name: Build ${{ matrix.target }} run: | - BUILD_CONFIG=debug swarmake build ${{ matrix.target }} + if [ "${{ matrix.target }}" == "dotbot" ]; then + BUILD_CONFIG=debug TARGET_APP=move swarmake build ${{ matrix.target }} + else + BUILD_CONFIG=debug swarmake build ${{ matrix.target }} + fi