diff --git a/.github/workflows/python_bindings.yml b/.github/workflows/python_bindings.yml new file mode 100644 index 000000000..6b2073d48 --- /dev/null +++ b/.github/workflows/python_bindings.yml @@ -0,0 +1,54 @@ +# Build, test, and deploy Python bindings +name: Python bindings + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + container: tfcollins/libiio_ubuntu_22_04-ci:latest + + steps: + - uses: actions/checkout@v2 + + # - name: Set up Python 3.8 + # uses: actions/setup-python@v2 + # with: + # python-version: 3.8 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y python3 python3-pip python3-virtualenv python3-venv + + - name: Install C library + run: | + mkdir build && cd build + cmake .. + make -j + sudo make install + sudo ldconfig + cd .. + + - name: Build and test Python bindings + run: | + python3 -m venv venv + source venv/bin/activate + pip3 install build + cd bindings/python + python3 -m build + pip install dist/*.whl + cd ../.. + shell: bash + + - name: Test Python bindings + run: | + source venv/bin/activate + python3 -c "import iio" + shell: bash + + - name: Archive Python bindings + uses: actions/upload-artifact@v4 + with: + name: python-wheel + path: bindings/python/dist/*.whl