Skip to content

Commit 99e327d

Browse files
docs: fix and extend dev docs
1 parent 42ad516 commit 99e327d

File tree

1 file changed

+79
-3
lines changed

1 file changed

+79
-3
lines changed

docs/docs/dev/developer_guide.md

Lines changed: 79 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ Rust code is linted by running [Clippy](https://github.com/rust-lang/rust-clippy
166166
cargo clippy --all-targets --all
167167
```
168168

169-
Clippy is configured in `clippy.toml` and `.cargo/config.toml`.
169+
Clippy is configured in `.cargo/config.toml`.
170170

171171
### Formatting (code style)
172172

@@ -178,6 +178,82 @@ cargo fmt --all
178178

179179
Rustfmt is configured in `rustfmt.toml`.
180180

181+
### Development scripts (optional)
182+
183+
The project includes a development scripts at `./dev/docker/run` and `./dev/dev` which provide shortcuts for common development tasks. All commands run inside a Docker container:
184+
185+
```bash
186+
# Build in debug mode
187+
./dev/docker/run ./dev/dev b
188+
189+
# Build in release mode
190+
./dev/docker/run ./dev/dev br
191+
192+
# Run in debug mode
193+
./dev/docker/run ./dev/dev r pangraph -- build --help
194+
195+
# Run in release mode
196+
./dev/docker/run ./dev/dev rr pangraph -- build --help
197+
198+
# Run tests
199+
./dev/docker/run ./dev/dev t
200+
201+
# Run unit tests only
202+
./dev/docker/run ./dev/dev tu
203+
204+
# Run integration tests only
205+
./dev/docker/run ./dev/dev ti
206+
207+
# Run linter
208+
./dev/docker/run ./dev/dev l
209+
210+
# Run linter with auto-fixes
211+
./dev/docker/run ./dev/dev lf
212+
213+
# Format code
214+
./dev/docker/run ./dev/dev f
215+
216+
# Run arbitrary command in the container
217+
./dev/docker/run your command here
218+
```
219+
220+
The same docker commands and the same container is used in CI. This setup ensures a consistent, isolated, reproducible environment on local machines and on remotes.
221+
222+
Independently, there are some shortcuts defined in `.cargo/config.toml`. They can used directly with `cargo`:
223+
224+
```toml
225+
[alias]
226+
lint = "-q clippy -q --all-targets --all"
227+
lint-fix = "lint --fix --allow-staged"
228+
test-all = "-q nextest run --success-output=immediate --workspace --cargo-quiet --no-fail-fast --hide-progress-bar --color=always"
229+
test-integration = "test-all --test='*'"
230+
test-unit = "test-all --lib"
231+
upgrade-deps = "-q upgrade --pinned --incompatible --verbose --recursive" # cargo install cargo-edit
232+
233+
b = "build"
234+
br = "build --release"
235+
l = "lint"
236+
lf = "lint-fix"
237+
r = "run --bin"
238+
rr = "run --release --bin"
239+
t = "test-all"
240+
ti = "test-integration"
241+
tu = "test-unit"
242+
u = "upgrade-deps"
243+
244+
```
245+
246+
for example:
247+
248+
```bash
249+
cargo run br # same as cargo run build --release
250+
251+
cargo run lf # same as cargo -q clippy -q --all-targets --all --fix --allow-staged
252+
```
253+
254+
None of that is required, and you can use the canonical `cargo` commands as usual, if you prefer. Feel free to add more shortcuts if you use them!
255+
256+
181257
## Maintenance
182258

183259
### Upgrading Rust
@@ -213,7 +289,7 @@ There are multiple release targets and they are published by updating where the
213289

214290
| Branch | CI workflow | Target |
215291
|----------------------|-----------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
216-
| `release` | [cli.yml](https://github.com/neherlab/pangraph/blob/master/.github/workflows/cli.yml) | Releases Pangraph CLI to [GitHub Releases](https://github.com/neherlab/pangraph/releases) and [DockerHub](https://hub.docker.com/r/neherlab/pangraph) |
292+
| `release-cli` | [cli.yml](https://github.com/neherlab/pangraph/blob/master/.github/workflows/cli.yml) | Releases Pangraph CLI to [GitHub Releases](https://github.com/neherlab/pangraph/releases) and [DockerHub](https://hub.docker.com/r/neherlab/pangraph) |
217293
| `release-pypangraph` | [pypangraph.yml](https://github.com/neherlab/pangraph/blob/master/.github/workflows/pypangraph.yml) | Releases PyPangraph to [PyPI](https://pypi.org/project/pypangraph/) |
218294
| `release-docs` | [docs.yml](https://github.com/neherlab/pangraph/blob/master/.github/workflows/docs.yml) | Releases documentation website to [https://docs.pangraph.org](https://docs.pangraph.org) |
219295

@@ -241,7 +317,7 @@ There are multiple release targets and they are published by updating where the
241317

242318
Having hard times to decide? Read [Semantic Versioning](https://semver.org/).
243319

244-
4. Follow instructions printed by the script. Resolve errors, if any. If finished successfully, follow instructions on how to fast-forward and push the changes to the `release` branch.
320+
4. Follow instructions printed by the script. Resolve errors, if any. If finished successfully, follow instructions on how to fast-forward and push the changes to the `release-cli` branch.
245321

246322
5. Optionally, you can combine the releases of CLI, docs and PyPangraph. Just add more commits to `master` branch and then fast-forward and push them to corresponding branches all together.
247323

0 commit comments

Comments
 (0)