Refactor project structure: modularized code into pkg and cmd directories, added unit tests, improved CI/CD pipeline, and enhanced documentation.

This commit is contained in:
2026-02-23 17:17:01 +01:00
parent 2077d4132b
commit 9432bf6758
9 changed files with 260 additions and 25 deletions

View File

@@ -55,6 +55,12 @@ Expected JSON payload (simplified):
Note: data is only kept in-memory and will be reset on restart.
## Project Structure
- `cmd/diunwebhook/` — main application source and tests
- `static/` — static assets
- `Dockerfile`, `docker-compose.yml`, `go.mod`, `go.sum` — project config/build files
## Development
- Code: `main.go`
- Static assets: `static/`
@@ -65,5 +71,19 @@ Note: data is only kept in-memory and will be reset on restart.
- Persistence is not implemented; hook up a store (e.g., BoltDB/Redis/Postgres) if you need durability.
- Consider adding auth, rate limiting, or a secret/token on the webhook endpoint if exposed publicly.
## Testing
Run unit tests and check coverage:
```bash
go test -v -cover
```
Aim for 8090% coverage. Coverage below 80% will emit a warning in CI but will not fail the pipeline.
## CI/CD with Gitea Actions
A sample Gitea Actions workflow is provided in `.gitea/workflows/ci.yml` to automate build, test, and coverage checks.
## License
MIT — see `LICENSE`.