Skip to content

Commit 4011441

Browse files
Josh V [Apple]pull[bot]
Josh V [Apple]
authored andcommitted
Add GitHub work flow for simulated device. (#11931)
* Simulated app to gen to zzz_generated folder and add build workflow * Generated files * Update PR to no use gn_build.sh.
1 parent de8ec30 commit 4011441

32 files changed

+4526
-10
lines changed

.github/workflows/build.yaml

+18-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191
timeout-minutes: 20
9292
run: scripts/run_in_build_env.sh "ninja -C ./out"
9393
build_linux:
94-
name: Build on Linux (gcc_release, clang, mbedtls)
94+
name: Build on Linux (gcc_release, clang, mbedtls, simulated)
9595
timeout-minutes: 60
9696

9797
runs-on: ubuntu-latest
@@ -135,6 +135,14 @@ jobs:
135135
path: |
136136
.environment/gn_out/.ninja_log
137137
.environment/pigweed-venv/*.log
138+
- name: Setup and Build Simulated Device
139+
timeout-minutes: 5
140+
run: |
141+
BUILD_TYPE=simulated
142+
GN_ARGS='chip_tests_zap_config="app1" chip_project_config_include_dirs=["../../examples/placeholder/linux/apps/app1/include", "../../config/standalone"] chip_config_network_layer_ble=false'
143+
CHIP_ROOT_PATH=examples/placeholder/linux
144+
CHIP_ROOT_PATH="$CHIP_ROOT_PATH" BUILD_TYPE="$BUILD_TYPE" scripts/build/gn_gen.sh --args="$GN_ARGS"
145+
scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE"
138146
- name: Setup Build, Run Build and Run Tests
139147
timeout-minutes: 50
140148
run: |
@@ -217,7 +225,7 @@ jobs:
217225
scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/chip-0.0-cp37-abi3-linux_x86_64.whl'
218226
scripts/run_in_build_env.sh '(cd src/controller/python/test/unit_tests/ && python3 -m unittest -v)'
219227
build_darwin:
220-
name: Build on Darwin (clang, python_lib)
228+
name: Build on Darwin (clang, python_lib, simulated)
221229
timeout-minutes: 90
222230
runs-on: macos-latest
223231
if: github.actor != 'restyled-io[bot]'
@@ -251,6 +259,14 @@ jobs:
251259
path: |
252260
.environment/gn_out/.ninja_log
253261
.environment/pigweed-venv/*.log
262+
- name: Setup and Build Simulated Device
263+
timeout-minutes: 5
264+
run: |
265+
BUILD_TYPE=simulated
266+
GN_ARGS='chip_tests_zap_config="app1" chip_project_config_include_dirs=["../../examples/placeholder/linux/apps/app1/include", "../../config/standalone"] chip_config_network_layer_ble=false'
267+
CHIP_ROOT_PATH=examples/placeholder/linux
268+
CHIP_ROOT_PATH="$CHIP_ROOT_PATH" BUILD_TYPE="$BUILD_TYPE" scripts/build/gn_gen.sh --args="$GN_ARGS"
269+
scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE"
254270
- name: Setup Build, Run Build and Run Tests
255271
timeout-minutes: 75
256272
# Just go ahead and do the "all" build; on Darwin that's fairly

examples/placeholder/linux/BUILD.gn

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ declare_args() {
2424
chip_data_model("configuration") {
2525
zap_file = "apps/${chip_tests_zap_config}/config.zap"
2626

27-
zap_pregenerated_dir = "${chip_root}/out/debug/placeholder/${chip_tests_zap_config}/zap-generated"
27+
zap_pregenerated_dir = "${chip_root}/zzz_generated/placeholder/${chip_tests_zap_config}/zap-generated"
2828
is_server = true
2929
}
3030

examples/placeholder/templates/helper.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
function getTests()
1919
{
2020
try {
21-
const appTest = require('../linux/apps/' + process.env.TARGET_APP + '/tests.js');
21+
const appTest = require('../linux/apps/app1/tests.js');
2222
return appTest.getTests();
2323
} catch (e) {
2424
console.info("No tests configuration has been found.");

scripts/build/gn_gen.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,14 @@ set -e
2121
# GN gen script for GN build GitHub workflow.
2222

2323
CHIP_ROOT="$(dirname "$0")/../.."
24+
if [[ -z "${CHIP_ROOT_PATH}" ]]; then
25+
CHIP_ROOT_PATH=""
26+
fi
2427

2528
source "$CHIP_ROOT/scripts/activate.sh"
2629

2730
set -x
2831

2932
env
3033

31-
gn --root="$CHIP_ROOT" gen --check --fail-on-unused-args "$CHIP_ROOT/out/$BUILD_TYPE" "$@"
34+
gn --root="$CHIP_ROOT/$CHIP_ROOT_PATH" gen --check --fail-on-unused-args "$CHIP_ROOT/out/$BUILD_TYPE" "$@"

scripts/examples/gn_build_test_example.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ set -e
2323
CHIP_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"/../..
2424

2525
INPUT_DIR="$CHIP_ROOT/examples/placeholder/linux"
26-
OUTPUT_DIR="$CHIP_ROOT/out/debug/placeholder"
26+
OUTPUT_DIR="$CHIP_ROOT/zzz_generated/placeholder"
2727

2828
source "$CHIP_ROOT/scripts/activate.sh"
2929

@@ -54,11 +54,11 @@ function runGN() {
5454
GN_ARGS+="chip_project_config_include_dirs=[\"$INPUT_DIR/apps/$APP_DIR/include\", \"$CHIP_ROOT/config/standalone\"]"
5555
GN_ARGS+="chip_config_network_layer_ble=false"
5656

57-
gn gen --check --fail-on-unused-args --root=examples/placeholder/linux "$OUTPUT_DIR" --args="$GN_ARGS"
57+
gn gen --check --fail-on-unused-args --root=examples/placeholder/linux "$CHIP_ROOT/out/$APP_DIR" --args="$GN_ARGS"
5858
}
5959

6060
function runNinja() {
61-
ninja -C "$OUTPUT_DIR"
61+
ninja -C "$CHIP_ROOT/out/$APP_DIR"
6262
}
6363

6464
function runAll() {

scripts/tools/zap_regen_all.py

+16-2
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,23 @@ def getGlobalTemplatesTargets():
4040
example_name = example_name[example_name.index('examples/') + 9:]
4141
example_name = example_name[:example_name.index('/')]
4242

43-
# Ignore placeholder examples since the zap files there are not intended to
44-
# be part of the tree.
43+
# Place holder has apps within each build
4544
if example_name == "placeholder":
45+
example_name = filepath.as_posix()
46+
example_name = example_name[example_name.index('apps/') + 5:]
47+
example_name = example_name[:example_name.index('/')]
48+
logging.info("Found example %s (via %s)" %
49+
(example_name, str(filepath)))
50+
51+
# The name zap-generated is to make includes clear by using
52+
# a name like <zap-generated/foo.h>
53+
output_dir = os.path.join(
54+
'zzz_generated', 'placeholder', example_name, 'zap-generated')
55+
if not os.path.exists(output_dir):
56+
os.makedirs(output_dir)
57+
template = 'examples/placeholder/templates/templates.json'
58+
targets.append([str(filepath), '-o', output_dir])
59+
targets.append([str(filepath), '-o', output_dir, '-t', template])
4660
continue
4761

4862
logging.info("Found example %s (via %s)" %

zzz_generated/placeholder/app1/zap-generated/CHIPClientCallbacks.cpp

+18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

zzz_generated/placeholder/app1/zap-generated/CHIPClientCallbacks.h

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

zzz_generated/placeholder/app1/zap-generated/CHIPClusters.cpp

+18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

zzz_generated/placeholder/app1/zap-generated/CHIPClusters.h

+18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)