Skip to content
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

Separate out E2E build rules into different directories #12303

Merged
merged 38 commits into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
068b63a
Add a lot more host build variants for build_examples
andy31415 Nov 26, 2021
e0ba872
Fix single event loop logic for building
andy31415 Nov 26, 2021
8f4805e
Switch build to build_examples and separate paths for linux in CI wor…
andy31415 Nov 26, 2021
7190ec9
Do not blacklist ipv6 builds
andy31415 Nov 29, 2021
f11130b
Undo change in test yaml for event loop types
andy31415 Nov 29, 2021
d6de31c
Undo double quoting
andy31415 Nov 29, 2021
48303de
Fix separate event loop logic
andy31415 Nov 29, 2021
dbe7818
Fix default of separate event loop: same event loop is the default
andy31415 Nov 29, 2021
41209eb
Fix typo in super call
andy31415 Nov 29, 2021
7927e40
Allow more build time since we are building 3 apps now
andy31415 Nov 29, 2021
90666ba
Do not yet update the tests.yaml file - want to make these changes gr…
andy31415 Nov 29, 2021
a1f61fa
Revert "Do not yet update the tests.yaml file - want to make these ch…
andy31415 Nov 29, 2021
5a12d59
Fix up the event loop name logic for test running
andy31415 Nov 29, 2021
b69e2fd
Make the matrix logic and scripts much more readable
andy31415 Nov 29, 2021
c260a8e
Remove obsolete logic code
andy31415 Nov 29, 2021
5f9bb92
Fix yet another typo in variable replacement
andy31415 Nov 29, 2021
ce8c4ba
Convert darwin to use build_examples AND test TV apps
andy31415 Nov 29, 2021
6a3e4aa
Bump the time for darwin tests: it looks like ToT takes 29:45 and 30 …
andy31415 Nov 29, 2021
bbd789f
Merge branch 'master' into more_host_build_variants
andy31415 Nov 29, 2021
413f2ae
Merge branch 'master' into more_host_build_variants
andy31415 Nov 30, 2021
bbee509
Disable ASAN builds for linux (according to build history they do not…
andy31415 Nov 30, 2021
11020ef
Add asan and tsan target support
andy31415 Nov 30, 2021
a73bd6d
Restyle fixes
andy31415 Nov 30, 2021
23029b1
Give a name to the chip tool without special variants
andy31415 Nov 30, 2021
cad1ba4
Use empty string for empty tool variant
andy31415 Nov 30, 2021
00eb82f
Code review suggestions
andy31415 Nov 30, 2021
b1888c7
fix typo
andy31415 Nov 30, 2021
f345120
Minor bug fix, target list now works
andy31415 Nov 30, 2021
19f600a
one more typo fix
andy31415 Nov 30, 2021
8e0d151
Merge branch 'master' into more_host_build_variants
andy31415 Nov 30, 2021
43f9160
Typo fix
andy31415 Nov 30, 2021
812664e
Match zap version to master
andy31415 Nov 30, 2021
a8c8fb5
flip order of chip-tool/run to match master ordering
andy31415 Nov 30, 2021
c1750bf
Merge branch 'master' into more_host_build_variants
andy31415 Nov 30, 2021
4d7e52a
Merge branch 'master' into more_host_build_variants
andy31415 Dec 1, 2021
5777d12
Merge branch 'master' into more_host_build_variants
andy31415 Dec 1, 2021
3d7871c
Do not build/test TV app on darwin. It does not seem to work. We can …
andy31415 Dec 1, 2021
4caa376
Merge branch 'master' into more_host_build_variants
andy31415 Dec 2, 2021
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
78 changes: 33 additions & 45 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ jobs:

strategy:
matrix:
type: [tsan]
eventloop: [eventloop_same, eventloop_separate]
build_variant: [no-ble-tsan]
chip_tool: ["", -same-event-loop]
env:
USE_SEPARATE_EVENTLOOP: ${{ matrix.eventloop == 'eventloop_separate' }}
USE_TSAN: ${{ matrix.type == 'tsan' }}
BUILD_VARIANT: ${{matrix.build_variant}}
CHIP_TOOL_VARIANT: ${{matrix.chip_tool}}

if: github.actor != 'restyled-io[bot]'
runs-on: ubuntu-latest
Expand Down Expand Up @@ -66,33 +66,27 @@ jobs:
path: |
.environment/gn_out/.ninja_log
.environment/pigweed-venv/*.log
- name: Build all clusters app
timeout-minutes: 5
- name: Build Apps
timeout-minutes: 20
run: |
scripts/examples/gn_build_example.sh examples/all-clusters-app/linux out/debug/standalone/ chip_config_network_layer_ble=false is_tsan=${USE_TSAN}
- name: Build TV app
timeout-minutes: 5
run: |
scripts/examples/gn_build_example.sh examples/tv-app/linux out/debug/standalone/ chip_config_network_layer_ble=false is_tsan=${USE_TSAN}
- name: Build chip-tool
timeout-minutes: 5
run: |
scripts/examples/gn_build_example.sh examples/chip-tool out/debug/standalone/ is_tsan=${USE_TSAN} config_use_separate_eventloop=${USE_SEPARATE_EVENTLOOP}
- name: Copy objdir
run: |
# The idea is to not upload our objdir unless builds have
# actually succeeded, because that just wastes space.
rsync -a out/debug/standalone/ objdir-clone || true
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py \
--target linux-x64-chip-tool-${BUILD_VARIANT}${CHIP_TOOL_VARIANT} \
--target linux-x64-all-clusters-${BUILD_VARIANT} \
--target linux-x64-tv-app-${BUILD_VARIANT} \
build \
--copy-artifacts-to objdir-clone \
"
- name: Run Tests
timeout-minutes: 30
run: |
./scripts/run_in_build_env.sh \
"./scripts/tests/run_test_suite.py \
--chip-tool ./out/debug/standalone/chip-tool \
--chip-tool ./out/linux-x64-chip-tool-${BUILD_VARIANT}${CHIP_TOOL_VARIANT}/chip-tool \
run \
--iterations 1 \
--all-clusters-app ./out/debug/standalone/chip-all-clusters-app \
--tv-app ./out/debug/standalone/chip-tv-app \
--all-clusters-app ./out/linux-x64-all-clusters-${BUILD_VARIANT}/chip-all-clusters-app \
--tv-app ./out/linux-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \
"
- name: Uploading core files
uses: actions/upload-artifact@v2
Expand All @@ -116,13 +110,11 @@ jobs:

strategy:
matrix:
type: [tsan, asan]
eventloop: [eventloop_same, eventloop_separate]
build_variant: [no-ble-tsan, no-ble-asan]
chip_tool: ["", -same-event-loop]
env:
USE_SEPARATE_EVENTLOOP: ${{ matrix.eventloop == 'eventloop_separate' }}
USE_TSAN: ${{ matrix.type == 'tsan' }}

USE_ASAN: ${{ matrix.type == 'asan' }}
BUILD_VARIANT: ${{matrix.build_variant}}
CHIP_TOOL_VARIANT: ${{matrix.chip_tool}}

if: github.actor != 'restyled-io[bot]'
runs-on: macos-latest
Expand Down Expand Up @@ -159,30 +151,26 @@ jobs:
path: |
.environment/gn_out/.ninja_log
.environment/pigweed-venv/*.log
- name: Run Build Test Server
timeout-minutes: 10
run: |
scripts/examples/gn_build_example.sh examples/all-clusters-app/linux out/debug/standalone/ chip_config_network_layer_ble=false is_tsan=${USE_TSAN} is_asan=${USE_ASAN}
- name: Build chip-tool
timeout-minutes: 10
- name: Build Apps
timeout-minutes: 20
run: |
scripts/examples/gn_build_example.sh examples/chip-tool out/debug/standalone/ is_tsan=${USE_TSAN} is_asan=${USE_ASAN} config_use_separate_eventloop=${USE_SEPARATE_EVENTLOOP}
- name: Copy objdir
run: |
# The idea is to not upload our objdir unless builds have
# actually succeeded, because that just wastes space.
rsync -a out/debug/standalone/ objdir-clone || true
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py \
--target darwin-x64-chip-tool-${BUILD_VARIANT}${CHIP_TOOL_VARIANT} \
--target darwin-x64-all-clusters-${BUILD_VARIANT} \
build \
--copy-artifacts-to objdir-clone \
"
- name: Run Tests
timeout-minutes: 45
run: |
./scripts/run_in_build_env.sh \
"./scripts/tests/run_test_suite.py \
--chip-tool ./out/debug/standalone/chip-tool \
--target-skip-glob 'TV_*' \
--chip-tool ./out/darwin-x64-chip-tool-${BUILD_VARIANT}${CHIP_TOOL_VARIANT}/chip-tool \
--target-skip-glob 'TV*' \
run \
--iterations 1 \
--all-clusters-app ./out/debug/standalone/chip-all-clusters-app \
--tv-app ./out/debug/standalone/chip-tv-app \
--all-clusters-app ./out/darwin-x64-all-clusters-${BUILD_VARIANT}/chip-all-clusters-app \
"
- name: Uploading core files
uses: actions/upload-artifact@v2
Expand Down
72 changes: 70 additions & 2 deletions scripts/build/build/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

import os

from typing import Any, List
from itertools import combinations

from builders.android import AndroidBoard, AndroidApp, AndroidBuilder
from builders.efr32 import Efr32Builder, Efr32App, Efr32Board
from builders.esp32 import Esp32Builder, Esp32Board, Esp32App
Expand Down Expand Up @@ -93,6 +96,34 @@ def GlobBlacklistReason(self):
return self.glob_blacklist_reason


class AcceptAnyName:
def Accept(self, name: str):
return True


class AcceptNameWithSubstring:
def __init__(self, substr: str):
self.substr = substr

def Accept(self, name: str):
return self.substr in name


class HostBuildVariant:
def __init__(self, name: str, validator=AcceptAnyName(), conflicts: List[str] = [], **buildargs):
self.name = name
self.validator = validator
self.conflicts = conflicts
self.buildargs = buildargs


def HasConflicts(items: List[HostBuildVariant]) -> bool:
for a, b in combinations(items, 2):
if (a.name in b.conflicts) or (b.name in a.conflicts):
return True
return False


def HostTargets():
target = Target(HostBoard.NATIVE.PlatformName(), HostBuilder)
targets = [
Expand All @@ -119,10 +150,47 @@ def HostTargets():
app_targets.append(target.Extend('thermostat', app=HostApp.THERMOSTAT))
app_targets.append(target.Extend('minmdns', app=HostApp.MIN_MDNS))

# Possible build variants. Note that number of potential
# builds is exponential here
variants = [
HostBuildVariant(name="ipv6only", enable_ipv4=False),
HostBuildVariant(name="no-ble", enable_ble=False),
HostBuildVariant(name="tsan", conflicts=['asan'], use_tsan=True),
HostBuildVariant(name="asan", conflicts=['tsan'], use_asan=True),
HostBuildVariant(name="same-event-loop",
validator=AcceptNameWithSubstring('-chip-tool'), separate_event_loop=False),
]

glob_whitelist = set(['ipv6only'])

for target in app_targets:
yield target
if ('rpc-console' not in target.name):
yield target.Extend('ipv6only', enable_ipv4=False)

if 'rpc-console' in target.name:
# rpc console has only one build variant right now
continue

# skip variants that do not work for this target
ok_variants = [v for v in variants if v.validator.Accept(target.name)]

# Build every possible variant
for variant_count in range(1, len(ok_variants) + 1):
for subgroup in combinations(ok_variants, variant_count):
if HasConflicts(subgroup):
continue

# Target ready to be created - no conflicts
variant_target = target.Clone()
for option in subgroup:
variant_target = variant_target.Extend(
option.name, **option.buildargs)

# Only a few are whitelisted for globs
if '-'.join([o.name for o in subgroup]) not in glob_whitelist:
variant_target = variant_target.GlobBlacklist(
'Reduce default build variants')

yield variant_target


def Esp32Targets():
Expand Down
16 changes: 15 additions & 1 deletion scripts/build/builders/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ def PlatformName(self):

class HostBuilder(GnBuilder):

def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE, enable_ipv4=True):
def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE, enable_ipv4=True,
enable_ble=True, use_tsan=False, use_asan=False, separate_event_loop=True
):
super(HostBuilder, self).__init__(
root=os.path.join(root, 'examples', app.ExamplePath()),
runner=runner)
Expand All @@ -117,6 +119,18 @@ def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE, enable_ip
if not enable_ipv4:
self.extra_gn_options.append('chip_inet_config_enable_ipv4=false')

if not enable_ble:
self.extra_gn_options.append('chip_config_network_layer_ble=false')

if use_tsan:
self.extra_gn_options.append('is_tsan=true')

if use_asan:
self.extra_gn_options.append('is_asan=true')

if not separate_event_loop:
self.extra_gn_options.append('config_use_separate_eventloop=false')

def GnBuildArgs(self):
if self.board == HostBoard.NATIVE:
return self.extra_gn_options
Expand Down