Skip to content

Commit f83027e

Browse files
zhigang1992claude
andcommitted
feat: add comprehensive CI/CD pipeline with GitHub Actions
- Add CI workflow for testing, type checking, and building - Add publish workflow for npm releases - Add automated release workflow with changesets - Add PR checks for changesets and formatting - Add security scanning workflow - Add documentation validation workflow - Configure changesets for version management - Add Prettier for code formatting - Add unit tests for core and adapter packages - Add contributing guidelines and release documentation - Configure Dependabot for dependency updates - Update README with CI badges This establishes a complete CI/CD pipeline for automated testing, versioning, and publishing of the React Telegram packages. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 457f933 commit f83027e

22 files changed

Lines changed: 1162 additions & 3 deletions

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [["@react-telegram/core", "@react-telegram/mtcute-adapter"]],
7+
"access": "public",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": ["@react-telegram/examples"]
11+
}

.claude/settings.local.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"Bash(bun:*)",
2020
"Bash(mkdir:*)",
2121
"Bash(cp:*)",
22-
"Bash(rg:*)"
22+
"Bash(rg:*)",
23+
"Bash(mv:*)"
2324
],
2425
"deny": []
2526
}

.github/CONTRIBUTING.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Contributing to React Telegram
2+
3+
Thank you for your interest in contributing to React Telegram! This document provides guidelines and instructions for contributing.
4+
5+
## Development Setup
6+
7+
1. Fork and clone the repository
8+
2. Install dependencies:
9+
```bash
10+
bun install
11+
```
12+
3. Run tests:
13+
```bash
14+
bun test
15+
```
16+
17+
## Project Structure
18+
19+
This is a monorepo managed with Bun workspaces:
20+
21+
- `packages/core` - Core React reconciler
22+
- `packages/mtcute-adapter` - MTCute Telegram adapter
23+
- `packages/examples` - Example implementations
24+
25+
## Making Changes
26+
27+
### 1. Create a Feature Branch
28+
29+
```bash
30+
git checkout -b feature/your-feature-name
31+
```
32+
33+
### 2. Make Your Changes
34+
35+
- Write clear, concise commit messages
36+
- Add tests for new functionality
37+
- Update documentation as needed
38+
- Ensure all tests pass
39+
40+
### 3. Create a Changeset
41+
42+
Before submitting a PR, create a changeset describing your changes:
43+
44+
```bash
45+
bun run changeset
46+
```
47+
48+
This will prompt you to:
49+
- Select which packages changed
50+
- Choose the type of change (major/minor/patch)
51+
- Write a summary of changes
52+
53+
### 4. Submit a Pull Request
54+
55+
- Push your branch to your fork
56+
- Open a PR against the `main` branch
57+
- Fill out the PR template
58+
- Wait for CI checks to pass
59+
60+
## Code Style
61+
62+
We use Prettier for code formatting:
63+
64+
```bash
65+
bun run format
66+
```
67+
68+
## Testing
69+
70+
### Running Tests
71+
72+
```bash
73+
# Run all tests
74+
bun test
75+
76+
# Run tests in watch mode
77+
bun test:watch
78+
79+
# Run tests for a specific package
80+
cd packages/core && bun test
81+
```
82+
83+
### Writing Tests
84+
85+
- Place test files next to the code they test
86+
- Use `.test.ts` or `.test.tsx` extension
87+
- Follow existing test patterns
88+
89+
## Type Checking
90+
91+
Ensure your code passes TypeScript checks:
92+
93+
```bash
94+
bun run type-check
95+
```
96+
97+
## CI/CD Pipeline
98+
99+
Our GitHub Actions workflows run:
100+
- Tests on multiple Node versions
101+
- Type checking
102+
- Build verification
103+
- Security audits
104+
105+
## Release Process
106+
107+
Releases are automated through GitHub Actions:
108+
109+
1. Merge changesets to main
110+
2. Automated PR is created for version bumps
111+
3. Merge the version PR
112+
4. Packages are automatically published to npm
113+
114+
## Questions?
115+
116+
Feel free to:
117+
- Open an issue for bugs or feature requests
118+
- Start a discussion for questions
119+
- Join our community chat (if available)
120+
121+
## License
122+
123+
By contributing, you agree that your contributions will be licensed under the project's MIT License.

