|
| 1 | +name: Run Bluetooth Classic Simulation tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths: |
| 6 | + - '.github/workflows/bluetooth_classic_sim_tests.yml' |
| 7 | + - "west.yml" |
| 8 | + - 'include/zephyr/bluetooth/**' |
| 9 | + - "subsys/bluetooth/**" |
| 10 | + - 'tests/bluetooth/classic/**' |
| 11 | + - "samples/bluetooth/classic/**" |
| 12 | + - "boards/native/**" |
| 13 | + - "soc/native/**" |
| 14 | + - "arch/posix/**" |
| 15 | + - "include/zephyr/arch/posix/**" |
| 16 | + - "scripts/native_simulator/**" |
| 17 | + - "modules/mbedtls/**" |
| 18 | + - '!**.rst' |
| 19 | + |
| 20 | +permissions: |
| 21 | + contents: read |
| 22 | + |
| 23 | +concurrency: |
| 24 | + group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }} |
| 25 | + cancel-in-progress: true |
| 26 | + |
| 27 | +jobs: |
| 28 | + bluetooth_classic_sim_tests: |
| 29 | + if: github.repository_owner == 'zephyrproject-rtos' |
| 30 | + runs-on: |
| 31 | + group: zephyr-runner-v2-linux-x64-4xlarge |
| 32 | + container: |
| 33 | + image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.28.7.20251127 |
| 34 | + options: '--entrypoint /bin/bash' |
| 35 | + env: |
| 36 | + ZEPHYR_TOOLCHAIN_VARIANT: zephyr |
| 37 | + permissions: |
| 38 | + checks: write # to create the check run entry with test results |
| 39 | + |
| 40 | + steps: |
| 41 | + - name: Apply container owner mismatch workaround |
| 42 | + run: | |
| 43 | + # FIXME: The owner UID of the GITHUB_WORKSPACE directory may not |
| 44 | + # match the container user UID because of the way GitHub |
| 45 | + # Actions runner is implemented. Remove this workaround when |
| 46 | + # GitHub comes up with a fundamental fix for this problem. |
| 47 | + git config --global --add safe.directory ${GITHUB_WORKSPACE} |
| 48 | +
|
| 49 | + - name: Print cloud service information |
| 50 | + run: | |
| 51 | + echo "ZEPHYR_RUNNER_CLOUD_PROVIDER = ${ZEPHYR_RUNNER_CLOUD_PROVIDER}" |
| 52 | + echo "ZEPHYR_RUNNER_CLOUD_NODE = ${ZEPHYR_RUNNER_CLOUD_NODE}" |
| 53 | + echo "ZEPHYR_RUNNER_CLOUD_POD = ${ZEPHYR_RUNNER_CLOUD_POD}" |
| 54 | +
|
| 55 | + - name: Clone cached Zephyr repository |
| 56 | + continue-on-error: true |
| 57 | + run: | |
| 58 | + git clone --shared /repo-cache/zephyrproject/zephyr . |
| 59 | + git remote set-url origin ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} |
| 60 | +
|
| 61 | + - name: Checkout |
| 62 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 63 | + with: |
| 64 | + fetch-depth: 0 |
| 65 | + |
| 66 | + - name: Environment Setup |
| 67 | + env: |
| 68 | + BASE_REF: ${{ github.base_ref }} |
| 69 | + run: | |
| 70 | + git config --global user.email "[email protected]" |
| 71 | + git config --global user.name "Zephyr Bot" |
| 72 | + rm -fr ".git/rebase-apply" |
| 73 | + rm -fr ".git/rebase-merge" |
| 74 | + git rebase origin/${BASE_REF} |
| 75 | + git clean -f -d |
| 76 | + git log --pretty=oneline | head -n 10 |
| 77 | + west init -l . || true |
| 78 | + west config manifest.group-filter -- +ci |
| 79 | + west config --global update.narrow true |
| 80 | + west update --path-cache /repo-cache/zephyrproject 2>&1 1> west.update.log || west update --path-cache /repo-cache/zephyrproject 2>&1 1> west.update.log || ( rm -rf ../modules ../bootloader ../tools && west update --path-cache /repo-cache/zephyrproject) |
| 81 | + west forall -c 'git reset --hard HEAD' |
| 82 | +
|
| 83 | + echo "ZEPHYR_SDK_INSTALL_DIR=/opt/toolchains/zephyr-sdk-$( cat SDK_VERSION )" >> $GITHUB_ENV |
| 84 | +
|
| 85 | + - name: Install Python packages |
| 86 | + run: | |
| 87 | + pip install -r scripts/requirements-actions.txt --require-hashes |
| 88 | +
|
| 89 | + - name: Install Bluetooth Classic Simulation dependencies |
| 90 | + run: | |
| 91 | + pip install bumble==0.0.220 |
| 92 | +
|
| 93 | + - name: Make test scripts executable |
| 94 | + run: | |
| 95 | + find tests/bluetooth/classic/sim -name "*.sh" -type f \ |
| 96 | + -exec chmod +x {} \; |
| 97 | +
|
| 98 | + - name: Run Bluetooth Classic Sim tests |
| 99 | + id: run_tests |
| 100 | + run: | |
| 101 | + export ZEPHYR_BASE=${PWD} |
| 102 | + export ZEPHYR_TOOLCHAIN_VARIANT=zephyr |
| 103 | + tests/bluetooth/classic/sim/ci.bt.classic.sh |
| 104 | +
|
| 105 | + - name: Create Test Results |
| 106 | + run: | |
| 107 | + junit2html tests/bluetooth/classic/sim/test_logs/junit.xml tests/bluetooth/classic/sim/test_logs/junit.html |
| 108 | +
|
| 109 | + - name: Upload Unit Test Results in HTML |
| 110 | + if: always() |
| 111 | + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 |
| 112 | + with: |
| 113 | + name: HTML Unit Test Results |
| 114 | + if-no-files-found: ignore |
| 115 | + path: | |
| 116 | + tests/bluetooth/classic/sim/test_logs/junit.html |
| 117 | +
|
| 118 | + - name: Publish Unit Test Results |
| 119 | + uses: EnricoMi/publish-unit-test-result-action@34d7c956a59aed1bfebf31df77b8de55db9bbaaf # v2.21.0 |
| 120 | + with: |
| 121 | + check_name: Bluetooth Classic Simulation Test Results |
| 122 | + files: "tests/bluetooth/classic/sim/test_logs/junit.xml" |
| 123 | + comment_mode: off |
| 124 | + |
| 125 | + - name: Upload test logs |
| 126 | + if: always() |
| 127 | + uses: EnricoMi/publish-unit-test-result-action@34d7c956a59aed1bfebf31df77b8de55db9bbaaf # v2.21.0 |
| 128 | + with: |
| 129 | + name: bluetooth-classic-sim-test-logs |
| 130 | + path: | |
| 131 | + tests/bluetooth/classic/sim/test_logs/ |
| 132 | + bt_classic_sim/ |
| 133 | + comment_mode: off |
| 134 | + |
| 135 | + - name: Check test results |
| 136 | + if: always() |
| 137 | + run: | |
| 138 | + if [[ -f tests/bluetooth/classic/sim/test_logs/junit.xml ]]; then |
| 139 | + failures=$(grep -o 'failures="[0-9]*"' \ |
| 140 | + tests/bluetooth/classic/sim/test_logs/junit.xml | \ |
| 141 | + grep -o '[0-9]*') |
| 142 | + if [[ "$failures" -gt 0 ]]; then |
| 143 | + echo "::error::$failures test(s) failed" |
| 144 | + exit 1 |
| 145 | + fi |
| 146 | + fi |
| 147 | +
|
| 148 | + - name: Cleanup |
| 149 | + if: always() |
| 150 | + run: | |
| 151 | + sudo pkill -9 zephyr.exe || true |
0 commit comments