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:
20
README.md
20
README.md
@@ -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 80–90% 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`.
|
||||
|
||||
Reference in New Issue
Block a user