Skip to content

Commit

Permalink
Add GitHub work flow for simulated device. (#11931)
Browse files Browse the repository at this point in the history
* Simulated app to gen to zzz_generated folder and add build workflow

* Generated files

* Update PR to no use gn_build.sh.
  • Loading branch information
Josh V [Apple] authored and pull[bot] committed Nov 29, 2023
1 parent a074caa commit 5381378
Show file tree
Hide file tree
Showing 32 changed files with 4,526 additions and 10 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
timeout-minutes: 20
run: scripts/run_in_build_env.sh "ninja -C ./out"
build_linux:
name: Build on Linux (gcc_release, clang, mbedtls)
name: Build on Linux (gcc_release, clang, mbedtls, simulated)
timeout-minutes: 60

runs-on: ubuntu-latest
Expand Down Expand Up @@ -135,6 +135,14 @@ jobs:
path: |
.environment/gn_out/.ninja_log
.environment/pigweed-venv/*.log
- name: Setup and Build Simulated Device
timeout-minutes: 5
run: |
BUILD_TYPE=simulated
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'
CHIP_ROOT_PATH=examples/placeholder/linux
CHIP_ROOT_PATH="$CHIP_ROOT_PATH" BUILD_TYPE="$BUILD_TYPE" scripts/build/gn_gen.sh --args="$GN_ARGS"
scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE"
- name: Setup Build, Run Build and Run Tests
timeout-minutes: 50
run: |
Expand Down Expand Up @@ -217,7 +225,7 @@ jobs:
scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/chip-0.0-cp37-abi3-linux_x86_64.whl'
scripts/run_in_build_env.sh '(cd src/controller/python/test/unit_tests/ && python3 -m unittest -v)'
build_darwin:
name: Build on Darwin (clang, python_lib)
name: Build on Darwin (clang, python_lib, simulated)
timeout-minutes: 90
runs-on: macos-latest
if: github.actor != 'restyled-io[bot]'
Expand Down Expand Up @@ -251,6 +259,14 @@ jobs:
path: |
.environment/gn_out/.ninja_log
.environment/pigweed-venv/*.log
- name: Setup and Build Simulated Device
timeout-minutes: 5
run: |
BUILD_TYPE=simulated
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'
CHIP_ROOT_PATH=examples/placeholder/linux
CHIP_ROOT_PATH="$CHIP_ROOT_PATH" BUILD_TYPE="$BUILD_TYPE" scripts/build/gn_gen.sh --args="$GN_ARGS"
scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE"
- name: Setup Build, Run Build and Run Tests
timeout-minutes: 75
# Just go ahead and do the "all" build; on Darwin that's fairly
Expand Down
2 changes: 1 addition & 1 deletion examples/placeholder/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ declare_args() {
chip_data_model("configuration") {
zap_file = "apps/${chip_tests_zap_config}/config.zap"

zap_pregenerated_dir = "${chip_root}/out/debug/placeholder/${chip_tests_zap_config}/zap-generated"
zap_pregenerated_dir = "${chip_root}/zzz_generated/placeholder/${chip_tests_zap_config}/zap-generated"
is_server = true
}

Expand Down
2 changes: 1 addition & 1 deletion examples/placeholder/templates/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
function getTests()
{
try {
const appTest = require('../linux/apps/' + process.env.TARGET_APP + '/tests.js');
const appTest = require('../linux/apps/app1/tests.js');
return appTest.getTests();
} catch (e) {
console.info("No tests configuration has been found.");
Expand Down
5 changes: 4 additions & 1 deletion scripts/build/gn_gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ set -e
# GN gen script for GN build GitHub workflow.

CHIP_ROOT="$(dirname "$0")/../.."
if [[ -z "${CHIP_ROOT_PATH}" ]]; then
CHIP_ROOT_PATH=""
fi

source "$CHIP_ROOT/scripts/activate.sh"

set -x

env

gn --root="$CHIP_ROOT" gen --check --fail-on-unused-args "$CHIP_ROOT/out/$BUILD_TYPE" "$@"
gn --root="$CHIP_ROOT/$CHIP_ROOT_PATH" gen --check --fail-on-unused-args "$CHIP_ROOT/out/$BUILD_TYPE" "$@"
6 changes: 3 additions & 3 deletions scripts/examples/gn_build_test_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ set -e
CHIP_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"/../..

INPUT_DIR="$CHIP_ROOT/examples/placeholder/linux"
OUTPUT_DIR="$CHIP_ROOT/out/debug/placeholder"
OUTPUT_DIR="$CHIP_ROOT/zzz_generated/placeholder"

source "$CHIP_ROOT/scripts/activate.sh"

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

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

function runNinja() {
ninja -C "$OUTPUT_DIR"
ninja -C "$CHIP_ROOT/out/$APP_DIR"
}

function runAll() {
Expand Down
18 changes: 16 additions & 2 deletions scripts/tools/zap_regen_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,23 @@ def getGlobalTemplatesTargets():
example_name = example_name[example_name.index('examples/') + 9:]
example_name = example_name[:example_name.index('/')]

# Ignore placeholder examples since the zap files there are not intended to
# be part of the tree.
# Place holder has apps within each build
if example_name == "placeholder":
example_name = filepath.as_posix()
example_name = example_name[example_name.index('apps/') + 5:]
example_name = example_name[:example_name.index('/')]
logging.info("Found example %s (via %s)" %
(example_name, str(filepath)))

# The name zap-generated is to make includes clear by using
# a name like <zap-generated/foo.h>
output_dir = os.path.join(
'zzz_generated', 'placeholder', example_name, 'zap-generated')
if not os.path.exists(output_dir):
os.makedirs(output_dir)
template = 'examples/placeholder/templates/templates.json'
targets.append([str(filepath), '-o', output_dir])
targets.append([str(filepath), '-o', output_dir, '-t', template])
continue

logging.info("Found example %s (via %s)" %
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions zzz_generated/placeholder/app1/zap-generated/CHIPClientCallbacks.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions zzz_generated/placeholder/app1/zap-generated/CHIPClusters.cpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions zzz_generated/placeholder/app1/zap-generated/CHIPClusters.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5381378

Please sign in to comment.