Skip to content

Commit

Permalink
feat(main): CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ekkinox committed Jan 10, 2024
1 parent 3b899c3 commit 7937ba0
Show file tree
Hide file tree
Showing 14 changed files with 363 additions and 1 deletion.
60 changes: 60 additions & 0 deletions .github/workflows/common-ci.yml
Original file line number Diff line number Diff line change
@@ -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
31 changes: 31 additions & 0 deletions .github/workflows/config-ci.yml
Original file line number Diff line number Diff line change
@@ -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"
51 changes: 51 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -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 }}
31 changes: 31 additions & 0 deletions .github/workflows/generate-ci.yml
Original file line number Diff line number Diff line change
@@ -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"
31 changes: 31 additions & 0 deletions .github/workflows/healthcheck-ci.yml
Original file line number Diff line number Diff line change
@@ -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"
31 changes: 31 additions & 0 deletions .github/workflows/httpclient-ci.yml
Original file line number Diff line number Diff line change
@@ -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"
31 changes: 31 additions & 0 deletions .github/workflows/log-ci.yml
Original file line number Diff line number Diff line change
@@ -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"
22 changes: 22 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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: "/"
31 changes: 31 additions & 0 deletions .github/workflows/trace-ci.yml
Original file line number Diff line number Diff line change
@@ -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"
1 change: 1 addition & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,29 @@
# yokai
# Yokai

> Simple, modular, and observable Go framework.
<p align="center">
<img src="docs/images/yokai.png" width="350" height="350" />
</p>

## 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.
10 changes: 10 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
coverage:
status:
project:
default:
target: 80%
threshold: 1%
patch:
default:
target: 80%
threshold: 1%
Binary file added docs/images/yokai.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"separate-pull-requests": true,
"packages": {}
}

0 comments on commit 7937ba0

Please sign in to comment.