Skip to content

ci: build all TI samples instead of just the BLE beacon#201

Open
HongNguyen635 wants to merge 3 commits into
HubbleNetwork:mainfrom
HongNguyen635:workflows/build_ti
Open

ci: build all TI samples instead of just the BLE beacon#201
HongNguyen635 wants to merge 3 commits into
HubbleNetwork:mainfrom
HongNguyen635:workflows/build_ti

Conversation

@HongNguyen635

Copy link
Copy Markdown
Collaborator

Introduce a different way to build for TI:

  • Have a sample.yaml in each sample dir with different configs we want to build.
  • Then the workflow will use the script to recursively search in the samples dir and build these.
  • We don't need to manually adding entry for every sample, every config anymore.

@HongNguyen635 HongNguyen635 changed the title Workflows/build ti ci: build all TI samples instead of just the BLE beacon May 22, 2026
@HongNguyen635 HongNguyen635 force-pushed the workflows/build_ti branch 3 times, most recently from 47fbfa2 to d0f489b Compare May 22, 2026 20:18
@HongNguyen635 HongNguyen635 marked this pull request as ready for review May 22, 2026 20:19
@HongNguyen635 HongNguyen635 force-pushed the workflows/build_ti branch 3 times, most recently from c528118 to 4e8ad59 Compare May 26, 2026 14:23
@HongNguyen635

Copy link
Copy Markdown
Collaborator Author

Example of build summary. The build will stop if a sample fails to build midway.

Screenshot 2026-05-26 at 7 26 39 AM

@ceolin ceolin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor things, it is looking super good

Comment thread tools/ci/ti_build.py Outdated
Comment thread tools/ci/ti_build.py Outdated
Comment thread tools/ci/ti_build.py Outdated
@HongNguyen635

Copy link
Copy Markdown
Collaborator Author

I addressed the comments, please take a look again.

@HongNguyen635 HongNguyen635 requested a review from ceolin May 26, 2026 20:33

@ceolin ceolin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a security implication between the script and the gh action.


prebuild:
- run: echo -n "AAAAAAAAAAAAAAAAAAAAAA==" > master.key
- run: python3 tools/embed_key_time.py -b master.key -o samples/freertos/ti/ble-beacon/src/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HongNguyen635 This can't be allowed. The action runs in the pull request context, this means that the user controls it and we are running whatever is set in here.

The easiest way is to set the fake key and dummy time directly in the code adding some comments that it must be overwrite with proper values.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a good point.

@HongNguyen635 HongNguyen635 requested a review from ceolin May 27, 2026 14:56
@HongNguyen635

Copy link
Copy Markdown
Collaborator Author

@ceolin that's a valid concern, and it's true for the builds step as well. Realistically speaking, attacker could put anything in the make file and we execute this make file on pull requests.

Since the scope is limited to read, they can't read repo secrets, but they can burn CI time for crypto mining for example. How do we want to handle this? Do you want to limit this workflow to trigger manually with write access reviewers?

# check if key and time is generated
generated_files = src/key.c src/time.c
ifeq ($(words $(wildcard $(generated_files))),2)
CFLAGS += -DHUBBLE_KEY_TIME_SET

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if there is an alternative way. I was thinking of using __has_include but this is compiler dependent...

Using dummy key and time if not set, this allows the sample
to be built without running the embed_key_time.py script, which
could be useful for CI or quick testing.

Signed-off-by: Hong Nguyen <hong@hubble.com>
s/sampes/samples

Signed-off-by: Hong Nguyen <hong@hubble.com>
Add a script to build all TI samples given if the sample dir
contains a `sample.yaml` file. This allows a bit more flexibility
instead of manually adding each entry into the workflow file.

Signed-off-by: Hong Nguyen <hong@hubble.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants