UNPKG

webbluetooth

Version:

Node.js implementation of the Web Bluetooth Specification

155 lines (135 loc) 7.31 kB
name: CI Test on: [push, pull_request] jobs: # ------------------------------------------------------------ test-windows: runs-on: windows-2022 steps: - name: Clone Repository uses: actions/checkout@v3 - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v1.1 - name: Clone and build GTest run: | git clone https://github.com/google/googletest cd %GITHUB_WORKSPACE%\googletest cmake . -B build -Dgtest_force_shared_crt=ON cmake --build .\build --config Release --parallel 4 cmake --install .\build --prefix .\install shell: cmd - name: Compile Tests for Windows x86 run: | cmake -B %GITHUB_WORKSPACE%\build_test -G "Visual Studio 17 2022" -DCMAKE_SYSTEM_VERSION=10.0.22000.0 -DGTEST_ROOT=%GITHUB_WORKSPACE%\googletest\install -S %GITHUB_WORKSPACE%/simpleble -DSIMPLEBLE_TEST=ON cmake --build %GITHUB_WORKSPACE%\build_test --config Release --parallel 4 %GITHUB_WORKSPACE%\build_test\bin\Release\simpleble_test.exe shell: cmd # ------------------------------------------------------------ test-macos: runs-on: macos-12 steps: - name: Clone Repository uses: actions/checkout@v3 - name: Setup Cmake uses: jwlawson/actions-setup-cmake@v1.13 with: cmake-version: '3.21' - name: Clone and build GTest run: | git clone https://github.com/google/googletest cd $GITHUB_WORKSPACE/googletest cmake . -B build cmake --build ./build --config Release --parallel 4 cmake --install ./build --prefix ./install - name: Compile Tests for MacOS arm64 run: | cmake -B $GITHUB_WORKSPACE/build_test -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_BUILD_TYPE=Release -DGTEST_ROOT=$GITHUB_WORKSPACE/googletest/install -S $GITHUB_WORKSPACE/simpleble -DSIMPLEBLE_TEST=ON cmake --build $GITHUB_WORKSPACE/build_test --config Release --parallel 4 $GITHUB_WORKSPACE/build_test/bin/simpleble_test # ------------------------------------------------------------ test-linux: runs-on: ubuntu-22.04 steps: - name: Clone Repository uses: actions/checkout@v3 - name: Install Dependencies env: DEBIAN_FRONTEND: noninteractive run: | sudo -H apt-get update -y sudo -H apt-get install -y dbus libdbus-1-dev python3-dev sudo -H pip3 install -r $GITHUB_WORKSPACE/simpledbus/test/requirements.txt - name: Start DBus run: | echo "DBUS_SESSION_BUS_ADDRESS=$(dbus-daemon --config-file=/usr/share/dbus-1/session.conf --print-address --fork | cut -d, -f1)" >> $GITHUB_ENV - name: Setup Cmake uses: jwlawson/actions-setup-cmake@v1.13 with: cmake-version: '3.21' - name: Clone and build GTest run: | git clone https://github.com/google/googletest cd $GITHUB_WORKSPACE/googletest cmake . -B build cmake --build ./build --config Release --parallel 4 cmake --install ./build --prefix ./install - name: SimpleBLE Unit Tests run: | cmake -B $GITHUB_WORKSPACE/build_unit_simpleble -DCMAKE_BUILD_TYPE=Release -DGTEST_ROOT=$GITHUB_WORKSPACE/googletest/install -S $GITHUB_WORKSPACE/simpleble -DSIMPLEBLE_TEST=ON cmake --build $GITHUB_WORKSPACE/build_unit_simpleble --config Release --parallel 4 $GITHUB_WORKSPACE/build_unit_simpleble/bin/simpleble_test - name: SimpleBluez Unit Tests run: | cmake -B $GITHUB_WORKSPACE/build_unit_simplebluez -DCMAKE_BUILD_TYPE=Release -DGTEST_ROOT=$GITHUB_WORKSPACE/googletest/install -S $GITHUB_WORKSPACE/simplebluez -DSIMPLEBLUEZ_TEST=ON cmake --build $GITHUB_WORKSPACE/build_unit_simplebluez --config Release --parallel 4 $GITHUB_WORKSPACE/build_unit_simplebluez/bin/simplebluez_test - name: SimpleBluez Unit Tests with Address Sanitizer run: | cmake -B $GITHUB_WORKSPACE/build_asan_simplebluez -DCMAKE_BUILD_TYPE=Debug -DSIMPLEBLUEZ_SANITIZE=Address -DGTEST_ROOT=$GITHUB_WORKSPACE/googletest/install -S $GITHUB_WORKSPACE/simplebluez -DSIMPLEBLUEZ_TEST=ON cmake --build $GITHUB_WORKSPACE/build_asan_simplebluez --config Release --parallel 4 PYTHONMALLOC=malloc $GITHUB_WORKSPACE/build_asan_simplebluez/bin/simplebluez_test cp "$(ls asan_log.txt.* | head -1)" asan_log.txt || true (test ! -f asan_log.txt && echo "No ASAN log found") || (cat asan_log.txt && exit 1) - name: SimpleBluez Unit Tests with Thread Sanitizer run: | cmake -B $GITHUB_WORKSPACE/build_tsan_simplebluez -DCMAKE_BUILD_TYPE=Debug -DSIMPLEBLUEZ_SANITIZE=Thread -DGTEST_ROOT=$GITHUB_WORKSPACE/googletest/install -S $GITHUB_WORKSPACE/simplebluez -DSIMPLEBLUEZ_TEST=ON cmake --build $GITHUB_WORKSPACE/build_tsan_simplebluez --config Release --parallel 4 $GITHUB_WORKSPACE/build_tsan_simplebluez/bin/simplebluez_test cp "$(ls tsan_log.txt.* | head -1)" tsan_log.txt || true (test ! -f tsan_log.txt && echo "No TSAN log found") || (cat tsan_log.txt && exit 1) - name: SimpleDBus Unit Tests run: | cmake -B $GITHUB_WORKSPACE/build_unit_simpledbus -DCMAKE_BUILD_TYPE=Release -DGTEST_ROOT=$GITHUB_WORKSPACE/googletest/install -S $GITHUB_WORKSPACE/simpledbus -DSIMPLEDBUS_TEST=ON cmake --build $GITHUB_WORKSPACE/build_unit_simpledbus --config Release --parallel 4 $GITHUB_WORKSPACE/build_unit_simpledbus/bin/simpledbus_test - name: SimpleDBus Unit Tests with Address Sanitizer run: | cmake -B $GITHUB_WORKSPACE/build_asan_simpledbus -DCMAKE_BUILD_TYPE=Debug -DSIMPLEDBUS_SANITIZE=Address -DGTEST_ROOT=$GITHUB_WORKSPACE/googletest/install -S $GITHUB_WORKSPACE/simpledbus -DSIMPLEDBUS_TEST=ON cmake --build $GITHUB_WORKSPACE/build_asan_simpledbus --config Release --parallel 4 PYTHONMALLOC=malloc $GITHUB_WORKSPACE/build_asan_simpledbus/bin/simpledbus_test cp "$(ls asan_log.txt.* | head -1)" asan_log.txt || true (test ! -f asan_log.txt && echo "No ASAN log found") || (cat asan_log.txt && exit 1) - name: SimpleDBus Unit Tests with Thread Sanitizer run: | cmake -B $GITHUB_WORKSPACE/build_tsan_simpledbus -DCMAKE_BUILD_TYPE=Debug -DSIMPLEDBUS_SANITIZE=Thread -DGTEST_ROOT=$GITHUB_WORKSPACE/googletest/install -S $GITHUB_WORKSPACE/simpledbus -DSIMPLEDBUS_TEST=ON cmake --build $GITHUB_WORKSPACE/build_tsan_simpledbus --config Release --parallel 4 $GITHUB_WORKSPACE/build_tsan_simpledbus/bin/simpledbus_test cp "$(ls tsan_log.txt.* | head -1)" tsan_log.txt || true (test ! -f tsan_log.txt && echo "No TSAN log found") || (cat tsan_log.txt && exit 1) # ------------------------------------------------------------ test-python: runs-on: ubuntu-22.04 steps: - name: Checkout uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v4 with: python-version: 3.11 cache: "pip" - name: Install dependencies run: pip install -r simplepyble/requirements.txt - name: Install SimplePyBLE with Plain flavor run: python setup.py install --plain - name: Run PyTest run: pytest working-directory: ./simplepyble/test