|
| 1 | +name: pynumaflow-lite |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ["main", "release/*"] |
| 6 | + paths: |
| 7 | + - "packages/pynumaflow-lite/**" |
| 8 | + - ".github/workflows/pynumaflow-lite.yml" |
| 9 | + pull_request: |
| 10 | + branches: ["main", "release/*"] |
| 11 | + paths: |
| 12 | + - "packages/pynumaflow-lite/**" |
| 13 | + - ".github/workflows/pynumaflow-lite.yml" |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: read |
| 17 | + |
| 18 | +jobs: |
| 19 | + lint: |
| 20 | + name: Format and lint |
| 21 | + runs-on: ubuntu-24.04 |
| 22 | + defaults: |
| 23 | + run: |
| 24 | + working-directory: packages/pynumaflow-lite |
| 25 | + |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v7 |
| 28 | + |
| 29 | + - name: Set up Python |
| 30 | + uses: actions/setup-python@v6 |
| 31 | + with: |
| 32 | + python-version: "3.10" |
| 33 | + |
| 34 | + - name: Install uv |
| 35 | + uses: astral-sh/setup-uv@v8 |
| 36 | + with: |
| 37 | + python-version: "3.10" |
| 38 | + working-directory: packages/pynumaflow-lite |
| 39 | + |
| 40 | + - name: Set up Rust |
| 41 | + run: | |
| 42 | + rustup toolchain install stable --profile minimal --component clippy --component rustfmt |
| 43 | + rustup default stable |
| 44 | +
|
| 45 | + - name: Install dependencies |
| 46 | + run: uv sync --group dev |
| 47 | + |
| 48 | + - name: Check Rust formatting |
| 49 | + run: cargo fmt --all --check |
| 50 | + |
| 51 | + - name: Check Python formatting |
| 52 | + run: uv run ruff format --check pynumaflow_lite/ tests/ manifests/ |
| 53 | + |
| 54 | + - name: Ruff lint |
| 55 | + run: uv run ruff check . |
| 56 | + |
| 57 | + - name: Clippy |
| 58 | + run: cargo clippy --workspace --all-targets --all-features -- -D warnings -A clippy::module_inception |
| 59 | + |
| 60 | + test: |
| 61 | + name: Test ${{ matrix.platform.artifact }} |
| 62 | + runs-on: ${{ matrix.platform.os }} |
| 63 | + |
| 64 | + strategy: |
| 65 | + fail-fast: false |
| 66 | + matrix: |
| 67 | + platform: |
| 68 | + - os: ubuntu-24.04 |
| 69 | + artifact: linux-x86_64 |
| 70 | + - os: ubuntu-24.04-arm |
| 71 | + artifact: linux-aarch64 |
| 72 | + - os: macos-15-intel |
| 73 | + artifact: macos-x86_64 |
| 74 | + - os: macos-15 |
| 75 | + artifact: macos-aarch64 |
| 76 | + - os: windows-2025 |
| 77 | + artifact: windows-x86_64 |
| 78 | + |
| 79 | + defaults: |
| 80 | + run: |
| 81 | + working-directory: packages/pynumaflow-lite |
| 82 | + |
| 83 | + steps: |
| 84 | + - uses: actions/checkout@v7 |
| 85 | + |
| 86 | + - name: Install uv |
| 87 | + uses: astral-sh/setup-uv@v8 |
| 88 | + with: |
| 89 | + working-directory: packages/pynumaflow-lite |
| 90 | + |
| 91 | + - name: Set up Rust |
| 92 | + run: | |
| 93 | + rustup toolchain install stable --profile minimal |
| 94 | + rustup default stable |
| 95 | +
|
| 96 | + - name: Run tests for Python versions |
| 97 | + if: runner.os != 'Windows' |
| 98 | + shell: bash |
| 99 | + run: | |
| 100 | + set -euo pipefail |
| 101 | +
|
| 102 | + for python_version in 3.10 3.11 3.12 3.13 3.14; do |
| 103 | + echo "::group::Python ${python_version}" |
| 104 | + uv python install "${python_version}" |
| 105 | + uv sync --group dev --python "${python_version}" |
| 106 | + uv pip install "maturin>=1.14,<2.0" |
| 107 | + uv run maturin develop |
| 108 | + uv run pytest -v |
| 109 | + export PYTHONHOME="$(uv run python -c 'import sys; print(sys.base_prefix)')" |
| 110 | + cargo test |
| 111 | + unset PYTHONHOME |
| 112 | + echo "::endgroup::" |
| 113 | + done |
| 114 | +
|
| 115 | + - name: Run tests for Python versions |
| 116 | + if: runner.os == 'Windows' |
| 117 | + shell: pwsh |
| 118 | + run: | |
| 119 | + $ErrorActionPreference = "Stop" |
| 120 | + $versions = @("3.10", "3.11", "3.12", "3.13", "3.14") |
| 121 | +
|
| 122 | + foreach ($pythonVersion in $versions) { |
| 123 | + Write-Output "::group::Python $pythonVersion" |
| 124 | + try { |
| 125 | + uv python install $pythonVersion |
| 126 | + uv sync --group dev --python $pythonVersion |
| 127 | + uv pip install "maturin>=1.14,<2.0" |
| 128 | + uv run maturin develop |
| 129 | + uv run pytest -v |
| 130 | + $env:PYTHONHOME = uv run python -c "import sys; print(sys.base_prefix)" |
| 131 | + cargo test |
| 132 | + } finally { |
| 133 | + Remove-Item Env:PYTHONHOME -ErrorAction SilentlyContinue |
| 134 | + Write-Output "::endgroup::" |
| 135 | + } |
| 136 | + } |
| 137 | +
|
| 138 | + build-wheels: |
| 139 | + name: Build wheel ${{ matrix.platform.artifact }} py${{ matrix.python-version }} |
| 140 | + runs-on: ${{ matrix.platform.os }} |
| 141 | + |
| 142 | + strategy: |
| 143 | + fail-fast: false |
| 144 | + matrix: |
| 145 | + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] |
| 146 | + platform: |
| 147 | + - os: ubuntu-24.04 |
| 148 | + target: x86_64-unknown-linux-gnu |
| 149 | + artifact: linux-x86_64 |
| 150 | + manylinux: "2014" |
| 151 | + linux: true |
| 152 | + - os: macos-15 |
| 153 | + target: aarch64-apple-darwin |
| 154 | + artifact: macos-aarch64 |
| 155 | + manylinux: "off" |
| 156 | + linux: false |
| 157 | + - os: windows-2025 |
| 158 | + target: x86_64-pc-windows-msvc |
| 159 | + artifact: windows-x86_64 |
| 160 | + manylinux: "off" |
| 161 | + linux: false |
| 162 | + |
| 163 | + steps: |
| 164 | + - uses: actions/checkout@v7 |
| 165 | + |
| 166 | + - name: Set up Python ${{ matrix.python-version }} |
| 167 | + uses: actions/setup-python@v6 |
| 168 | + with: |
| 169 | + python-version: ${{ matrix.python-version }} |
| 170 | + |
| 171 | + - name: Build wheel |
| 172 | + uses: PyO3/maturin-action@v1 |
| 173 | + with: |
| 174 | + command: build |
| 175 | + working-directory: packages/pynumaflow-lite |
| 176 | + target: ${{ matrix.platform.target }} |
| 177 | + manylinux: ${{ matrix.platform.manylinux }} |
| 178 | + args: >- |
| 179 | + --release |
| 180 | + --out dist |
| 181 | + -i ${{ matrix.platform.linux && format('python{0}', matrix.python-version) || 'python' }} |
| 182 | +
|
| 183 | + - name: Upload wheel artifact |
| 184 | + uses: actions/upload-artifact@v7 |
| 185 | + with: |
| 186 | + name: pynumaflow-lite-${{ matrix.platform.artifact }}-py${{ matrix.python-version }} |
| 187 | + path: packages/pynumaflow-lite/dist/*.whl |
| 188 | + if-no-files-found: error |
| 189 | + compression-level: 0 |
0 commit comments