Skip to content

Split TravisCI build into one job per variant #373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@ git:
quiet: true

env:
- BSP_PATH="$HOME/.arduino15/packages/adafruit/hardware/nrf52"

global:
- BSP_PATH="$HOME/.arduino15/packages/adafruit/hardware/nrf52"
jobs:
# Split into one job per board (aka variant)
- VARIANT="feather52840"
- VARIANT="cplaynrf52840"
- VARIANT="feather52832"

addons:
apt:
packages:
Expand Down
19 changes: 17 additions & 2 deletions tools/build_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,23 @@ def build_examples(variant):

build_time = time.monotonic()

for var in variants_dict:
build_examples(var)
ENV_VARIABLE_NAME = 'VARIANT'

# build only one variant if the environment variable is specified
if (ENV_VARIABLE_NAME in os.environ):
variant = os.environ.get(ENV_VARIABLE_NAME)
# only use the environment variable if the variant exists in the dictionary
if (variant in variants_dict):
build_examples(variant)
else:
print('\033[31failed\033[0m - invalid variant name "{}"'.format(variant))
fail_count += 1
exit_status = -1

else: # no environment variable specified, so build all variants
Copy link
Member

Choose a reason for hiding this comment

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

nice that you keep the build all option, I usually run this locally before pushing when doing major changes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I noticed that you checked for travis, and so I thought this might be the case. 👍

for var in variants_dict:
build_examples(var)


print(build_separator)
build_time = time.monotonic() - build_time
Expand Down