Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
zig-version: ['0.13.0', '0.14.0']
steps:
- uses: actions/checkout@v4

- name: Setup Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: ${{ matrix.zig-version }}

- name: Run tests
run: zig build test

- name: Build examples
run: |
zig build example
zig build advanced

- name: Check formatting
run: zig fmt --check src/ examples/
50 changes: 50 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Contributing to ServiceStack Zig

Thank you for your interest in contributing to the ServiceStack Zig client library!

## Development Setup

1. Install Zig 0.13.0 or later from [ziglang.org](https://ziglang.org/download/)
2. Clone the repository
3. Run tests: `zig build test`
4. Run examples: `zig build example`

## Building

```bash
# Build the library
zig build

# Run tests
zig build test

# Run the basic example
zig build example
```

## Code Style

- Follow the Zig standard library conventions
- Use `zig fmt` to format your code
- Add tests for new functionality
- Document public APIs with doc comments

## Testing

All new features should include appropriate tests. Run the test suite before submitting:

```bash
zig build test
```

## Submitting Changes

1. Fork the repository
2. Create a feature branch
3. Make your changes with tests
4. Ensure all tests pass
5. Submit a pull request

## Questions?

Feel free to open an issue if you have questions or need help with your contribution.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 ServiceStack

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
152 changes: 152 additions & 0 deletions PUBLISHING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
# Publishing to Zigistry

This document describes the setup for publishing the ServiceStack Zig library to Zigistry.

## Package Structure

The package is structured according to Zigistry requirements:

### Required Files

1. **build.zig.zon** - Package metadata file
- Package name: `servicestack`
- Version: `0.1.0`
- Description: ServiceStack HTTP Client Library for Zig
- Minimum Zig version: `0.13.0`
- License: MIT
- Paths: Specifies which files are included in the package

2. **build.zig** - Build configuration
- Defines the `servicestack` module
- Sets up tests with `zig build test`
- Provides example builds with `zig build example` and `zig build advanced`
- Uses standard Zig build system conventions

3. **src/lib.zig** - Main library file
- Exports the public API
- Includes documentation comments
- Contains unit tests

4. **LICENSE** - MIT License file

5. **README.md** - Package documentation
- Installation instructions
- Usage examples
- API reference

### Additional Files

- **CONTRIBUTING.md** - Contributor guidelines
- **examples/** - Example code demonstrating usage
- `basic.zig` - Simple examples
- `advanced.zig` - Comprehensive usage
- **.github/workflows/ci.yml** - GitHub Actions CI/CD

## How to Publish

### Step 1: Prepare Release

1. Update version in `build.zig.zon`
2. Update README.md with any changes
3. Ensure all tests pass: `zig build test`
4. Commit all changes

### Step 2: Create Git Tag

```bash
git tag v0.1.0
git push origin v0.1.0
```

### Step 3: Submit to Zigistry

Follow the Zigistry submission process:

1. Visit [zigistry.dev](https://zigistry.dev) (when available)
2. Submit the package with the GitHub repository URL
3. The package manager will use the git tag to fetch the code
4. Zigistry will calculate the hash for the tarball

### Step 4: Using the Package

Once published, users can add it to their projects:

```zig
// build.zig.zon
.{
.name = "my-project",
.version = "0.1.0",
.dependencies = .{
.servicestack = .{
.url = "https://github.com/ServiceStack/servicestack-zig/archive/v0.1.0.tar.gz",
.hash = "1220...", // Hash provided by Zigistry
},
},
}
```

## Package Features

### HTTP Client

The package provides a complete HTTP client for ServiceStack services:

- **GET** requests
- **POST** requests with JSON body
- **PUT** requests with JSON body
- **DELETE** requests
- Automatic JSON content-type headers
- Error handling
- Memory management with allocators

### Testing

Run tests with:
```bash
zig build test
```

Tests include:
- Client initialization
- URL construction
- Basic functionality tests

### Examples

Two examples are provided:

1. **Basic Example** (`zig build example`)
- Simple GET and POST requests
- Basic error handling

2. **Advanced Example** (`zig build advanced`)
- All HTTP methods
- Comprehensive error handling
- JSON data examples

## Continuous Integration

GitHub Actions CI is configured to:
- Test on multiple Zig versions (0.13.0, 0.14.0)
- Run all tests
- Build all examples
- Check code formatting

## Versioning

The package follows Semantic Versioning:
- MAJOR version for incompatible API changes
- MINOR version for backwards-compatible functionality
- PATCH version for backwards-compatible bug fixes

Current version: **0.1.0** (Initial release)

## Support

For issues or questions:
- Open an issue on GitHub
- See CONTRIBUTING.md for contribution guidelines

## License

This package is released under the MIT License. See LICENSE file for details.
Loading
Loading