blob: 4c25026840e5d1775b7f1bbecf6228923562d4b6 [file] [log] [blame]
# Copyright (c) 2020-2021 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Darwin
on:
push:
branches-ignore:
- "dependabot/**"
pull_request:
merge_group:
workflow_dispatch:
concurrency:
group:
${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name ==
'pull_request' && github.event.number) || (github.event_name ==
'workflow_dispatch' && github.run_number) || github.sha }}
cancel-in-progress: true
env:
CHIP_NO_LOG_TIMESTAMPS: true
jobs:
framework:
name: Build framework
if: github.actor != 'restyled-io[bot]'
runs-on: macos-13
strategy:
matrix:
options: # We don't need a full matrix
- flavor: macos-release
arguments: -sdk macosx -configuration Release
- flavor: ios-release
arguments: -sdk iphoneos -configuration Release
- flavor: tvos-debug
arguments: -sdk appletvos -configuration Debug
- flavor: watchos-debug
arguments: -sdk watchos -configuration Debug
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout submodules & Bootstrap
uses: ./.github/actions/checkout-submodules-and-bootstrap
with:
platform: darwin
bootstrap-log-name:
bootstrap-logs-framework-${{ matrix.options.flavor }}
- name: Block zap-cli from being used
env:
PW_ENVSETUP_NO_BANNER: 1
run: |
# Framework builds are NOT expected to require zap-cli
scripts/run_in_build_env.sh 'rm -- "$(which zap-cli)"'
# run_in_build_env.sh is used to ensure PATH is set to something that would otherwise find zap-cli
scripts/run_in_build_env.sh '(zap-cli --version && exit 1) || exit 0'
- name: Build
working-directory: src/darwin/Framework
run: xcodebuild -target "Matter" ${{ matrix.options.arguments }}
tests:
name: Run framework tests
if: github.actor != 'restyled-io[bot]'
needs: [framework] # serialize to avoid running to many parallel macos runners
runs-on: macos-13
strategy:
matrix:
options: # We don't need a full matrix
- flavor: asan
arguments:
-enableAddressSanitizer YES
-enableUndefinedBehaviorSanitizer YES
- flavor: tsan
arguments: -enableThreadSanitizer YES
# "leaks" does not seem to be very compatible with asan or tsan
- flavor: leaks
defines: ENABLE_LEAK_DETECTION=1
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout submodules & Bootstrap
uses: ./.github/actions/checkout-submodules-and-bootstrap
with:
platform: darwin
bootstrap-log-name:
bootstrap-logs-framework-${{ matrix.options.flavor }}
- name: Build example All Clusters Server
run: |
scripts/examples/gn_build_example.sh examples/all-clusters-app/linux out/debug/all-clusters-app chip_config_network_layer_ble=false
- name: Build example OTA Provider
run: |
scripts/examples/gn_build_example.sh examples/ota-provider-app/linux out/debug/ota-provider-app chip_config_network_layer_ble=false
- name: Build example OTA Requestor
run: |
scripts/examples/gn_build_example.sh examples/ota-requestor-app/linux out/debug/ota-requestor-app chip_config_network_layer_ble=false non_spec_compliant_ota_action_delay_floor=0
- name: Run Framework Tests
# We want to ensure that our log upload runs on timeout, so use a timeout here shorter
# than the 6-hour overall job timeout. 4.5 hours should be plenty.
timeout-minutes: 270
working-directory: src/darwin/Framework
run: |
mkdir -p /tmp/darwin/framework-tests
../../../out/debug/all-clusters-app/chip-all-clusters-app --interface-id -1 > >(tee /tmp/darwin/framework-tests/all-cluster-app.log) 2> >(tee /tmp/darwin/framework-tests/all-cluster-app-err.log >&2) &
export TEST_RUNNER_ASAN_OPTIONS=__CURRENT_VALUE__:detect_stack_use_after_return=1
# Disable BLE (CHIP_IS_BLE=NO) because the app does not have the permission to use it and that may crash the CI.
xcodebuild test -target "Matter" -scheme "Matter Framework Tests" -sdk macosx ${{ matrix.options.arguments }} \
CHIP_IS_BLE=NO GCC_PREPROCESSOR_DEFINITIONS='${inherited} ${{ matrix.options.defines }}' \
> >(tee /tmp/darwin/framework-tests/darwin-tests.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-err.log >&2)
- name: Collect crash logs
if: failure() && !env.ACT
run: |
mkdir -p /tmp/darwin/framework-tests
find ~/Library/Developer/Xcode/DerivedData /Library/Logs/DiagnosticReports -name '*.ips' -print0 | xargs -0 -J % cp % /tmp/darwin/framework-tests
- name: Uploading log files
uses: actions/upload-artifact@v4
if: failure() && !env.ACT
with:
name: darwin-framework-test-logs-${{ matrix.options.flavor }}
path: /tmp/darwin/framework-tests
retention-days: 5