Avoid response data being replaced with NoneType (#29) #187
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build pc-ble-driver-py | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - master | |
| tags: | |
| - v* | |
| env: | |
| NRF_BLE_DRIVER_VERSION: 4.1.100 | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ ubuntu-24.04, macos-14, windows-2019 ] | |
| python-version: [ '3.9', '3.10', '3.11', '3.12' ] | |
| include: | |
| - python-version: '3.9' | |
| toxpy: py39 | |
| macos-python-version: '3.9.12' | |
| - python-version: '3.10' | |
| toxpy: py310 | |
| macos-python-version: '3.10.9' | |
| - python-version: '3.11' | |
| toxpy: py311 | |
| macos-python-version: '3.11.9' | |
| - python-version: '3.12' | |
| toxpy: py312 | |
| macos-python-version: '3.12.7' | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| path: pc-ble-driver-py | |
| - name: Checkout pc-ble-driver | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: embedded-community/pc-ble-driver | |
| ref: fdbf92831badbca016d2bf95da6fab056ef2d931 | |
| path: pc-ble-driver | |
| - name: Install linux dependencies | |
| if: runner.os == 'Linux' | |
| run: sudo apt-get update && sudo apt-get install -y build-essential libspdlog-dev libasio-dev libudev-dev | |
| - name: Install macos dependencies | |
| if: runner.os == 'macOS' | |
| run: brew install spdlog | |
| - name: Install windows dependencies | |
| if: runner.os == 'Windows' | |
| env: | |
| VCPKG_ROOT: C:\vcpkg | |
| run: | | |
| echo "VCPKG_ROOT=${{ env.VCPKG_ROOT }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| vcpkg install --triplet x64-windows asio spdlog | |
| - name: Setup python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install Python dependencies | |
| working-directory: pc-ble-driver-py | |
| run: python3 -m pip install -r requirements-dev.txt | |
| - name: Compile pc-ble-driver | |
| if: runner.os == 'Linux' | |
| working-directory: pc-ble-driver | |
| run: | | |
| mkdir build && cd build | |
| cmake_args="-DCMAKE_BUILD_TYPE=Release -DDISABLE_TESTS=1 -DNRF_BLE_DRIVER_VERSION=${{ env.NRF_BLE_DRIVER_VERSION }}" | |
| cmake $cmake_args -G "Unix Makefiles" .. | |
| make nrf_ble_driver_sd_api_v5_static | |
| sudo make install | |
| - name: Compile pc-ble-driver | |
| if: runner.os == 'macOS' | |
| working-directory: pc-ble-driver | |
| run: | | |
| mkdir build && cd build | |
| cmake_args="-DCMAKE_BUILD_TYPE=Release -DDISABLE_TESTS=1 -DNRF_BLE_DRIVER_VERSION=${{ env.NRF_BLE_DRIVER_VERSION }} -DASIO_INCLUDE_DIR=../../pc-ble-driver-py/asio-1-32-0/asio/include/ -DARCH=arm64" | |
| cmake $cmake_args -G "Unix Makefiles" .. | |
| make nrf_ble_driver_sd_api_v5_static | |
| sudo make install | |
| - name: Compile pc-ble-driver windows | |
| if: runner.os == 'Windows' | |
| working-directory: pc-ble-driver | |
| run: | | |
| mkdir build && cd build | |
| cmake -DCMAKE_BUILD_TYPE=Release -DDISABLE_TESTS=1 "-DNRF_BLE_DRIVER_VERSION=${{ env.NRF_BLE_DRIVER_VERSION }}" -G "Visual Studio 16 2019" -A x64 .. | |
| cmake --build . --config Release | |
| cmake --install . --config Release | |
| - name: Build pc-ble-driver-py wheels (macOS) | |
| working-directory: pc-ble-driver-py | |
| if: runner.os == 'macOS' | |
| run: | | |
| python3 setup.py bdist_wheel --build-type Release --py-limited-api= | |
| - name: Build pc-ble-driver-py wheels (Linux) | |
| working-directory: pc-ble-driver-py | |
| if: runner.os == 'Linux' | |
| run: | | |
| python3 setup.py bdist_wheel --build-type Release | |
| - name: Build pc-ble-driver-py wheels (Windows) | |
| if: runner.os == 'Windows' | |
| working-directory: pc-ble-driver-py | |
| run: | | |
| python3 setup.py bdist_wheel --build-type Release -G "Visual Studio 16 2019" --skip-generator-test | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pc_ble_driver_py-${{ matrix.os }}-${{ matrix.toxpy}} | |
| path: "pc-ble-driver-py/dist/*.whl" | |
| if-no-files-found: error | |
| test: | |
| name: Verify wheels | |
| needs: build | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ ubuntu-24.04, macos-14, windows-2019 ] | |
| python-version: [ '3.9', '3.10', '3.11', '3.12' ] | |
| include: | |
| - python-version: '3.9' | |
| toxpy: py39 | |
| macos-python-version: '3.9.12' | |
| - python-version: '3.10' | |
| toxpy: py310 | |
| macos-python-version: '3.10.9' | |
| - python-version: '3.11' | |
| toxpy: py311 | |
| macos-python-version: '3.11.9' | |
| - python-version: '3.12' | |
| toxpy: py312 | |
| macos-python-version: '3.12.7' | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Download artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pc_ble_driver_py-${{ matrix.os }}-${{ runner.os == 'macOS' && matrix.toxpy || 'py39' }} | |
| path: dist | |
| - name: install wheel | |
| shell: bash # this ensure path format works also in windows | |
| run: pip3 install dist/*.whl | |
| # this is sanity check that import works properly. If wheel does not work as expected, this throws | |
| - name: verify | |
| run: | | |
| python3 tests/validate_installation.py | |
| release: | |
| needs: test | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
| name: upload release assets | |
| runs-on: ubuntu-latest | |
| permissions: | |
| # IMPORTANT: this permission is mandatory for trusted publishing | |
| id-token: write | |
| contents: write | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| name: pc_ble_driver_py-*-py39 # these works for win/linux | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| name: pc_ble_driver_py-macos-14-* | |
| - name: flatten folder structure | |
| working-directory: dist | |
| run: | | |
| find . -name '*.whl' -exec mv {} . \; | |
| find . -type d -empty -delete | |
| # list files | |
| ls -R | |
| - name: upload release assets | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: dist/* |