blastdns 1.9.1

Async DNS lookup library for bulk/parallel DNS resolution
Documentation
# This file is autogenerated by maturin v1.9.4
# To update, run

#    maturin generate-ci github

name: Python Tests

on:
  pull_request:
  push:
    branches:
      - stable
  workflow_dispatch:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

permissions:
  contents: read

jobs:
  python-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@v6
        with:
          python-version: ${{ matrix.python-version }}

      - name: Install dnsmasq
        run: sudo apt-get update && sudo apt-get install -y dnsmasq

      - name: Start test DNS server
        run: sudo ./scripts/start-test-dns.sh

      - name: Start AXFR test server
        run: ./scripts/start-test-axfr.sh

      - name: Install uv
        uses: astral-sh/setup-uv@v7

      - name: Install Python dependencies
        run: uv sync

      - name: Lint
        run: |
          uv run ruff check
          uv run ruff format --check

      - name: Build Python extension
        run: uv run maturin develop --release

      - name: Run Python tests
        run: uv run pytest blastdns/tests -vv
      
      - name: Stop AXFR test server
        if: always()
        run: ./scripts/stop-test-axfr.sh || true

      - name: Stop test DNS server
        if: always()
        run: sudo ./scripts/stop-test-dns.sh || true

  linux-build:
    needs: python-tests
    if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
    runs-on: ${{ matrix.platform.runner }}
    strategy:
      matrix:
        platform:
          - runner: ubuntu-22.04
            target: x86_64
          - runner: ubuntu-22.04
            target: x86
          - runner: ubuntu-22.04
            target: aarch64
          - runner: ubuntu-22.04
            target: armv7
          - runner: ubuntu-22.04
            target: s390x
          - runner: ubuntu-22.04
            target: ppc64le
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-python@v6
        with:
          python-version: 3.x
      - name: Build wheels
        uses: PyO3/maturin-action@v1
        with:
          target: ${{ matrix.platform.target }}
          args: --release --out dist --find-interpreter
          sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
          # manylinux2014's rust-cross image ships GCC 4.8.5 (predates C11
          # atomics by ~6 months), which breaks aws-lc-sys' aarch64 build.
          # 2_28 ships GCC 7.5.0 with full C11 support.
          manylinux: "2_28"
      - name: Upload wheels
        uses: actions/upload-artifact@v7
        with:
          name: wheels-linux-${{ matrix.platform.target }}
          path: dist

  musllinux-build:
    needs: python-tests
    if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
    runs-on: ${{ matrix.platform.runner }}
    strategy:
      matrix:
        platform:
          - runner: ubuntu-22.04
            target: x86_64
          - runner: ubuntu-22.04
            target: x86
          - runner: ubuntu-22.04
            target: aarch64
          - runner: ubuntu-22.04
            target: armv7
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-python@v6
        with:
          python-version: 3.x
      - name: Build wheels
        uses: PyO3/maturin-action@v1
        with:
          target: ${{ matrix.platform.target }}
          args: --release --out dist --find-interpreter
          sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
          manylinux: musllinux_1_2
      - name: Upload wheels
        uses: actions/upload-artifact@v7
        with:
          name: wheels-musllinux-${{ matrix.platform.target }}
          path: dist

  windows-build:
    needs: python-tests
    if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
    runs-on: ${{ matrix.platform.runner }}
    strategy:
      matrix:
        platform:
          - runner: windows-latest
            target: x64
          - runner: windows-latest
            target: x86
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-python@v6
        with:
          python-version: 3.x
          architecture: ${{ matrix.platform.target }}
      - name: Build wheels
        uses: PyO3/maturin-action@v1
        with:
          target: ${{ matrix.platform.target }}
          args: --release --out dist --find-interpreter
          sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
      - name: Upload wheels
        uses: actions/upload-artifact@v7
        with:
          name: wheels-windows-${{ matrix.platform.target }}
          path: dist

  macos-build:
    needs: python-tests
    if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
    runs-on: ${{ matrix.platform.runner }}
    strategy:
      matrix:
        platform:
          - runner: macos-15-intel
            target: x86_64
          - runner: macos-latest
            target: aarch64
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-python@v6
        with:
          python-version: 3.x
      - name: Build wheels
        uses: PyO3/maturin-action@v1
        with:
          target: ${{ matrix.platform.target }}
          args: --release --out dist --find-interpreter
          sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
      - name: Upload wheels
        uses: actions/upload-artifact@v7
        with:
          name: wheels-macos-${{ matrix.platform.target }}
          path: dist

  sdist-build:
    needs: python-tests
    runs-on: ubuntu-latest
    if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
    steps:
      - uses: actions/checkout@v6
      - name: Build sdist
        uses: PyO3/maturin-action@v1
        with:
          command: sdist
          args: --out dist
      - name: Upload sdist
        uses: actions/upload-artifact@v7
        with:
          name: wheels-sdist
          path: dist

  release:
    name: Release
    needs:
      - linux-build
      - musllinux-build
      - windows-build
      - macos-build
      - sdist-build
    runs-on: ubuntu-latest
    permissions:
      # Use to sign the release artifacts
      id-token: write
      # Used to upload release artifacts
      contents: write
      # Used to generate artifact attestation
      attestations: write
    steps:
      - uses: actions/download-artifact@v8
      - name: Generate artifact attestation
        uses: actions/attest-build-provenance@v4
        with:
          subject-path: 'wheels-*/*'
      - name: Publish to PyPI
        uses: PyO3/maturin-action@v1
        env:
          MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
        with:
          command: upload
          args: --non-interactive --skip-existing wheels-*/*