Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Bug report
about: Report a reproducible problem
labels: bug
---

## Summary

## Steps to Reproduce
1.
2.
3.

## Expected

## Actual

## Environment
- Go version:
- OS:
- Commit/Tag:

## Additional Context
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: Documentation
about: Request documentation changes or additions
labels: documentation
---

## Summary

## Proposed Change

## References
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: Feature request
about: Propose an enhancement
labels: enhancement
---

## Problem

## Proposal

## Alternatives Considered

## Additional Context
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "gomod"
directory: "/examples/hello-mysql"
schedule:
interval: "weekly"
11 changes: 11 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Summary
-

## Changes
-

## Testing
-

## Notes
-
27 changes: 27 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: codeql

on:
push:
branches:
- main
pull_request:

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: ["go"]
steps:
- uses: actions/checkout@v4
- uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
- uses: github/codeql-action/autobuild@v3
- uses: github/codeql-action/analyze@v3
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ go test ./...

## Guidelines

- Contribute via fork + pull request (recommended). Direct pushes to the main repo are restricted.
- Follow Go formatting with `gofmt`.
- Run `make fmt` before committing.
- Run `make lint` for lint checks.
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ modkit is a Go-idiomatic backend service framework built around an explicit modu

This repository is in early MVP implementation. APIs and structure may change before v0.1.0.

## API Stability

Until `v0.1.0`, public APIs may change without notice. After `v0.1.0`, changes will follow semantic versioning.

## What Is modkit?

modkit provides:
Expand Down Expand Up @@ -33,6 +37,10 @@ Example app:

- See `docs/tooling.md`

## Contributing

Contributions are welcome via fork + pull request. Direct pushes to the main repo are restricted.

## Architecture Overview

- **module**: metadata for imports/providers/controllers/exports.
Expand Down
37 changes: 37 additions & 0 deletions examples/hello-mysql/internal/seed/seed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ func TestSeed_InsertsDefaultUsersIfEmpty(t *testing.T) {
_ = container.Terminate(ctx)
}()

if err := waitForMySQL(ctx, dsn); err != nil {
t.Fatalf("mysql not ready: %v", err)
}

db, err := mysql.Open(dsn)
if err != nil {
t.Fatalf("open db: %v", err)
Expand Down Expand Up @@ -88,3 +92,36 @@ func startMySQL(t *testing.T, ctx context.Context) (testcontainers.Container, st
dsn := "root:password@tcp(" + host + ":" + port.Port() + ")/app?parseTime=true&multiStatements=true"
return container, dsn
}

func waitForMySQL(ctx context.Context, dsn string) error {
deadline, ok := ctx.Deadline()
if !ok {
deadline = time.Now().Add(30 * time.Second)
}

for {
db, err := mysql.Open(dsn)
if err == nil {
pingCtx, cancel := context.WithTimeout(ctx, 2*time.Second)
pingErr := db.PingContext(pingCtx)
cancel()
_ = db.Close()
if pingErr == nil {
return nil
}
}

if time.Now().After(deadline) {
if err != nil {
return err
}
return context.DeadlineExceeded
}

select {
case <-ctx.Done():
return ctx.Err()
case <-time.After(500 * time.Millisecond):
}
}
}
Loading