Skip to content

Commit 09b3914

Browse files
Copilotmythz
andcommitted
Add documentation, CI workflow, and contributing guidelines
Co-authored-by: mythz <[email protected]>
1 parent 6d48ab9 commit 09b3914

File tree

3 files changed

+221
-0
lines changed

3 files changed

+221
-0
lines changed

.github/workflows/ci.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
test:
14+
name: Test
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
rust:
19+
- stable
20+
- beta
21+
steps:
22+
- uses: actions/checkout@v3
23+
24+
- name: Install Rust
25+
uses: dtolnay/rust-toolchain@master
26+
with:
27+
toolchain: ${{ matrix.rust }}
28+
29+
- name: Cache cargo registry
30+
uses: actions/cache@v3
31+
with:
32+
path: ~/.cargo/registry
33+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
34+
35+
- name: Cache cargo index
36+
uses: actions/cache@v3
37+
with:
38+
path: ~/.cargo/git
39+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
40+
41+
- name: Cache cargo build
42+
uses: actions/cache@v3
43+
with:
44+
path: target
45+
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
46+
47+
- name: Build
48+
run: cargo build --verbose
49+
50+
- name: Run tests
51+
run: cargo test --verbose
52+
53+
fmt:
54+
name: Rustfmt
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v3
58+
59+
- name: Install Rust
60+
uses: dtolnay/rust-toolchain@stable
61+
with:
62+
components: rustfmt
63+
64+
- name: Check formatting
65+
run: cargo fmt -- --check
66+
67+
clippy:
68+
name: Clippy
69+
runs-on: ubuntu-latest
70+
steps:
71+
- uses: actions/checkout@v3
72+
73+
- name: Install Rust
74+
uses: dtolnay/rust-toolchain@stable
75+
with:
76+
components: clippy
77+
78+
- name: Run clippy
79+
run: cargo clippy -- -D warnings

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [0.1.0] - 2024-11-03
9+
10+
### Added
11+
- Initial release of ServiceStack Rust client library
12+
- `JsonServiceClient` for making typed API requests to ServiceStack services
13+
- Support for all HTTP methods (GET, POST, PUT, DELETE, PATCH)
14+
- `ServiceStackRequest` trait for defining request DTOs
15+
- `ServiceStackResponse` trait for defining response DTOs
16+
- Bearer token authentication support
17+
- Custom error types with detailed error messages
18+
- Async/await support using tokio and reqwest
19+
- Comprehensive test suite with unit and integration tests
20+
- Multiple usage examples demonstrating all features
21+
- Complete API documentation
22+
- CI/CD workflow for automated testing
23+
24+
### Features
25+
- Type-safe API requests using Rust DTOs
26+
- Follows ServiceStack REST API conventions
27+
- Customizable HTTP client configuration
28+
- Flexible error handling
29+
- Support for custom HTTP methods in request DTOs
30+
- Raw request method for advanced use cases

CONTRIBUTING.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Contributing to ServiceStack Rust
2+
3+
Thank you for your interest in contributing to the ServiceStack Rust client library!
4+
5+
## Getting Started
6+
7+
1. Fork the repository
8+
2. Clone your fork: `git clone https://github.com/YOUR_USERNAME/servicestack-rust.git`
9+
3. Create a branch: `git checkout -b feature/your-feature-name`
10+
11+
## Development Setup
12+
13+
### Prerequisites
14+
15+
- Rust 1.70 or later
16+
- Cargo (comes with Rust)
17+
18+
### Building the Project
19+
20+
```bash
21+
cargo build
22+
```
23+
24+
### Running Tests
25+
26+
```bash
27+
# Run all tests
28+
cargo test
29+
30+
# Run with output
31+
cargo test -- --nocapture
32+
33+
# Run specific test
34+
cargo test test_name
35+
```
36+
37+
### Running Examples
38+
39+
```bash
40+
cargo run --example basic_usage
41+
cargo run --example complete_example
42+
```
43+
44+
## Code Quality
45+
46+
Before submitting a PR, please ensure:
47+
48+
### 1. Format your code
49+
50+
```bash
51+
cargo fmt
52+
```
53+
54+
### 2. Check for linting issues
55+
56+
```bash
57+
cargo clippy -- -D warnings
58+
```
59+
60+
### 3. All tests pass
61+
62+
```bash
63+
cargo test
64+
```
65+
66+
### 4. Build in release mode
67+
68+
```bash
69+
cargo build --release
70+
```
71+
72+
## Pull Request Process
73+
74+
1. Update the README.md with details of changes if applicable
75+
2. Add tests for any new functionality
76+
3. Ensure all tests pass
77+
4. Update examples if the API has changed
78+
5. Write clear commit messages
79+
6. Create a pull request with a clear description of the changes
80+
81+
## Code Style
82+
83+
- Follow Rust naming conventions
84+
- Use meaningful variable and function names
85+
- Add documentation comments for public APIs
86+
- Keep functions focused and small
87+
- Write tests for new features
88+
89+
## Adding New Features
90+
91+
When adding new features:
92+
93+
1. Add unit tests in the relevant module
94+
2. Add integration tests in the `tests/` directory if needed
95+
3. Update documentation and examples
96+
4. Consider backward compatibility
97+
98+
## Reporting Issues
99+
100+
When reporting issues, please include:
101+
102+
- Rust version (`rustc --version`)
103+
- Operating system
104+
- Minimal code example that reproduces the issue
105+
- Expected behavior
106+
- Actual behavior
107+
108+
## Questions?
109+
110+
Feel free to open an issue for any questions about contributing.
111+
112+
Thank you for contributing to ServiceStack Rust!

0 commit comments

Comments
 (0)