.github/dependabot.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: 2
2+
updates:
3+
# Enable version updates for npm
4+
- package-ecosystem: "npm"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
open-pull-requests-limit: 10
9+
groups:
10+
dependencies:
11+
patterns:
12+
- "*"
13+
exclude-patterns:
14+
- "@types/*"
15+
types:
16+
patterns:
17+
- "@types/*"
18+
19+
# Keep GitHub Actions up to date
20+
- package-ecosystem: "github-actions"
21+
directory: "/"
22+
schedule:
23+
interval: "weekly"

.github/workflows/badges.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Update Badges
2+
3+
on:
4+
workflow_run:
5+
workflows: ["CI", "Publish"]
6+
types:
7+
- completed
8+
push:
9+
branches:
10+
- main
11+
12+
jobs:
13+
update-badges:
14+
name: Update README Badges
15+
runs-on: ubuntu-latest
16+
if: github.event.workflow_run.conclusion == 'success' || github.event_name == 'push'
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Create badges directory
23+
run: mkdir -p .github/badges
24+
25+
- name: Generate CI badge
26+
run: |
27+
echo '{"schemaVersion": 1, "label": "CI", "message": "passing", "color": "success"}' > .github/badges/ci.json
28+
29+
- name: Generate version badge
30+
run: |
31+
VERSION=$(node -p "require('./packages/core/package.json').version")
32+
echo "{\"schemaVersion\": 1, \"label\": \"version\", \"message\": \"v$VERSION\", \"color\": \"blue\"}" > .github/badges/version.json

.github/workflows/ci.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lint-and-type-check:
11+
name: Lint and Type Check
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Bun
19+
uses: oven-sh/setup-bun@v2
20+
with:
21+
bun-version: latest
22+
23+
- name: Install dependencies
24+
run: bun install --frozen-lockfile
25+
26+
- name: Type check packages
27+
run: |
28+
bun run --filter @react-telegram/core tsc --noEmit
29+
bun run --filter @react-telegram/mtcute-adapter tsc --noEmit
30+
31+
- name: Lint check (if configured)
32+
run: |
33+
echo "Add linting when ESLint is configured"
34+
continue-on-error: true
35+
36+
test:
37+
name: Test
38+
runs-on: ubuntu-latest
39+
strategy:
40+
matrix:
41+
node-version: [20.x, 22.x]
42+
43+
steps:
44+
- name: Checkout code
45+
uses: actions/checkout@v4
46+
47+
- name: Setup Bun
48+
uses: oven-sh/setup-bun@v2
49+
with:
50+
bun-version: latest
51+
52+
- name: Install dependencies
53+
run: bun install --frozen-lockfile
54+
55+
- name: Run tests
56+
run: bun test
57+
58+
- name: Run example type checks
59+
run: |
60+
cd packages/examples
61+
bun run tsc --noEmit
62+
63+
build:
64+
name: Build Packages
65+
runs-on: ubuntu-latest
66+
67+
steps:
68+
- name: Checkout code
69+
uses: actions/checkout@v4
70+
71+
- name: Setup Bun
72+
uses: oven-sh/setup-bun@v2
73+
with:
74+
bun-version: latest
75+
76+
- name: Install dependencies
77+
run: bun install --frozen-lockfile
78+
79+
- name: Build core package
80+
run: |
81+
cd packages/core
82+
bun run build
83+
84+
- name: Build adapter package
85+
run: |
86+
cd packages/mtcute-adapter
87+
bun run build
88+
89+
- name: Check build outputs
90+
run: |
91+
ls -la packages/core/dist/
92+
ls -la packages/mtcute-adapter/dist/
93+
94+
- name: Upload build artifacts
95+
uses: actions/upload-artifact@v4
96+
with:
97+
name: build-artifacts
98+
path: |
99+
packages/core/dist/
100+
packages/mtcute-adapter/dist/
101+
102+
examples:
103+
name: Validate Examples
104+
runs-on: ubuntu-latest
105+
106+
steps:
107+
- name: Checkout code
108+
uses: actions/checkout@v4
109+
110+
- name: Setup Bun
111+
uses: oven-sh/setup-bun@v2
112+
with:
113+
bun-version: latest
114+
115+
- name: Install dependencies
116+
run: bun install --frozen-lockfile
117+
118+
- name: Type check examples
119+
run: |
120+
cd packages/examples
121+
bun run tsc --noEmit
122+
123+
- name: Dry run examples (syntax check)
124+
run: |
125+
cd packages/examples
126+
# Check that all example files can be parsed
127+
for file in src/*.tsx; do
128+
echo "Checking $file..."
129+
bun run --dry-run "$file" || exit 1
130+
done

0 commit comments

Comments
 (0)