Skip to content

Python support

Python support #21

Workflow file for this run

name: Tests
on:
push:
branches: [ stable ]
pull_request:
jobs:
rust-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --all-targets --all-features --locked -- -D warnings
- name: Install dnsmasq
run: sudo apt-get update && sudo apt-get install -y dnsmasq
- name: Start dnsmasq
run: dnsmasq --no-daemon --no-hosts --no-resolv --port=5353 --server=1.1.1.1 &
- name: Run tests
run: cargo test --all --locked --verbose -- --include-ignored
python-tests:
needs: rust-tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dnsmasq
run: sudo apt-get update && sudo apt-get install -y dnsmasq
- name: Start dnsmasq
run: dnsmasq --no-daemon --no-hosts --no-resolv --port=5353 --server=1.1.1.1 &
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install Python dependencies
run: uv sync
- name: Build Python extension
run: maturin develop --release
- name: Run Python tests
run: pytest blastdns/tests -vv
rust-publish:
needs: rust-tests
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
steps:
- uses: actions/checkout@v5
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
- name: Publish to crates.io
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}