You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Python SDK has its own self-contained CI/CD workflow located in `sdk/python/.github/workflows/`. This allows the SDK to be managed independently and potentially moved to its own repository in the future.
5
+
The LNMP Python SDK has two main GitHub Actions workflows for continuous integration and release automation.
6
6
7
7
## Workflow Structure
8
8
9
-
### 1. **ci.yml** - Main CI/CD Pipeline
9
+
### 1. **ci.yml** - Continuous Integration
10
10
11
11
**Triggers:**
12
-
- Push to `main` or `develop` branches (when SDK files change)
13
-
- Pull requests to `main` (when SDK files change)
14
-
-Release events
12
+
- Push to `main` or `develop` branches
13
+
- Pull requests to `main`
14
+
-Manual workflow dispatch
15
15
16
16
**Jobs:**
17
17
@@ -25,16 +25,16 @@ The Python SDK has its own self-contained CI/CD workflow located in `sdk/python/
25
25
- Runs pytest with coverage reporting
26
26
- Uploads coverage to Codecov
27
27
28
-
#### Build Wheels
29
-
-Only runs on release events
28
+
#### Build Wheels (Manual Only)
29
+
-Triggered via `workflow_dispatch`
30
30
- Builds native wheels for:
31
-
- Linux (x86_64, aarch64)
31
+
- Linux (x86_64)
32
32
- macOS (x86_64, arm64)
33
33
- Windows (x86_64)
34
34
- Uploads wheels as artifacts
35
35
36
-
#### Publish to PyPI
37
-
-Only runs for non-prerelease releases
36
+
#### Publish to PyPI (Manual Only)
37
+
-Triggered via `workflow_dispatch`
38
38
- Downloads all platform wheels
39
39
- Publishes to PyPI using trusted publisher (OIDC)
40
40
@@ -43,45 +43,107 @@ The Python SDK has its own self-contained CI/CD workflow located in `sdk/python/
43
43
- Executes performance benchmarks
44
44
- Uploads results as artifacts
45
45
46
-
## Path Filtering
46
+
---
47
47
48
-
All jobs use path filtering to only run when SDK-specific files change:
49
-
```yaml
50
-
paths:
51
-
- 'sdk/python/**'
52
-
- '.github/workflows/python-ci.yml'
53
-
```
48
+
### 2. **release.yml** - Automated Releases
49
+
50
+
**Triggers:**
51
+
- Push tags matching `v*` (e.g., `v0.5.7`)
52
+
53
+
**Jobs:**
54
54
55
-
## Independence from Main Repo
55
+
#### Test
56
+
- Matrix testing across Python 3.9-3.12 and all platforms
57
+
- Ensures quality before release
56
58
57
-
This structure allows the SDK to:
58
-
1. Have its own release cycle
59
-
2. Be tested independently
60
-
3. Maintain separate versioning
61
-
4. Eventually move to its own repository with minimal changes
59
+
#### Build Wheels
60
+
- Builds wheels for all supported platforms:
61
+
- Linux x86_64
62
+
- macOS universal2 (x86_64 + arm64)
63
+
- Windows x86_64
64
+
- Uploads as artifacts
65
+
66
+
#### Build Source Distribution
67
+
- Creates source distribution (sdist)
68
+
- Uploads as artifact
62
69
63
-
## Future Migration
70
+
#### Publish to PyPI
71
+
- Downloads all wheels and sdist
72
+
- Publishes to PyPI using trusted publisher
73
+
- Only runs for version tags (not pre-releases)
64
74
65
-
To move the SDK to a separate repository:
66
-
1. Copy `sdk/python/` to new repo root
67
-
2. Update path filters in workflow (remove `sdk/python/` prefix)
68
-
3. Update checkout paths
69
-
4. Set up PyPI trusted publisher for new repo
70
-
5. Update documentation links
75
+
#### Create GitHub Release
76
+
- Creates GitHub release with changelog
77
+
- Attaches all wheels and sdist
78
+
- Marks pre-releases appropriately
71
79
72
80
## Environment Variables
73
81
74
-
The workflow uses:
82
+
Both workflows use:
75
83
-`CARGO_TERM_COLOR=always` - Colored Cargo output
76
84
-`RUST_BACKTRACE=1` - Full backtraces on errors
85
+
-`PYTHONPATH=$PWD:$PYTHONPATH` - For local package imports
86
+
87
+
## PyPI Publishing Setup
77
88
78
-
## Secrets Required
89
+
### Trusted Publisher (Recommended) ✅
79
90
80
-
For PyPI publishing, configure:
81
-
- **Trusted Publisher (Recommended)**: Configure at https://pypi.org/manage/account/publishing/
82
-
- Owner: `lnmplang`
83
-
- Repository: `lnmp-protocol`(or new SDK repo name)
84
-
- Workflow: `ci.yml`
85
-
- Environment: `pypi`
91
+
Configure at https://pypi.org/manage/account/publishing/
92
+
93
+
**Settings:**
94
+
-**Owner**: Your GitHub username or organization
95
+
-**Repository**: `lnmp-sdk-python`
96
+
-**Workflow**: `release.yml`
97
+
-**Environment**: `pypi`
86
98
87
99
No manual tokens required with trusted publishers!
100
+
101
+
### Alternative: Manual Token
102
+
103
+
If trusted publisher isn't available:
104
+
1. Generate PyPI API token at https://pypi.org/manage/account/token/
105
+
2. Add as GitHub secret: `PYPI_TOKEN`
106
+
3. Update workflow to use token-based authentication
107
+
108
+
## Release Process
109
+
110
+
### Creating a Release
111
+
112
+
```bash
113
+
# 1. Update version in pyproject.toml and Cargo.toml
114
+
# 2. Commit changes
115
+
git add pyproject.toml Cargo.toml
116
+
git commit -m "chore: bump version to 0.5.7"
117
+
118
+
# 3. Create and push tag
119
+
git tag v0.5.7
120
+
git push origin main
121
+
git push origin v0.5.7
122
+
123
+
# 4. GitHub Actions automatically:
124
+
# - Runs tests
125
+
# - Builds wheels for all platforms
126
+
# - Publishes to PyPI
127
+
# - Creates GitHub Release
128
+
```
129
+
130
+
### Pre-release
131
+
132
+
```bash
133
+
# Use pre-release tag format
134
+
git tag v0.5.7-beta.1
135
+
git push origin v0.5.7-beta.1
136
+
137
+
# Workflow will create GitHub release but skip PyPI
138
+
```
139
+
140
+
## Required GitHub Secrets
141
+
142
+
- None required if using PyPI trusted publisher
143
+
-`PYPI_TOKEN` - Only if using manual token authentication
0 commit comments