rblhost 0.2.0

The rblhost application is a fast command-line utility providing McuBoot library used on the host computer to initiate communication and issue commands to the MCU bootloader.
Documentation
name: Deployment

on:
  push:
    tags:
      - "v*"

jobs:
  test:
    name: Run tests
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Install system dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y libudev-dev

      - name: Run cargo test
        run: cargo test --all-features

  # Publish to crates.io
  publish-crate:
    name: Publish to crates.io
    needs: test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Install system dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y libudev-dev

      - name: Login to crates.io
        run: cargo login ${{ secrets.CRATES_IO_TOKEN }}

      - name: Publish to crates.io
        run: cargo publish

  build-wheels:
    name: Build wheels on ${{ matrix.os }}
    needs: test
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]

    steps:
      - uses: actions/checkout@v3

      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: "3.11"

      - name: Make scripts executable
        if: runner.os != 'Windows'
        run: |
          chmod +x .github/scripts/install_rust_unix.sh

      - name: Install cibuildwheel
        run: python -m pip install cibuildwheel

      - name: Build wheels
        run: python -m cibuildwheel --output-dir wheelhouse
        env:
          CIBW_BUILD: cp39-* cp310-* cp311-* cp312-* cp313-*
          CIBW_SKIP: "*-musllinux* *-win32" # Skip all musllinux builds and 32-bit Windows
          CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux2014_x86_64
          CIBW_MANYLINUX_I686_IMAGE: quay.io/pypa/manylinux2014_i686
          CIBW_BEFORE_BUILD_LINUX: |
            yum install -y systemd-devel pkgconfig libudev-devel
            bash .github/scripts/install_rust_unix.sh
          CIBW_BEFORE_BUILD_MACOS: |
            rustup target add x86_64-apple-darwin
            rustup target add aarch64-apple-darwin
            rustup update stable
            bash .github/scripts/install_rust_unix.sh
          CIBW_BEFORE_BUILD_WINDOWS: powershell -ExecutionPolicy Bypass -File .github/scripts/install_rust_windows.ps1
          CIBW_ENVIRONMENT_LINUX: 'PATH="$HOME/.cargo/bin:$PATH"'
          CIBW_ENVIRONMENT_MACOS: 'PATH="$HOME/.cargo/bin:$PATH"'
          CIBW_ENVIRONMENT_WINDOWS: 'PATH="$UserProfile\\.cargo\\bin;$PATH"'
          CIBW_ARCHS_LINUX: "x86_64" # Explicitly specify 64-bit only
          CIBW_ARCHS_WINDOWS: "AMD64" # Explicitly specify 64-bit only
          CIBW_ARCHS_MACOS: "x86_64 arm64 universal2"
          MACOSX_DEPLOYMENT_TARGET: "10.12" # the minimum version of macOS on which the target binaries are to be deployed

      - name: Upload wheels
        uses: actions/upload-artifact@v4.6.2
        with:
          name: wheels-${{ matrix.os }}
          path: wheelhouse/*.whl

  # Publish to PyPI
  publish-pypi:
    name: Publish to PyPI
    needs: build-wheels
    runs-on: ubuntu-latest
    steps:
      - name: Download all wheels
        uses: actions/download-artifact@v4
        with:
          pattern: wheels-*
          path: dist
          merge-multiple: true

      - name: Publish to PyPI
        uses: pypa/gh-action-pypi-publish@v1.12.4
        with:
          packages-dir: dist
          skip-existing: true
          password: ${{ secrets.PYPI_API_TOKEN }}