Skip to content

Commit bf76b9e

Browse files
committed
refactor/doc: Prepare for v0.1.0 release
1 parent 31d1b42 commit bf76b9e

File tree

11 files changed

+912
-1119
lines changed

11 files changed

+912
-1119
lines changed

.github/workflows/ci.yml

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ trunk, main ]
6+
paths:
7+
- 'src/**'
8+
- 'examples/**'
9+
- 'Cargo.toml'
10+
- 'Cargo.lock'
11+
- '.github/workflows/ci.yml'
12+
pull_request:
13+
branches: [ trunk, main ]
14+
paths:
15+
- 'src/**'
16+
- 'examples/**'
17+
- 'Cargo.toml'
18+
- 'Cargo.lock'
19+
- '.github/workflows/ci.yml'
20+
21+
env:
22+
CARGO_TERM_COLOR: always
23+
24+
jobs:
25+
test:
26+
name: Test
27+
runs-on: ${{ matrix.os }}
28+
strategy:
29+
matrix:
30+
os: [ubuntu-latest, windows-latest, macos-latest]
31+
rust: [stable, beta]
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Install Rust
36+
uses: dtolnay/rust-toolchain@master
37+
with:
38+
toolchain: ${{ matrix.rust }}
39+
40+
- name: Cache cargo registry
41+
uses: actions/cache@v4
42+
with:
43+
path: ~/.cargo/registry
44+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
45+
46+
- name: Cache cargo index
47+
uses: actions/cache@v4
48+
with:
49+
path: ~/.cargo/git
50+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
51+
52+
- name: Cache cargo build
53+
uses: actions/cache@v4
54+
with:
55+
path: target
56+
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
57+
58+
- name: Run tests
59+
run: cargo test --verbose
60+
61+
- name: Run doc tests
62+
run: cargo test --doc --verbose
63+
64+
fmt:
65+
name: Rustfmt
66+
runs-on: ubuntu-latest
67+
steps:
68+
- uses: actions/checkout@v4
69+
70+
- name: Install Rust
71+
uses: dtolnay/rust-toolchain@stable
72+
with:
73+
components: rustfmt
74+
75+
- name: Check formatting
76+
run: cargo fmt --all -- --check
77+
78+
clippy:
79+
name: Clippy
80+
runs-on: ubuntu-latest
81+
steps:
82+
- uses: actions/checkout@v4
83+
84+
- name: Install Rust
85+
uses: dtolnay/rust-toolchain@stable
86+
with:
87+
components: clippy
88+
89+
- name: Run clippy
90+
run: cargo clippy --all-targets --all-features -- -D warnings
91+
92+
examples:
93+
name: Examples
94+
runs-on: ubuntu-latest
95+
steps:
96+
- uses: actions/checkout@v4
97+
98+
- name: Install Rust
99+
uses: dtolnay/rust-toolchain@stable
100+
101+
- name: Check examples
102+
run: cargo check --examples
103+
104+
- name: Build examples
105+
run: cargo build --examples
106+
107+
- name: Run enemy example
108+
run: cargo run --example enemy_example
109+
110+
coverage:
111+
name: Code Coverage
112+
runs-on: ubuntu-latest
113+
steps:
114+
- uses: actions/checkout@v4
115+
116+
- name: Install Rust
117+
uses: dtolnay/rust-toolchain@stable
118+
119+
- name: Install cargo-tarpaulin
120+
run: cargo install cargo-tarpaulin
121+
122+
- name: Generate coverage
123+
run: cargo tarpaulin --verbose --all-features --workspace --timeout 120 --out xml
124+
125+
- name: Upload coverage to Codecov
126+
uses: codecov/codecov-action@v4
127+
with:
128+
files: ./cobertura.xml
129+
fail_ci_if_error: false
130+
131+
msrv:
132+
name: Minimum Supported Rust Version
133+
runs-on: ubuntu-latest
134+
steps:
135+
- uses: actions/checkout@v4
136+
137+
- name: Install Rust 1.85.0
138+
uses: dtolnay/rust-toolchain@master
139+
with:
140+
toolchain: "1.85.0"
141+
142+
- name: Check with MSRV
143+
run: cargo check --all-features
144+
145+
wasm:
146+
name: WebAssembly
147+
runs-on: ubuntu-latest
148+
steps:
149+
- uses: actions/checkout@v4
150+
151+
- name: Install Rust
152+
uses: dtolnay/rust-toolchain@stable
153+
with:
154+
targets: wasm32-unknown-unknown
155+
156+
- name: Check wasm32-unknown-unknown
157+
run: cargo check --target wasm32-unknown-unknown --lib
158+
159+
- name: Build wasm32-unknown-unknown
160+
run: cargo build --target wasm32-unknown-unknown --lib --release

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
publish:
13+
name: Publish to crates.io
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Install Rust
19+
uses: dtolnay/rust-toolchain@stable
20+
21+
- name: Run tests
22+
run: cargo test --verbose
23+
24+
- name: Publish
25+
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
26+
27+
create-release:
28+
name: Create GitHub Release
29+
runs-on: ubuntu-latest
30+
needs: publish
31+
steps:
32+
- uses: actions/checkout@v4
33+
34+
- name: Extract version from tag
35+
id: get_version
36+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
37+
38+
- name: Create Release
39+
uses: softprops/action-gh-release@v1
40+
with:
41+
name: Release ${{ steps.get_version.outputs.VERSION }}
42+
body: |
43+
See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/trunk/CHANGELOG.md) for details.
44+
draft: false
45+
prerelease: false
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CHANGELOG.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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] - 2025-11-18
9+
10+
### Added
11+
12+
- Initial release of `item_pool`
13+
- `PoolItem` trait for type-safe pool items requiring `Hash + Eq + Sync`
14+
- `ItemPool<T>` trait for managing pools of reusable items
15+
- `pool()` - Access to main item storage
16+
- `put()` - Add items to the pool
17+
- `remove_one()` - Remove and return a single random item
18+
- `remove_many()` - Remove multiple items (duplicates possible)
19+
- `remove_set()` - Remove a set of unique items without duplicates
20+
- `RecyclingItemPool<T>` trait extending `ItemPool` with discard/recycle functionality
21+
- `get_discard_pool()` - Access to discard storage
22+
- `discard_one()` - Move items to discard pool temporarily
23+
- `recycle_discarded()` - Return all discarded items to main pool
24+
- `get_set()` - Get unique items with automatic recycling
25+
- WebAssembly support via `wasm32-unknown-unknown` target
26+
- Comprehensive documentation with examples
27+
- Full test coverage (unit tests and doc tests)
28+
- Example implementation (`examples/enemy_example.rs`)
29+
30+
### Dependencies
31+
32+
- `rand` ^0.9.0 for random item selection
33+
- `getrandom` ^0.3.4 with WASM support
34+
35+
[0.1.0]: https://github.com/caniko/item-pool/releases/tag/v0.1.0

0 commit comments

Comments
 (0)