Skip to content

Commit 7937ba0

Browse files
committed
feat(main): CI
1 parent 3b899c3 commit 7937ba0

File tree

14 files changed

+363
-1
lines changed

14 files changed

+363
-1
lines changed

.github/workflows/common-ci.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: 'common-ci'
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
module:
7+
required: false
8+
type: string
9+
default: '.'
10+
go_version:
11+
required: false
12+
type: string
13+
default: '1.20.0'
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
tests:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout repo
23+
uses: actions/checkout@v3
24+
with:
25+
fetch-depth: 1
26+
- name: Set up Go
27+
uses: actions/setup-go@v4
28+
with:
29+
go-version: ${{ inputs.go_version }}
30+
- name: Download modules
31+
working-directory: ${{ inputs.module }}
32+
run: go mod download
33+
- name: Run tests
34+
working-directory: ${{ inputs.modulemodule }}
35+
run: go test -v -race -failfast -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt ./...
36+
- name: Codecov
37+
uses: codecov/codecov-action@v3
38+
with:
39+
fail_ci_if_error: false
40+
flags: ${{ inputs.module }}
41+
env:
42+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
43+
44+
lint:
45+
runs-on: ubuntu-latest
46+
steps:
47+
- name: Checkout repo
48+
uses: actions/checkout@v3
49+
with:
50+
fetch-depth: 1
51+
- name: Set up Go
52+
uses: actions/setup-go@v4
53+
with:
54+
go-version: ${{ inputs.go_version }}
55+
- name: Install lint
56+
working-directory: ${{ inputs.module }}
57+
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2
58+
- name: Run lint
59+
working-directory: ${{ inputs.module }}
60+
run: golangci-lint run

.github/workflows/config-ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "config-ci"
2+
3+
on:
4+
push:
5+
branches:
6+
- "feat**"
7+
- "fix**"
8+
- "hotfix**"
9+
- "chore**"
10+
paths:
11+
- "config/**.go"
12+
- "config/go.mod"
13+
- "config/go.sum"
14+
pull_request:
15+
types:
16+
- opened
17+
- synchronize
18+
- reopened
19+
branches:
20+
- main
21+
paths:
22+
- "config/**.go"
23+
- "config/go.mod"
24+
- "config/go.sum"
25+
26+
jobs:
27+
ci:
28+
uses: ./.github/workflows/common-ci.yml
29+
secrets: inherit
30+
with:
31+
module: "config"

.github/workflows/coverage.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: coverage
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_call:
8+
inputs:
9+
go_version:
10+
required: false
11+
type: string
12+
default: '1.20.0'
13+
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
18+
jobs:
19+
coverage:
20+
strategy:
21+
matrix:
22+
include:
23+
- module: "config"
24+
- module: "healthcheck"
25+
- module: "httpclient"
26+
- module: "generate"
27+
- module: "log"
28+
- module: "trace"
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout repo
32+
uses: actions/checkout@v3
33+
with:
34+
fetch-depth: 1
35+
- name: Set up Go
36+
uses: actions/setup-go@v4
37+
with:
38+
go-version: ${{ inputs.go_version }}
39+
- name: Download modules for ${{ matrix.module }}
40+
working-directory: ${{ matrix.module }}
41+
run: go mod download
42+
- name: Run tests for ${{ matrix.module }}
43+
working-directory: ${{ matrix.module }}
44+
run: go test -v -race -failfast -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt ./...
45+
- name: Codecov for ${{ matrix.module }}
46+
uses: codecov/codecov-action@v3
47+
with:
48+
fail_ci_if_error: false
49+
flags: ${{ matrix.module }}
50+
env:
51+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/generate-ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "generate-ci"
2+
3+
on:
4+
push:
5+
branches:
6+
- "feat**"
7+
- "fix**"
8+
- "hotfix**"
9+
- "chore**"
10+
paths:
11+
- "generate/**.go"
12+
- "generate/go.mod"
13+
- "generate/go.sum"
14+
pull_request:
15+
types:
16+
- opened
17+
- synchronize
18+
- reopened
19+
branches:
20+
- main
21+
paths:
22+
- "generate/**.go"
23+
- "generate/go.mod"
24+
- "generate/go.sum"
25+
26+
jobs:
27+
ci:
28+
uses: ./.github/workflows/common-ci.yml
29+
secrets: inherit
30+
with:
31+
module: "generate"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "healthcheck-ci"
2+
3+
on:
4+
push:
5+
branches:
6+
- "feat**"
7+
- "fix**"
8+
- "hotfix**"
9+
- "chore**"
10+
paths:
11+
- "healthcheck/**.go"
12+
- "healthcheck/go.mod"
13+
- "healthcheck/go.sum"
14+
pull_request:
15+
types:
16+
- opened
17+
- synchronize
18+
- reopened
19+
branches:
20+
- main
21+
paths:
22+
- "healthcheck/**.go"
23+
- "healthcheck/go.mod"
24+
- "healthcheck/go.sum"
25+
26+
jobs:
27+
ci:
28+
uses: ./.github/workflows/common-ci.yml
29+
secrets: inherit
30+
with:
31+
module: "healthcheck"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "httpclient-ci"
2+
3+
on:
4+
push:
5+
branches:
6+
- "feat**"
7+
- "fix**"
8+
- "hotfix**"
9+
- "chore**"
10+
paths:
11+
- "httpclient/**.go"
12+
- "httpclient/go.mod"
13+
- "httpclient/go.sum"
14+
pull_request:
15+
types:
16+
- opened
17+
- synchronize
18+
- reopened
19+
branches:
20+
- main
21+
paths:
22+
- "httpclient/**.go"
23+
- "httpclient/go.mod"
24+
- "httpclient/go.sum"
25+
26+
jobs:
27+
ci:
28+
uses: ./.github/workflows/common-ci.yml
29+
secrets: inherit
30+
with:
31+
module: "httpclient"

.github/workflows/log-ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "log-ci"
2+
3+
on:
4+
push:
5+
branches:
6+
- "feat**"
7+
- "fix**"
8+
- "hotfix**"
9+
- "chore**"
10+
paths:
11+
- "log/**.go"
12+
- "log/go.mod"
13+
- "log/go.sum"
14+
pull_request:
15+
types:
16+
- opened
17+
- synchronize
18+
- reopened
19+
branches:
20+
- main
21+
paths:
22+
- "log/**.go"
23+
- "log/go.mod"
24+
- "log/go.sum"
25+
26+
jobs:
27+
ci:
28+
uses: ./.github/workflows/common-ci.yml
29+
secrets: inherit
30+
with:
31+
module: "log"

.github/workflows/release.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
release-please:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: google-github-actions/release-please-action@v3
17+
with:
18+
command: manifest
19+
monorepo-tags: true
20+
separate-pull-requests: true
21+
release-type: "go"
22+
tag-separator: "/"

.github/workflows/trace-ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "trace-ci"
2+
3+
on:
4+
push:
5+
branches:
6+
- "feat**"
7+
- "fix**"
8+
- "hotfix**"
9+
- "chore**"
10+
paths:
11+
- "trace/**.go"
12+
- "trace/go.mod"
13+
- "trace/go.sum"
14+
pull_request:
15+
types:
16+
- opened
17+
- synchronize
18+
- reopened
19+
branches:
20+
- main
21+
paths:
22+
- "trace/**.go"
23+
- "trace/go.mod"
24+
- "trace/go.sum"
25+
26+
jobs:
27+
ci:
28+
uses: ./.github/workflows/common-ci.yml
29+
secrets: inherit
30+
with:
31+
module: "trace"

.release-please-manifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

0 commit comments

Comments
 (0)