Tests And Release
Common Checks
Run formatting:
cargo fmt --all -- --check
Run clippy:
cargo clippy --locked --workspace --all-targets --all-features -- -D warnings
Run tests:
cargo test --locked --workspace --all-features
Run docs checks:
mdbook build docs
mdbook test docs
Validate both Compose models:
docker compose -f docker-compose.yml -f docker-compose.sqlite.yml config --quiet
docker compose -f docker-compose.yml -f docker-compose.postgres-minio.yml config --quiet
PostgreSQL and S3 integration tests are ignored by the default suite because they require external services. Supply every listed environment variable and invoke each test explicitly; the tests fail instead of silently skipping when their environment is incomplete:
MIDDEN_TEST_POSTGRES_URL=postgres://midden:midden@localhost:5432/midden \
cargo test --locked db::tests::postgres_migration_smoke_when_configured -- \
--ignored --exact --nocapture
MIDDEN_TEST_S3_BUCKET=midden \
MIDDEN_TEST_S3_REGION=us-east-1 \
MIDDEN_TEST_S3_ENDPOINT=http://127.0.0.1:9000 \
MIDDEN_TEST_S3_ACCESS_KEY_ID=midden \
MIDDEN_TEST_S3_SECRET_ACCESS_KEY=midden-secret \
cargo test --locked storage::tests::s3_storage_round_trip_when_configured -- \
--ignored --exact --nocapture
Check whitespace before committing:
git diff --check
Focused Test Guidance
- Config changes: add unit tests in
src/config.rsand route/admin tests if runtime settings are involved. - Route behavior: add integration-style tests in
src/web/tests.rs. - Upload processing: add focused tests in
src/web/upload.rsorsrc/processing.rs, then route tests when user-visible behavior changes. - Storage: add local backend tests and gated S3 smoke tests when touching S3-specific behavior.
- Auth/config regressions: test rendered links and the admin save path.
Release Basics
For a crate release:
- Update
Cargo.toml. - Update
Cargo.lockthrough a build or metadata command. - Build with
cargo build. - Commit the version bump.
- Create an annotated tag such as
git tag -a v0.6.5 -m "Release v0.6.5". - Push the branch and tags.
- Confirm
git status --shortis clean.
Docker image publishing is handled by the GitHub workflow on main pushes and version tags.