1+ name : CI
2+
3+ on :
4+ push :
5+ branches : [ main, release ]
6+ tags :
7+ - ' release-*'
8+ pull_request :
9+ branches : [ main, release ]
10+
11+ env :
12+ CARGO_TERM_COLOR : always
13+ ARTIFACT_DIR : release-artifacts
14+
15+ jobs :
16+ commit-lint :
17+ name : Lint Commit Messages
18+ runs-on : ubuntu-latest
19+ if : github.event_name == 'pull_request'
20+ steps :
21+ - uses : actions/checkout@v3
22+ with :
23+ fetch-depth : 0
24+
25+ - name : Setup Node.js
26+ uses : actions/setup-node@v3
27+ with :
28+ node-version : ' 16'
29+
30+ - name : Install commitlint
31+ run : |
32+ npm install --save-dev @commitlint/cli @commitlint/config-conventional
33+ echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js
34+
35+ - name : Lint commit messages
36+ run : npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
37+
38+ fmt :
39+ name : Code Formatting
40+ runs-on : ubuntu-latest
41+ steps :
42+ - uses : actions/checkout@v3
43+
44+ - name : Install Rust
45+ uses : dtolnay/rust-toolchain@stable
46+
47+ - name : Check formatting
48+ run : cargo fmt --all -- --check
49+
50+ clippy :
51+ name : Lint with Clippy
52+ runs-on : ubuntu-latest
53+ steps :
54+ - uses : actions/checkout@v3
55+
56+ - name : Install Rust
57+ uses : dtolnay/rust-toolchain@stable
58+
59+ - name : Cache dependencies
60+ uses : actions/cache@v3
61+ with :
62+ path : |
63+ ~/.cargo/registry
64+ ~/.cargo/git
65+ target
66+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
67+ restore-keys : ${{ runner.os }}-cargo-
68+
69+ - name : Run clippy
70+ run : cargo clippy --all-targets --all-features -- -D warnings
71+
72+ test :
73+ name : Run Tests
74+ runs-on : ubuntu-latest
75+ steps :
76+ - uses : actions/checkout@v3
77+
78+ # install nodejs
79+ - name : Setup Node.js
80+ uses : actions/setup-node@v3
81+ with :
82+ node-version : ' 20'
83+
84+ - name : Install uv
85+ uses : astral-sh/setup-uv@v5
86+
87+ - name : Install Rust
88+ uses : dtolnay/rust-toolchain@stable
89+
90+ - name : Set up Python
91+ run : uv python install
92+
93+ - name : Create venv for python
94+ run : uv venv
95+
96+ - name : Cache dependencies
97+ uses : actions/cache@v3
98+ with :
99+ path : |
100+ ~/.cargo/registry
101+ ~/.cargo/git
102+ target
103+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
104+ restore-keys : ${{ runner.os }}-cargo-
105+
106+ - name : Run tests
107+ run : cargo test --all-features
108+
109+ release :
110+ name : Release crates
111+ runs-on : ubuntu-latest
112+ if : github.ref == 'refs/heads/release' || startsWith(github.ref, 'refs/tags/release')
113+ needs : [fmt, clippy, test]
114+ steps :
115+ - uses : actions/checkout@v3
116+
117+ - name : Install Rust
118+ uses : dtolnay/rust-toolchain@stable
119+
120+ - name : Cache dependencies
121+ uses : actions/cache@v3
122+ with :
123+ path : |
124+ ~/.cargo/registry
125+ ~/.cargo/git
126+ target
127+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
128+ restore-keys : ${{ runner.os }}-cargo-
129+
130+ - name : Cargo login
131+ run : cargo login ${{ secrets.CRATES_TOKEN }}
132+
133+ - name : Publish macros dry run
134+ run : cargo publish -p rmcp-macros --dry-run
135+ continue-on-error : true
136+
137+ - name : Publish rmcp dry run
138+ run : cargo publish -p rmcp --dry-run
139+ continue-on-error : true
140+
141+ - name : Publish macro
142+ if : ${{ startsWith(github.ref, 'refs/tags/release') }}
143+ continue-on-error : true
144+ run : cargo publish -p rmcp-macros
145+
146+ - name : Publish rmcp
147+ if : ${{ startsWith(github.ref, 'refs/tags/release') }}
148+ continue-on-error : true
149+ run : cargo publish -p rmcp
0 commit comments