Skip to content

Python bindings checks #9392

Python bindings checks

Python bindings checks #9392

name: Python bindings checks
on:
push:
branches: [develop, staging]
paths:
- ".github/actions/**"
- "**.rs" # Include all rust files
- "**Cargo.toml" # Include all Cargo.toml files
- "**Cargo.lock" # Include all Cargo.lock files
- "!**/examples/**" # Exclude all examples
- "!**/tests/**" # Exclude all tests
- "!cli/**" # Exclude CLI
- "!**/bindings/**" # Exclude all bindings
- "bindings/python/**"
- ".github/workflows/bindings-python.yml"
pull_request:
branches: [develop, staging]
paths:
- ".github/actions/**"
- "**.rs" # Include all rust files
- "**Cargo.toml" # Include all Cargo.toml files
- "**Cargo.lock" # Include all Cargo.lock files
- "!**/examples/**" # Exclude all examples
- "!**/tests/**" # Exclude all tests
- "!cli/**" # Exclude CLI
- "!**/bindings/**" # Exclude all bindings
- "bindings/python/**"
- ".github/workflows/bindings-python.yml"
schedule:
- cron: "0 1 * * *"
workflow_dispatch:
env:
CARGO_INCREMENTAL: 0
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
format:
name: Python PEP8 format
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
steps:
- name: Checkout the Source Code
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }} and Pip Cache
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: bindings/python/requirements-dev.txt
- name: Install Dependencies for Python Binding Format
run: |
python3 -m pip install --upgrade setuptools pip wheel
python3 -m pip install tox-gh-actions
- name: Run tox format check
working-directory: bindings/python
run: tox -e format
lint:
name: Python lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
steps:
- name: Checkout the Source Code
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }} and Pip Cache
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: bindings/python/requirements-dev.txt
- name: Install Dependencies for Python Binding Lint
run: |
python3 -m pip install --upgrade setuptools pip wheel
python3 -m pip install tox-gh-actions
- name: Install required packages (Ubuntu)
run: |
sudo apt-get install libudev-dev libusb-1.0-0-dev
- name: Run linter for iota_sdk
working-directory: bindings/python
run: tox -e lint-sdk
- name: Run linter for examples
working-directory: bindings/python
run: tox -e lint-examples
- name: Run linter for tests
working-directory: bindings/python
run: tox -e lint-tests
test:
name: Tests
needs: format
if: ${{ ! github.event.schedule }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# os: [windows-latest, macos-latest, ubuntu-latest]
os: [windows-latest, ubuntu-latest]
python-version: ["3.10", "3.11", "3.12"]
steps:
- name: Checkout the Source Code
uses: actions/checkout@v3
- name: Set up Rust
uses: ./.github/actions/setup-rust
with:
cache-root: bindings/python
- name: Set Up Python ${{ matrix.python-version }} and Pip Cache
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: bindings/python/requirements-dev.txt
# This step is required for bindgen to work on Windows.
- name: Set Up Clang/LLVM (Windows)
if: ${{ startsWith(matrix.os, 'windows') }}
uses: ./.github/actions/setup-clang
- name: Install Dependencies for Python Binding Tests
run: |
python3 -m pip install --upgrade setuptools pip wheel
python3 -m pip install tox-gh-actions
- name: Install required packages (Ubuntu)
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
sudo apt-get update
sudo apt-get install libudev-dev libusb-1.0-0-dev
- name: Run tests
working-directory: bindings/python
run: tox