|
| 1 | +# Copyright (c) 2020 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 | + |
| 15 | +name: Unit / Integration Tests |
| 16 | + |
| 17 | +on: |
| 18 | + push: |
| 19 | + branches: |
| 20 | + - master |
| 21 | + - 'v*-branch' |
| 22 | + pull_request: |
| 23 | + merge_group: |
| 24 | + |
| 25 | +concurrency: |
| 26 | + group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }} |
| 27 | + cancel-in-progress: true |
| 28 | + |
| 29 | +jobs: |
| 30 | + unit_tests: |
| 31 | + name: Unit / Integration Tests |
| 32 | + if: github.actor != 'restyled-io[bot]' |
| 33 | + |
| 34 | + strategy: |
| 35 | + matrix: |
| 36 | + type: [main, clang, mbedtls, rotating_device_id, icd] |
| 37 | + env: |
| 38 | + BUILD_TYPE: ${{ matrix.type }} |
| 39 | + |
| 40 | + runs-on: ubuntu-latest |
| 41 | + |
| 42 | + container: |
| 43 | + image: ghcr.io/project-chip/chip-build:167 |
| 44 | + volumes: |
| 45 | + - "/:/runner-root-volume" |
| 46 | + - "/tmp/log_output:/tmp/test_logs" |
| 47 | + options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" |
| 48 | + |
| 49 | + steps: |
| 50 | + - name: Checkout |
| 51 | + uses: actions/checkout@v5 |
| 52 | + - name: Checkout submodules & Bootstrap |
| 53 | + uses: ./.github/actions/checkout-submodules-and-bootstrap |
| 54 | + with: |
| 55 | + platform: linux unit_tests |
| 56 | + bootstrap-log-name: bootstrap-logs-unittest-${{ matrix.type }} |
| 57 | + - name: Artifact suffix |
| 58 | + id: outsuffix |
| 59 | + uses: haya14busa/action-cond@v1 |
| 60 | + if: ${{ !env.ACT }} |
| 61 | + with: |
| 62 | + cond: ${{ github.event.pull_request.number == '' }} |
| 63 | + if_true: "${{ github.sha }}" |
| 64 | + if_false: "pull-${{ github.event.pull_request.number }}" |
| 65 | + - name: Setup Build |
| 66 | + # TODO: If rotating_device_id is ever removed/combined, we have to cover boringssl otherwise |
| 67 | + run: | |
| 68 | + case $BUILD_TYPE in |
| 69 | + "main") GN_ARGS='chip_build_all_platform_tests=true';; |
| 70 | + "clang") GN_ARGS='is_clang=true chip_build_all_platform_tests=true';; |
| 71 | + "mbedtls") GN_ARGS='chip_crypto="mbedtls" chip_build_all_platform_tests=true';; |
| 72 | + "rotating_device_id") GN_ARGS='chip_crypto="boringssl" chip_enable_rotating_device_id=true chip_build_all_platform_tests=true';; |
| 73 | + "icd") GN_ARGS='chip_enable_icd_server=true chip_enable_icd_lit=true chip_build_all_platform_tests=true';; |
| 74 | + *) ;; |
| 75 | + esac |
| 76 | +
|
| 77 | + scripts/build/gn_gen.sh --args="$GN_ARGS" |
| 78 | + - name: Run Build |
| 79 | + run: scripts/run_in_build_env.sh "ninja -C out/$BUILD_TYPE" |
| 80 | + - name: Run Tests |
| 81 | + run: scripts/tests/gn_tests.sh |
| 82 | + # TODO Log Upload https://github.com/project-chip/connectedhomeip/issues/2227 |
| 83 | + # TODO https://github.com/project-chip/connectedhomeip/issues/1512 |
| 84 | + # - name: Run Code Coverage |
| 85 | + # if: ${{ contains('main', env.BUILD_TYPE) }} |
| 86 | + # run: scripts/tools/codecoverage.sh |
| 87 | + # - name: Upload Code Coverage |
| 88 | + # if: ${{ contains('main', env.BUILD_TYPE) }} |
| 89 | + # run: bash <(curl -s https://codecov.io/bash) |
0 commit comments