|
| 1 | +name: Bluetooth Classic Simulation Tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths: |
| 6 | + - 'tests/bluetooth/classic/**' |
| 7 | + - 'subsys/bluetooth/host/**' |
| 8 | + - 'include/zephyr/bluetooth/**' |
| 9 | + - '.github/workflows/bluetooth_classic_sim_tests.yml' |
| 10 | + push: |
| 11 | + branches: |
| 12 | + - main |
| 13 | + - 'v*-branch' |
| 14 | + |
| 15 | +jobs: |
| 16 | + bluetooth_classic_sim_tests: |
| 17 | + name: Run All Bluetooth Classic Sim Tests |
| 18 | + runs-on: ubuntu-22.04 |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Checkout code |
| 22 | + uses: actions/checkout@v4 |
| 23 | + with: |
| 24 | + fetch-depth: 0 |
| 25 | + |
| 26 | + - name: Set up Python |
| 27 | + uses: actions/setup-python@v5 |
| 28 | + with: |
| 29 | + python-version: '3.11' |
| 30 | + |
| 31 | + - name: Install system dependencies |
| 32 | + run: | |
| 33 | + sudo apt-get update |
| 34 | + sudo apt-get install -y \ |
| 35 | + bluez \ |
| 36 | + bluez-tools \ |
| 37 | + git \ |
| 38 | + cmake \ |
| 39 | + ninja-build \ |
| 40 | + gperf \ |
| 41 | + ccache \ |
| 42 | + dfu-util \ |
| 43 | + device-tree-compiler \ |
| 44 | + wget \ |
| 45 | + python3-dev \ |
| 46 | + python3-pip \ |
| 47 | + python3-setuptools \ |
| 48 | + python3-tk \ |
| 49 | + python3-wheel \ |
| 50 | + xz-utils \ |
| 51 | + file \ |
| 52 | + make \ |
| 53 | + gcc \ |
| 54 | + gcc-multilib \ |
| 55 | + g++-multilib \ |
| 56 | + libsdl2-dev \ |
| 57 | + libmagic1 |
| 58 | +
|
| 59 | + - name: Install West and dependencies |
| 60 | + run: | |
| 61 | + pip3 install --user -U west |
| 62 | + echo "$HOME/.local/bin" >> $GITHUB_PATH |
| 63 | +
|
| 64 | + - name: West init and update |
| 65 | + run: | |
| 66 | + west init -l . |
| 67 | + west update --narrow -o=--depth=1 |
| 68 | +
|
| 69 | + - name: Install Zephyr SDK |
| 70 | + run: | |
| 71 | + cd ~ |
| 72 | + wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.5/zephyr-sdk-0.16.5_linux-x86_64.tar.xz |
| 73 | + wget -O - https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.5/sha256.sum | shasum --check --ignore-missing |
| 74 | + tar xvf zephyr-sdk-0.16.5_linux-x86_64.tar.xz |
| 75 | + cd zephyr-sdk-0.16.5 |
| 76 | + ./setup.sh -t all -h -c |
| 77 | +
|
| 78 | + - name: Install Python dependencies |
| 79 | + run: | |
| 80 | + pip3 install --user -r scripts/requirements.txt |
| 81 | +
|
| 82 | + - name: Stop Bluetooth service |
| 83 | + run: | |
| 84 | + sudo systemctl stop bluetooth || true |
| 85 | + sudo systemctl disable bluetooth || true |
| 86 | +
|
| 87 | + - name: Make test scripts executable |
| 88 | + run: | |
| 89 | + find tests/bluetooth/classic/sim -name "*.sh" -type f \ |
| 90 | + -exec chmod +x {} \; |
| 91 | +
|
| 92 | + - name: Run all Bluetooth Classic Sim tests |
| 93 | + id: run_tests |
| 94 | + timeout-minutes: 30 |
| 95 | + continue-on-error: true |
| 96 | + run: | |
| 97 | + cd tests/bluetooth/classic/sim |
| 98 | + ./run_all_tests.sh |
| 99 | +
|
| 100 | + - name: Publish Test Results |
| 101 | + uses: EnricoMi/publish-unit-test-result-action@v2 |
| 102 | + if: always() |
| 103 | + with: |
| 104 | + files: | |
| 105 | + tests/bluetooth/classic/sim/test_logs/junit.xml |
| 106 | + check_name: Bluetooth Classic Test Results |
| 107 | + comment_title: 🧪 Bluetooth Classic Simulation Test Results |
| 108 | + comment_mode: always |
| 109 | + compare_to_earlier_commit: false |
| 110 | + report_individual_runs: true |
| 111 | + deduplicate_classes_by_file_name: false |
| 112 | + |
| 113 | + - name: Upload test logs |
| 114 | + if: always() |
| 115 | + uses: actions/upload-artifact@v4 |
| 116 | + with: |
| 117 | + name: bluetooth-classic-sim-test-logs |
| 118 | + path: | |
| 119 | + tests/bluetooth/classic/sim/test_logs/ |
| 120 | + retention-days: 7 |
| 121 | + |
| 122 | + - name: Check test results |
| 123 | + if: always() |
| 124 | + run: | |
| 125 | + if [[ -f tests/bluetooth/classic/sim/test_logs/junit.xml ]]; then |
| 126 | + failures=$(grep -o 'failures="[0-9]*"' \ |
| 127 | + tests/bluetooth/classic/sim/test_logs/junit.xml | \ |
| 128 | + grep -o '[0-9]*') |
| 129 | + if [[ "$failures" -gt 0 ]]; then |
| 130 | + echo "::error::$failures test(s) failed" |
| 131 | + exit 1 |
| 132 | + fi |
| 133 | + fi |
| 134 | +
|
| 135 | + - name: Cleanup |
| 136 | + if: always() |
| 137 | + run: | |
| 138 | + sudo pkill -9 btvirt || true |
| 139 | + sudo pkill -9 btmon || true |
| 140 | + sudo pkill -9 zephyr.exe || true |
| 141 | + sudo systemctl start bluetooth || true |
0 commit comments