-
Notifications
You must be signed in to change notification settings - Fork 1
107 lines (94 loc) · 2.71 KB
/
python-sdk.yml
File metadata and controls
107 lines (94 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Python SDK
on:
push:
tags: ["v*"]
permissions:
contents: read
jobs:
build:
name: Build wheel and sdist
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install build tooling
run: python -m pip install --upgrade build
- name: Build wheel and sdist
working-directory: sdk/python
run: python -m build --wheel --sdist --outdir ../../dist
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
if-no-files-found: error
retention-days: 7
test:
name: Install and import on ${{ matrix.os }} / Python ${{ matrix.python-version }}
needs: build
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest # Linux x86_64
- ubuntu-24.04-arm # Linux ARM64
- macos-14 # macOS ARM64 (Apple Silicon)
- windows-latest # Windows x86_64
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: ${{ matrix.os }}
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Download built wheel
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Install the wheel from dist/
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install --find-links=dist --only-binary swarndb swarndb
- name: Import smoke test
shell: bash
run: |
python - <<'PY'
import swarndb
from swarndb import SwarnDBClient, AsyncSwarnDBClient, Filter
from swarndb.types import (
BulkInsertResult,
RecoveryStatus,
PersistenceStatus,
CollectionMetrics,
ReadinessStatus,
HealthStatus,
)
print("swarndb version:", swarndb.__version__)
PY
publish:
name: Publish to PyPI
needs: [build, test]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/swarndb
permissions:
id-token: write
steps:
- name: Download built distributions
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Publish to PyPI via OIDC
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
print-hash: true