1- # GitHub Actions for Rust SDK
1+ # GitHub Actions Workflows
22
3- This repository includes automated GitHub Actions workflows for the Rust SDK located in the ` rust/ ` directory .
3+ This repository includes automated GitHub Actions workflows for both the Rust SDK and TypeScript SDK .
44
55## Workflows
66
7- ### 1. Rust CI (` rust-ci.yml ` )
7+ ### Rust SDK
8+
9+ #### 1. Rust CI (` rust-ci.yml ` )
810
911** Triggers:**
1012- Push to ` main ` or ` develop ` branches (when Rust SDK files change)
@@ -22,7 +24,7 @@ This repository includes automated GitHub Actions workflows for the Rust SDK loc
2224- All features: Full feature set including payment systems
2325- Individual features: ` pyg ` , ` prepay ` , ` stream `
2426
25- ### 2. Publish to crates.io (` publish-rust-sdk.yml ` )
27+ #### 2. Publish to crates.io (` publish-rust-sdk.yml ` )
2628
2729** Triggers:**
2830- New GitHub releases
@@ -34,20 +36,66 @@ This repository includes automated GitHub Actions workflows for the Rust SDK loc
3436- Packages the crate
3537- Publishes to crates.io
3638
39+ ### TypeScript SDK
40+
41+ #### 3. TypeScript CI (` typescript-ci.yml ` )
42+
43+ ** Triggers:**
44+ - Push to ` main ` or ` develop ` branches (when TypeScript SDK files change)
45+ - Pull requests to ` main ` or ` develop ` branches (when TypeScript SDK files change)
46+
47+ ** What it does:**
48+ - Tests the SDK on multiple Node.js versions (18, 20, 22)
49+ - Checks code formatting with Prettier
50+ - Runs ESLint code quality checks
51+ - Performs TypeScript type checking
52+ - Builds the package with Rollup
53+ - Runs comprehensive test suite with Jest
54+ - Generates coverage reports
55+ - Validates npm package can be built
56+
57+ ** Testing Matrix:**
58+ - Node.js versions: 18, 20, 22
59+ - Coverage threshold: 90% (lines, functions, branches, statements)
60+
61+ #### 4. Publish to npm (` publish-typescript-sdk.yml ` )
62+
63+ ** Triggers:**
64+ - New GitHub releases
65+ - Tags matching pattern ` sdk/typescript/v* ` (e.g., ` sdk/typescript/v0.1.0 ` , ` sdk/typescript/v1.2.0 ` )
66+
67+ ** What it does:**
68+ - Validates code quality (formatting, linting, type checking)
69+ - Builds the package
70+ - Runs comprehensive test suite
71+ - Generates TypeDoc documentation
72+ - Validates npm package
73+ - Publishes to npm as ` @svmai/registries `
74+
3775## Setup Requirements
3876
3977### Required GitHub Secrets
4078
4179To enable automatic publishing, you need to configure:
4280
81+ #### For Rust SDK
82+
43831 . ** ` CARGO_API_KEY ` ** - Your crates.io API token
4484 - Go to [ crates.io/me] ( https://crates.io/me )
4585 - Generate a new token with publish permissions
4686 - Add as repository secret in GitHub Settings → Secrets and variables → Actions
4787
88+ #### For TypeScript SDK
89+
90+ 1 . ** ` NPM_TOKEN ` ** - Your npm API token
91+ - Go to [ npmjs.com] ( https://www.npmjs.com/ ) and log in
92+ - Go to Access Tokens in your account settings
93+ - Generate a new token with "Automation" type (for CI/CD)
94+ - Add as repository secret in GitHub Settings → Secrets and variables → Actions
95+
4896### Publishing Process
4997
50- #### Automatic Publishing
98+ #### Rust SDK - Automatic Publishing
5199
521001 . ** For releases:**
53101 ``` bash
@@ -62,8 +110,24 @@ To enable automatic publishing, you need to configure:
62110 - Create a new release in the GitHub UI
63111 - The workflow will automatically trigger
64112
113+ #### TypeScript SDK - Automatic Publishing
114+
115+ 1 . ** For releases:**
116+ ``` bash
117+ # Create and push a new tag
118+ git tag sdk/typescript/v0.1.1
119+ git push origin sdk/typescript/v0.1.1
120+
121+ # Or create a GitHub release with tag sdk/typescript/v0.1.1
122+ ```
123+
124+ 2 . ** For GitHub releases:**
125+ - Create a new release in the GitHub UI
126+ - The workflow will automatically trigger
127+
65128#### Manual Publishing
66129
130+ ##### Rust SDK
67131For development or testing:
68132
69133``` bash
@@ -72,32 +136,57 @@ export CARGO_API_KEY=your_token_here
72136cargo publish
73137```
74138
139+ ##### TypeScript SDK
140+ For development or testing:
141+
142+ ``` bash
143+ cd sdk/typescript
144+ export NPM_TOKEN=your_token_here
145+ npm publish --access public
146+ ```
147+
75148## Workflow Features
76149
77150### Smart Path Filtering
78151
79- Both workflows only run when Rust SDK files change:
152+ Both Rust and TypeScript workflows only run when their respective SDK files change:
153+
154+ ** Rust SDK workflows:**
80155- ` rust/** ` - Any file in the Rust SDK directory
81- - ` .github/workflows/rust-*.yml ` - Workflow configuration changes
156+ - ` .github/workflows/rust-*.yml ` - Rust workflow configuration changes
157+
158+ ** TypeScript SDK workflows:**
159+ - ` sdk/typescript/** ` - Any file in the TypeScript SDK directory
160+ - ` .github/workflows/typescript-*.yml ` - TypeScript workflow configuration changes
82161
83162### Comprehensive Testing
84163
85- The CI workflow ensures reliability across:
164+ ** Rust SDK CI ** ensures reliability across:
86165- Multiple Rust versions (stable, beta)
87166- All feature flag combinations
88167- Core functionality without optional features
89168- Full feature set with payment systems
90169
170+ ** TypeScript SDK CI** ensures reliability across:
171+ - Multiple Node.js versions (18, 20, 22)
172+ - Code quality with ESLint and Prettier
173+ - Type safety with TypeScript strict mode
174+ - > 90% test coverage requirement
175+ - Build compatibility with Rollup bundler
176+
91177### Error Handling
92178
93179The workflows are designed to:
94180- Fail fast on formatting issues
95- - Validate all feature combinations
96- - Ensure package can be built and published
181+ - Validate all feature combinations (Rust) / Node.js versions (TypeScript)
182+ - Ensure packages can be built and published
97183- Provide clear error messages
184+ - Generate comprehensive coverage reports
98185
99186## Local Development
100187
188+ ### Rust SDK
189+
101190To run the same checks locally:
102191
103192``` bash
@@ -119,10 +208,47 @@ cargo test --features stream
119208cargo package --allow-dirty
120209```
121210
211+ ### TypeScript SDK
212+
213+ To run the same checks locally:
214+
215+ ``` bash
216+ cd sdk/typescript
217+
218+ # Install dependencies
219+ npm install --legacy-peer-deps
220+
221+ # Check formatting
222+ npm run format -- --check
223+
224+ # Lint code
225+ npm run lint
226+
227+ # Type check
228+ npx tsc --noEmit
229+
230+ # Build package
231+ npm run build
232+
233+ # Run tests
234+ npm test
235+
236+ # Run tests with coverage
237+ npm run test:coverage
238+
239+ # Generate documentation
240+ npm run docs
241+
242+ # Package validation
243+ npm pack --dry-run
244+ ```
245+
122246## Troubleshooting
123247
124248### Common Issues
125249
250+ #### Rust SDK
251+
1262521 . ** Formatting failures:**
127253 ``` bash
128254 cd rust
@@ -140,6 +266,36 @@ cargo package --allow-dirty
140266 - Check that version in ` Cargo.toml ` hasn't been published before
141267 - Ensure all required metadata is present in ` Cargo.toml `
142268
269+ #### TypeScript SDK
270+
271+ 1 . ** Formatting failures:**
272+ ``` bash
273+ cd sdk/typescript
274+ npm run format
275+ git add .
276+ git commit -m " Fix formatting"
277+ ```
278+
279+ 2 . ** Type checking errors:**
280+ - Run ` npx tsc --noEmit ` to see detailed type errors
281+ - Ensure all dependencies are properly typed
282+ - Check ` tsconfig.json ` configuration
283+
284+ 3 . ** Test coverage failures:**
285+ - Run ` npm run test:coverage ` to see coverage report
286+ - Add tests for uncovered lines/functions
287+ - Ensure coverage threshold is met (90%)
288+
289+ 4 . ** Build failures:**
290+ - Check Rollup configuration in ` rollup.config.js `
291+ - Ensure all imports are correctly resolved
292+ - Verify output directory structure
293+
294+ 5 . ** Publishing failures:**
295+ - Verify ` NPM_TOKEN ` secret is configured
296+ - Check that version in ` package.json ` hasn't been published before
297+ - Ensure package name ` @svmai/registries ` is available
298+
143299### Workflow Logs
144300
145301Check workflow execution in:
@@ -149,12 +305,20 @@ Check workflow execution in:
149305
150306## Version Management
151307
152- The SDK uses semantic versioning:
308+ Both SDKs use semantic versioning:
153309- ` 0.x.y ` - Pre-1.0 development versions
154310- ` 1.x.y ` - Stable API versions
155311
156312When publishing:
313+
314+ ### Rust SDK
1573151 . Update version in ` rust/Cargo.toml `
1583162 . Update documentation if needed
1593173 . Create tag with format ` sdk/rust/vX.Y.Z `
318+ 4 . Push tag to trigger publishing workflow
319+
320+ ### TypeScript SDK
321+ 1 . Update version in ` sdk/typescript/package.json `
322+ 2 . Update documentation if needed
323+ 3 . Create tag with format ` sdk/typescript/vX.Y.Z `
1603244 . Push tag to trigger publishing workflow
0 commit comments