diff --git a/.github/workflows/common-ci.yml b/.github/workflows/common-ci.yml new file mode 100644 index 0000000..a0e577f --- /dev/null +++ b/.github/workflows/common-ci.yml @@ -0,0 +1,60 @@ +name: 'common-ci' + +on: + workflow_call: + inputs: + module: + required: false + type: string + default: '.' + go_version: + required: false + type: string + default: '1.20.0' + +permissions: + contents: read + +jobs: + tests: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v3 + with: + fetch-depth: 1 + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: ${{ inputs.go_version }} + - name: Download modules + working-directory: ${{ inputs.module }} + run: go mod download + - name: Run tests + working-directory: ${{ inputs.modulemodule }} + run: go test -v -race -failfast -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt ./... + - name: Codecov + uses: codecov/codecov-action@v3 + with: + fail_ci_if_error: false + flags: ${{ inputs.module }} + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v3 + with: + fetch-depth: 1 + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: ${{ inputs.go_version }} + - name: Install lint + working-directory: ${{ inputs.module }} + run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2 + - name: Run lint + working-directory: ${{ inputs.module }} + run: golangci-lint run diff --git a/.github/workflows/config-ci.yml b/.github/workflows/config-ci.yml new file mode 100644 index 0000000..0f86cb2 --- /dev/null +++ b/.github/workflows/config-ci.yml @@ -0,0 +1,31 @@ +name: "config-ci" + +on: + push: + branches: + - "feat**" + - "fix**" + - "hotfix**" + - "chore**" + paths: + - "config/**.go" + - "config/go.mod" + - "config/go.sum" + pull_request: + types: + - opened + - synchronize + - reopened + branches: + - main + paths: + - "config/**.go" + - "config/go.mod" + - "config/go.sum" + +jobs: + ci: + uses: ./.github/workflows/common-ci.yml + secrets: inherit + with: + module: "config" diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..735b8be --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,51 @@ +name: coverage + +on: + push: + branches: + - main + workflow_call: + inputs: + go_version: + required: false + type: string + default: '1.20.0' + +permissions: + contents: write + pull-requests: write + +jobs: + coverage: + strategy: + matrix: + include: + - module: "config" + - module: "healthcheck" + - module: "httpclient" + - module: "generate" + - module: "log" + - module: "trace" + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v3 + with: + fetch-depth: 1 + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: ${{ inputs.go_version }} + - name: Download modules for ${{ matrix.module }} + working-directory: ${{ matrix.module }} + run: go mod download + - name: Run tests for ${{ matrix.module }} + working-directory: ${{ matrix.module }} + run: go test -v -race -failfast -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt ./... + - name: Codecov for ${{ matrix.module }} + uses: codecov/codecov-action@v3 + with: + fail_ci_if_error: false + flags: ${{ matrix.module }} + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/generate-ci.yml b/.github/workflows/generate-ci.yml new file mode 100644 index 0000000..5b944f5 --- /dev/null +++ b/.github/workflows/generate-ci.yml @@ -0,0 +1,31 @@ +name: "generate-ci" + +on: + push: + branches: + - "feat**" + - "fix**" + - "hotfix**" + - "chore**" + paths: + - "generate/**.go" + - "generate/go.mod" + - "generate/go.sum" + pull_request: + types: + - opened + - synchronize + - reopened + branches: + - main + paths: + - "generate/**.go" + - "generate/go.mod" + - "generate/go.sum" + +jobs: + ci: + uses: ./.github/workflows/common-ci.yml + secrets: inherit + with: + module: "generate" diff --git a/.github/workflows/healthcheck-ci.yml b/.github/workflows/healthcheck-ci.yml new file mode 100644 index 0000000..23b890f --- /dev/null +++ b/.github/workflows/healthcheck-ci.yml @@ -0,0 +1,31 @@ +name: "healthcheck-ci" + +on: + push: + branches: + - "feat**" + - "fix**" + - "hotfix**" + - "chore**" + paths: + - "healthcheck/**.go" + - "healthcheck/go.mod" + - "healthcheck/go.sum" + pull_request: + types: + - opened + - synchronize + - reopened + branches: + - main + paths: + - "healthcheck/**.go" + - "healthcheck/go.mod" + - "healthcheck/go.sum" + +jobs: + ci: + uses: ./.github/workflows/common-ci.yml + secrets: inherit + with: + module: "healthcheck" diff --git a/.github/workflows/httpclient-ci.yml b/.github/workflows/httpclient-ci.yml new file mode 100644 index 0000000..e4c2681 --- /dev/null +++ b/.github/workflows/httpclient-ci.yml @@ -0,0 +1,31 @@ +name: "httpclient-ci" + +on: + push: + branches: + - "feat**" + - "fix**" + - "hotfix**" + - "chore**" + paths: + - "httpclient/**.go" + - "httpclient/go.mod" + - "httpclient/go.sum" + pull_request: + types: + - opened + - synchronize + - reopened + branches: + - main + paths: + - "httpclient/**.go" + - "httpclient/go.mod" + - "httpclient/go.sum" + +jobs: + ci: + uses: ./.github/workflows/common-ci.yml + secrets: inherit + with: + module: "httpclient" diff --git a/.github/workflows/log-ci.yml b/.github/workflows/log-ci.yml new file mode 100644 index 0000000..dfc3518 --- /dev/null +++ b/.github/workflows/log-ci.yml @@ -0,0 +1,31 @@ +name: "log-ci" + +on: + push: + branches: + - "feat**" + - "fix**" + - "hotfix**" + - "chore**" + paths: + - "log/**.go" + - "log/go.mod" + - "log/go.sum" + pull_request: + types: + - opened + - synchronize + - reopened + branches: + - main + paths: + - "log/**.go" + - "log/go.mod" + - "log/go.sum" + +jobs: + ci: + uses: ./.github/workflows/common-ci.yml + secrets: inherit + with: + module: "log" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..8fd94af --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,22 @@ +name: release + +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: google-github-actions/release-please-action@v3 + with: + command: manifest + monorepo-tags: true + separate-pull-requests: true + release-type: "go" + tag-separator: "/" diff --git a/.github/workflows/trace-ci.yml b/.github/workflows/trace-ci.yml new file mode 100644 index 0000000..54ab514 --- /dev/null +++ b/.github/workflows/trace-ci.yml @@ -0,0 +1,31 @@ +name: "trace-ci" + +on: + push: + branches: + - "feat**" + - "fix**" + - "hotfix**" + - "chore**" + paths: + - "trace/**.go" + - "trace/go.mod" + - "trace/go.sum" + pull_request: + types: + - opened + - synchronize + - reopened + branches: + - main + paths: + - "trace/**.go" + - "trace/go.mod" + - "trace/go.sum" + +jobs: + ci: + uses: ./.github/workflows/common-ci.yml + secrets: inherit + with: + module: "trace" diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/README.md b/README.md index 118fcb5..83e297e 100644 --- a/README.md +++ b/README.md @@ -1 +1,29 @@ -# yokai \ No newline at end of file +# Yokai + +> Simple, modular, and observable Go framework. + +
+ +
+ +## Documentation + +Yokai's documentation will be available soon. + +## Modules + +| Module | Description | +|------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------| +| [config](modules/config) | Config module based on [Viper](https://github.com/spf13/viper) | +| [generate](modules/generate) | Generation module based on [Google UUID](https://github.com/google/uuid) | +| [healthcheck](modules/healthcheck) | Health check module compatible with [K8s probes](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/) | +| [httpclient](modules/httpclient) | Http client module based on [net/http](https://pkg.go.dev/net/http) | +| [log](modules/log) | Logging module based on [Zerolog](https://github.com/rs/zerolog) | +| [trace](modules/trace) | Tracing module based on [OpenTelemetry](https://github.com/open-telemetry/opentelemetry-go) | + +## Contributing + +This repository uses [release-please](https://github.com/googleapis/release-please) to automate Yokai's modules release process. + +> [!IMPORTANT] +> You must provide [atomic](https://en.wikipedia.org/wiki/Atomic_commit#Revision_control) and [conventional](https://www.conventionalcommits.org/en/v1.0.0/) commits, since the release process uses them to determinate the releases version and notes to perform. diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..3491d5a --- /dev/null +++ b/codecov.yml @@ -0,0 +1,10 @@ +coverage: + status: + project: + default: + target: 80% + threshold: 1% + patch: + default: + target: 80% + threshold: 1% diff --git a/docs/images/yokai.png b/docs/images/yokai.png new file mode 100644 index 0000000..df18dbd Binary files /dev/null and b/docs/images/yokai.png differ diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..b6a6d26 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,4 @@ +{ + "separate-pull-requests": true, + "packages": {} +}