Skip to content

Python: add Utils::transaction_id() (#1407) #4709

Python: add Utils::transaction_id() (#1407)

Python: add Utils::transaction_id() (#1407) #4709

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:
lint:
name: Python PEP8 format
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9"]
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: Run tox format check
working-directory: bindings/python
run: tox -e format
test:
name: Linter & Tests
needs: lint
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.9"]
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 linter for examples
if: ${{ startsWith(matrix.os, 'ubuntu-latest') }}
working-directory: bindings/python
run: tox -e lint-examples
- name: Run linter for tests
if: ${{ startsWith(matrix.os, 'ubuntu-latest') }}
working-directory: bindings/python
run: tox -e lint-tests
- name: Run tests
working-directory: bindings/python
run: tox