darwin-tests.yaml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. # Copyright (c) 2022 Project CHIP Authors
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. name: Darwin Tests
  15. on:
  16. push:
  17. pull_request:
  18. merge_group:
  19. workflow_dispatch:
  20. concurrency:
  21. group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name ==
  22. 'pull_request' && github.event.number) || (github.event_name ==
  23. 'workflow_dispatch' && github.run_number) || github.sha }}
  24. cancel-in-progress: true
  25. env:
  26. CHIP_NO_LOG_TIMESTAMPS: true
  27. jobs:
  28. test_suites_chip_tool_darwin:
  29. name: Test Suites - Darwin
  30. strategy:
  31. matrix:
  32. build_variant: [no-ble-asan-clang]
  33. env:
  34. BUILD_VARIANT: ${{matrix.build_variant}}
  35. LSAN_OPTIONS: detect_leaks=1 malloc_context_size=40 suppressions=scripts/tests/chiptest/lsan-mac-suppressions.txt
  36. if: github.actor != 'restyled-io[bot]'
  37. runs-on: macos-latest
  38. steps:
  39. - name: Checkout
  40. uses: actions/checkout@v4
  41. - name: Setup Environment
  42. # coreutils for stdbuf
  43. run: brew install coreutils
  44. - name:
  45. Try to ensure the directories for core dumping and diagnostic
  46. log collection exist and we can write them.
  47. run: |
  48. sudo chown ${USER} /cores || true
  49. mkdir -p ~/Library/Logs/DiagnosticReports || true
  50. mkdir objdir-clone || true
  51. - name: Checkout submodules & Bootstrap
  52. uses: ./.github/actions/checkout-submodules-and-bootstrap
  53. with:
  54. platform: darwin
  55. bootstrap-log-name: bootstrap-logs-darwin-${{ matrix.build_variant }}
  56. - name: Run macOS Darwin Framework Tool Build Debug
  57. working-directory: src/darwin/Framework
  58. # Keep whatever Xcode settings
  59. # for OTHER_CFLAGS exist by using ${inherited}.
  60. #
  61. # Enable -Wconversion by hand as well, because it seems to not be
  62. # enabled by default in the Xcode config.
  63. #
  64. # Disable availability annotations, since we are not building against a system
  65. # Matter.framework.
  66. run: xcodebuild -target "darwin-framework-tool" -sdk macosx -configuration Debug OTHER_CFLAGS='${inherited} -Wconversion' GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'
  67. - name: Delete Defaults
  68. run: defaults delete com.apple.dt.xctest.tool
  69. continue-on-error: true
  70. - name: Clean Build
  71. run: xcodebuild clean
  72. working-directory: src/darwin/Framework
  73. - name: Build Apps
  74. run: |
  75. ./scripts/run_in_build_env.sh \
  76. "./scripts/build/build_examples.py \
  77. --target darwin-x64-darwin-framework-tool-${BUILD_VARIANT} \
  78. --target darwin-x64-all-clusters-${BUILD_VARIANT} \
  79. --target darwin-x64-lock-${BUILD_VARIANT} \
  80. --target darwin-x64-ota-provider-${BUILD_VARIANT} \
  81. --target darwin-x64-ota-requestor-${BUILD_VARIANT} \
  82. --target darwin-x64-tv-app-${BUILD_VARIANT} \
  83. --target darwin-x64-bridge-${BUILD_VARIANT} \
  84. build \
  85. --copy-artifacts-to objdir-clone \
  86. "
  87. - name: Run Tests
  88. run: |
  89. ./scripts/run_in_build_env.sh \
  90. "./scripts/tests/run_test_suite.py \
  91. --chip-tool ./out/darwin-x64-darwin-framework-tool-${BUILD_VARIANT}/darwin-framework-tool \
  92. --target-skip-glob '{TestAccessControlConstraints}' \
  93. run \
  94. --iterations 1 \
  95. --test-timeout-seconds 120 \
  96. --all-clusters-app ./out/darwin-x64-all-clusters-${BUILD_VARIANT}/chip-all-clusters-app \
  97. --lock-app ./out/darwin-x64-lock-${BUILD_VARIANT}/chip-lock-app \
  98. --ota-provider-app ./out/darwin-x64-ota-provider-${BUILD_VARIANT}/chip-ota-provider-app \
  99. --ota-requestor-app ./out/darwin-x64-ota-requestor-${BUILD_VARIANT}/chip-ota-requestor-app \
  100. --tv-app ./out/darwin-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \
  101. --bridge-app ./out/darwin-x64-bridge-${BUILD_VARIANT}/chip-bridge-app \
  102. "
  103. - name: Run OTA Test
  104. run: |
  105. ./scripts/run_in_build_env.sh \
  106. "./scripts/tests/run_darwin_framework_ota_test.py \
  107. run \
  108. --darwin-framework-tool ./out/darwin-x64-darwin-framework-tool-${BUILD_VARIANT}/darwin-framework-tool \
  109. --ota-requestor-app ./out/darwin-x64-ota-requestor-${BUILD_VARIANT}/chip-ota-requestor-app \
  110. --ota-data-file /tmp/rawImage \
  111. --ota-image-file /tmp/otaImage \
  112. --ota-destination-file /tmp/downloadedImage \
  113. --ota-candidate-file /tmp/otaCandidateJSON \
  114. "
  115. - name: Uploading core files
  116. uses: actions/upload-artifact@v3
  117. if: ${{ failure() && !env.ACT }}
  118. with:
  119. name: crash-core-darwin-${{ matrix.build_variant }}
  120. path: /cores/
  121. # Cores are big; don't hold on to them too long.
  122. retention-days: 5
  123. - name: Uploading diagnostic logs
  124. uses: actions/upload-artifact@v3
  125. if: ${{ failure() && !env.ACT }}
  126. with:
  127. name: crash-log-darwin-${{ matrix.build_variant }}
  128. path: ~/Library/Logs/DiagnosticReports/
  129. - name: Uploading framework build log
  130. uses: actions/upload-artifact@v3
  131. if: ${{ failure() && !env.ACT }}
  132. with:
  133. name: framework-build-log-darwin-${{ matrix.build_variant }}
  134. path: out/darwin-x64-darwin-framework-tool-${{ matrix.build_variant }}/darwin_framework_build.log
  135. - name: Uploading objdir for debugging
  136. uses: actions/upload-artifact@v3
  137. if: ${{ failure() && !env.ACT }}
  138. with:
  139. name: crash-objdir-darwin-${{ matrix.build_variant }}
  140. path: objdir-clone/
  141. # objdirs are big; don't hold on to them too long.
  142. retention-days: 5