|
| 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: Cirque |
| 16 | + |
| 17 | +on: |
| 18 | + push: |
| 19 | + pull_request: |
| 20 | + merge_group: |
| 21 | + workflow_dispatch: |
| 22 | + |
| 23 | +concurrency: |
| 24 | + group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }} |
| 25 | + cancel-in-progress: true |
| 26 | + |
| 27 | +env: |
| 28 | + CHIP_NO_LOG_TIMESTAMPS: true |
| 29 | + |
| 30 | +jobs: |
| 31 | + cirque: |
| 32 | + name: Cirque |
| 33 | + |
| 34 | + env: |
| 35 | + DOCKER_RUN_VERSION: 0.7.3 |
| 36 | + GITHUB_CACHE_PATH: /tmp/cirque-cache |
| 37 | + |
| 38 | + runs-on: ubuntu-latest |
| 39 | + if: github.actor != 'restyled-io[bot]' |
| 40 | + |
| 41 | + # need to run with privilege, which isn't supported by job.XXX.contaner |
| 42 | + # https://github.com/actions/container-action/issues/2 |
| 43 | + # container: |
| 44 | + # image: connectedhomeip/chip-build-cirque:0.7.3 |
| 45 | + # volumes: |
| 46 | + # - "/tmp:/tmp" |
| 47 | + # - "/dev/pts:/dev/pts" |
| 48 | + # env: |
| 49 | + # LOG_DIR: /tmp/cirque_test_output/ |
| 50 | + # CLEANUP_DOCKER_FOR_CI: 1 |
| 51 | + # options: "--privileged" |
| 52 | + |
| 53 | + steps: |
| 54 | + - name: Checkout |
| 55 | + uses: actions/checkout@v3 |
| 56 | + - name: Checkout submodules |
| 57 | + uses: ./.github/actions/checkout-submodules |
| 58 | + with: |
| 59 | + platform: linux |
| 60 | + |
| 61 | + - name: Bootstrap Cache |
| 62 | + uses: ./.github/actions/bootstrap-cache |
| 63 | + - name: Bootstrap |
| 64 | + run: | |
| 65 | + integrations/docker/images/chip-build-cirque/run.sh \ |
| 66 | + -- sh -c " \ |
| 67 | + git config --global --add safe.directory '*' \ |
| 68 | + && bash scripts/bootstrap.sh \ |
| 69 | + && chown -R $(id -u):$(id -g) .environment \ |
| 70 | + " |
| 71 | +
|
| 72 | + - name: Get Cirque Bootstrap cache key |
| 73 | + id: cirque-bootstrap-cache-key |
| 74 | + run: echo "val=$(scripts/tests/cirque_tests.sh cachekeyhash)" >> $GITHUB_OUTPUT |
| 75 | + - uses: Wandalen/wretry.action@v1.3.0 |
| 76 | + name: Cirque Bootstrap cache |
| 77 | + if: ${{ !env.ACT }} |
| 78 | + continue-on-error: true |
| 79 | + timeout-minutes: 10 |
| 80 | + with: |
| 81 | + action: buildjet/cache@v3 |
| 82 | + attempt_limit: 3 |
| 83 | + attempt_delay: 2000 |
| 84 | + with: | |
| 85 | + key: ${{ runner.os }}-cirque-${{ steps.cirque-bootstrap-cache-key.outputs.val }} |
| 86 | + restore-keys: ${{ runner.os }}-cirque- |
| 87 | + path: ${{ env.GITHUB_CACHE_PATH }} |
| 88 | + - name: Cirque Bootstrap |
| 89 | + run: | |
| 90 | + integrations/docker/images/chip-build-cirque/run.sh \ |
| 91 | + --env GITHUB_ACTION_RUN=1 \ |
| 92 | + --env GITHUB_CACHE_PATH=${{ env.GITHUB_CACHE_PATH }} \ |
| 93 | + --volume /tmp:/tmp \ |
| 94 | + -- scripts/tests/cirque_tests.sh bootstrap |
| 95 | +
|
| 96 | + - name: Artifact suffix |
| 97 | + id: outsuffix |
| 98 | + uses: haya14busa/action-cond@v1 |
| 99 | + if: ${{ !env.ACT }} |
| 100 | + with: |
| 101 | + cond: ${{ github.event.pull_request.number == '' }} |
| 102 | + if_true: "${{ github.sha }}" |
| 103 | + if_false: "pull-${{ github.event.pull_request.number }}" |
| 104 | + - name: Build Binaries |
| 105 | + run: | |
| 106 | + integrations/docker/images/chip-build-cirque/run.sh \ |
| 107 | + -- sh -c " \ |
| 108 | + git config --global --add safe.directory '*' \ |
| 109 | + && scripts/build/gn_gen_cirque.sh \ |
| 110 | + " |
| 111 | + - name: Run Tests |
| 112 | + run: | |
| 113 | + integrations/docker/images/chip-build-cirque/run.sh \ |
| 114 | + --env LOG_DIR=/tmp/cirque_test_output \ |
| 115 | + --env CLEANUP_DOCKER_FOR_CI=1 \ |
| 116 | + --env GITHUB_ACTION_RUN=1 \ |
| 117 | + --privileged \ |
| 118 | + --volume /tmp:/tmp \ |
| 119 | + --volume /dev/pts:/dev/pts \ |
| 120 | + -- scripts/tests/cirque_tests.sh run_all_tests |
| 121 | +
|
| 122 | + - name: Uploading Binaries |
| 123 | + uses: actions/upload-artifact@v3 |
| 124 | + if: ${{ always() && !env.ACT }} |
| 125 | + with: |
| 126 | + name: cirque_log-${{steps.outsuffix.outputs.value}}-logs |
| 127 | + path: /tmp/cirque_test_output/ |
0 commit comments