|
| 1 | +name: Python Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - stable |
| 7 | + pull_request: |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + test: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] |
| 19 | + |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v6 |
| 22 | + |
| 23 | + - name: Set up Python |
| 24 | + uses: actions/setup-python@v6 |
| 25 | + with: |
| 26 | + python-version: ${{ matrix.python-version }} |
| 27 | + |
| 28 | + - name: Set up uv |
| 29 | + uses: astral-sh/setup-uv@v7 |
| 30 | + |
| 31 | + - name: Install Rust toolchain |
| 32 | + uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 33 | + |
| 34 | + - name: Install dependencies |
| 35 | + run: | |
| 36 | + uv sync |
| 37 | + |
| 38 | + - name: Build Python bindings |
| 39 | + run: | |
| 40 | + uv run maturin develop --release |
| 41 | + |
| 42 | + - name: Run Python tests |
| 43 | + run: | |
| 44 | + uv run pytest test_cloudcheck.py -v |
| 45 | +
|
| 46 | + publish: |
| 47 | + runs-on: ubuntu-latest |
| 48 | + needs: test |
| 49 | + if: github.event_name == 'push' && github.ref == 'refs/heads/cloudcheck-v8' |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v6 |
| 52 | + - name: Set up Python |
| 53 | + uses: actions/setup-python@v6 |
| 54 | + with: |
| 55 | + python-version: "3.x" |
| 56 | + - name: Set up Rust |
| 57 | + uses: dtolnay/rust-toolchain@stable |
| 58 | + - name: Set up uv |
| 59 | + uses: astral-sh/setup-uv@v7 |
| 60 | + - name: Build PyPi package |
| 61 | + run: uv run maturin build --release --out dist |
| 62 | + - name: Publish PyPi package |
| 63 | + # TODO: Remove || true |
| 64 | + run: uv run maturin publish --username __token__ --password ${{ secrets.PYPI_TOKEN }} || true |
| 65 | + |
| 66 | + linux: |
| 67 | + runs-on: ${{ matrix.platform.runner }} |
| 68 | + needs: publish |
| 69 | + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' |
| 70 | + strategy: |
| 71 | + matrix: |
| 72 | + platform: |
| 73 | + - runner: ubuntu-22.04 |
| 74 | + target: x86_64 |
| 75 | + - runner: ubuntu-22.04 |
| 76 | + target: x86 |
| 77 | + - runner: ubuntu-22.04 |
| 78 | + target: aarch64 |
| 79 | + - runner: ubuntu-22.04 |
| 80 | + target: armv7 |
| 81 | + # get wrecked ibm |
| 82 | + # - runner: ubuntu-22.04 |
| 83 | + # target: s390x |
| 84 | + - runner: ubuntu-22.04 |
| 85 | + target: ppc64le |
| 86 | + steps: |
| 87 | + - uses: actions/checkout@v6 |
| 88 | + - uses: actions/setup-python@v6 |
| 89 | + with: |
| 90 | + python-version: 3.x |
| 91 | + - name: Build wheels |
| 92 | + uses: PyO3/maturin-action@v1 |
| 93 | + with: |
| 94 | + target: ${{ matrix.platform.target }} |
| 95 | + args: --release --out dist --find-interpreter |
| 96 | + sccache: false |
| 97 | + manylinux: auto |
| 98 | + before-script-linux: | |
| 99 | + if command -v apt-get >/dev/null 2>&1; then |
| 100 | + # Debian-based |
| 101 | + sudo apt-get update |
| 102 | + sudo apt-get install -y pkg-config libssl-dev perl make gcc g++ binutils |
| 103 | + elif command -v yum >/dev/null 2>&1; then |
| 104 | + # CentOS-based (manylinux images) |
| 105 | + yum update -y |
| 106 | + yum install -y openssl openssl-devel perl perl-core make gcc gcc-c++ binutils |
| 107 | + else |
| 108 | + echo "Error: Neither apt-get nor yum found" |
| 109 | + exit 1 |
| 110 | + fi |
| 111 | + - name: Upload wheels |
| 112 | + uses: actions/upload-artifact@v5 |
| 113 | + with: |
| 114 | + name: wheels-linux-${{ matrix.platform.target }} |
| 115 | + path: dist |
| 116 | + |
| 117 | + musllinux: |
| 118 | + runs-on: ${{ matrix.platform.runner }} |
| 119 | + needs: publish |
| 120 | + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' |
| 121 | + strategy: |
| 122 | + matrix: |
| 123 | + platform: |
| 124 | + - runner: ubuntu-22.04 |
| 125 | + target: x86_64 |
| 126 | + - runner: ubuntu-22.04 |
| 127 | + target: x86 |
| 128 | + - runner: ubuntu-22.04 |
| 129 | + target: aarch64 |
| 130 | + - runner: ubuntu-22.04 |
| 131 | + target: armv7 |
| 132 | + steps: |
| 133 | + - uses: actions/checkout@v6 |
| 134 | + - uses: actions/setup-python@v6 |
| 135 | + with: |
| 136 | + python-version: 3.x |
| 137 | + - name: Build wheels |
| 138 | + uses: PyO3/maturin-action@v1 |
| 139 | + with: |
| 140 | + target: ${{ matrix.platform.target }} |
| 141 | + args: --release --out dist --find-interpreter |
| 142 | + sccache: false |
| 143 | + manylinux: musllinux_1_2 |
| 144 | + before-script-linux: | |
| 145 | + if command -v apt-get >/dev/null 2>&1; then |
| 146 | + # Debian-based |
| 147 | + sudo apt-get update |
| 148 | + sudo apt-get install -y pkg-config libssl-dev |
| 149 | + elif command -v yum >/dev/null 2>&1; then |
| 150 | + # CentOS-based |
| 151 | + yum update -y |
| 152 | + yum install -y openssl openssl-devel |
| 153 | + else |
| 154 | + echo "Error: Neither apt-get nor yum found" |
| 155 | + exit 1 |
| 156 | + fi |
| 157 | + - name: Upload wheels |
| 158 | + uses: actions/upload-artifact@v5 |
| 159 | + with: |
| 160 | + name: wheels-musllinux-${{ matrix.platform.target }} |
| 161 | + path: dist |
| 162 | + |
| 163 | + windows: |
| 164 | + runs-on: ${{ matrix.platform.runner }} |
| 165 | + needs: publish |
| 166 | + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' |
| 167 | + strategy: |
| 168 | + matrix: |
| 169 | + platform: |
| 170 | + - runner: windows-latest |
| 171 | + target: x64 |
| 172 | + - runner: windows-latest |
| 173 | + target: x86 |
| 174 | + steps: |
| 175 | + - uses: actions/checkout@v6 |
| 176 | + - uses: actions/setup-python@v6 |
| 177 | + with: |
| 178 | + python-version: 3.x |
| 179 | + architecture: ${{ matrix.platform.target }} |
| 180 | + - name: Build wheels |
| 181 | + uses: PyO3/maturin-action@v1 |
| 182 | + with: |
| 183 | + target: ${{ matrix.platform.target }} |
| 184 | + args: --release --out dist --find-interpreter |
| 185 | + sccache: false |
| 186 | + - name: Upload wheels |
| 187 | + uses: actions/upload-artifact@v5 |
| 188 | + with: |
| 189 | + name: wheels-windows-${{ matrix.platform.target }} |
| 190 | + path: dist |
| 191 | + |
| 192 | + macos: |
| 193 | + runs-on: ${{ matrix.platform.runner }} |
| 194 | + needs: publish |
| 195 | + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' |
| 196 | + strategy: |
| 197 | + matrix: |
| 198 | + platform: |
| 199 | + - runner: macos-15-intel |
| 200 | + target: x86_64 |
| 201 | + - runner: macos-latest |
| 202 | + target: aarch64 |
| 203 | + steps: |
| 204 | + - uses: actions/checkout@v6 |
| 205 | + - uses: actions/setup-python@v6 |
| 206 | + with: |
| 207 | + python-version: 3.x |
| 208 | + - name: Build wheels |
| 209 | + uses: PyO3/maturin-action@v1 |
| 210 | + with: |
| 211 | + target: ${{ matrix.platform.target }} |
| 212 | + args: --release --out dist --find-interpreter |
| 213 | + sccache: false |
| 214 | + - name: Upload wheels |
| 215 | + uses: actions/upload-artifact@v5 |
| 216 | + with: |
| 217 | + name: wheels-macos-${{ matrix.platform.target }} |
| 218 | + path: dist |
| 219 | + |
| 220 | + sdist: |
| 221 | + runs-on: ubuntu-latest |
| 222 | + needs: publish |
| 223 | + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' |
| 224 | + steps: |
| 225 | + - uses: actions/checkout@v6 |
| 226 | + - name: Build sdist |
| 227 | + uses: PyO3/maturin-action@v1 |
| 228 | + with: |
| 229 | + command: sdist |
| 230 | + args: --out dist |
| 231 | + - name: Upload sdist |
| 232 | + uses: actions/upload-artifact@v5 |
| 233 | + with: |
| 234 | + name: wheels-sdist |
| 235 | + path: dist |
| 236 | + |
| 237 | + release: |
| 238 | + name: Release |
| 239 | + runs-on: ubuntu-latest |
| 240 | + needs: [linux, musllinux, windows, macos, sdist] |
| 241 | + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' |
| 242 | + permissions: |
| 243 | + # Use to sign the release artifacts |
| 244 | + id-token: write |
| 245 | + # Used to upload release artifacts |
| 246 | + contents: write |
| 247 | + # Used to generate artifact attestation |
| 248 | + attestations: write |
| 249 | + steps: |
| 250 | + - uses: actions/download-artifact@v6 |
| 251 | + - name: Generate artifact attestation |
| 252 | + uses: actions/attest-build-provenance@v3 |
| 253 | + with: |
| 254 | + subject-path: 'wheels-*/*' |
| 255 | + - name: Publish wheels to PyPI |
| 256 | + uses: PyO3/maturin-action@v1 |
| 257 | + env: |
| 258 | + MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} |
| 259 | + with: |
| 260 | + command: upload |
| 261 | + args: --non-interactive --skip-existing wheels-*/* |
0 commit comments