Skip to content

Commit 17014ff

Browse files
committed
初始化项目结构
1 parent bc0cb94 commit 17014ff

File tree

16 files changed

+419
-0
lines changed

16 files changed

+419
-0
lines changed

.CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
## 开发中:
2+
- [初始化项目](https://github.com/gotomicro/egen/pull/1)

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**仅限中文**
11+
12+
在提之前请先查找[已有 issues](https://github.com/gotomicro/egen/issues),避免重复上报。
13+
14+
并且确保自己已经:
15+
- [ ] 阅读过文档
16+
- [ ] 阅读过注释
17+
- [ ] 阅读过例子
18+
19+
### 问题简要描述
20+
21+
### 复现步骤
22+
> 如果涉及到数据库表,你必须提供模型定义和表结构定义
23+
24+
### 错误日志或者截图
25+
26+
### 你期望的结果
27+
28+
### 你排查的结果,或者你觉得可行的修复方案
29+
> 可选。我们希望你能够尽量先排查问题,帮助我们减轻维护负担。这对于你个人能力提升同样是有帮助的。
30+
31+
### 你使用的是 egen 哪个版本?
32+
33+
### 你设置的的 Go 环境?
34+
> 上传 `go env` 的结果
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: feature
6+
assignees: ''
7+
8+
---
9+
10+
**仅限中文**
11+
12+
### 使用场景
13+
14+
### 行业分析
15+
> 如果你知道有框架提供了类似功能,可以在这里描述,并且给出文档或者例子
16+
17+
### 可行方案
18+
> 如果你有设计思路或者解决方案,请在这里提供。你可以提供多个方案,并且给出自己的选择
19+
20+
### 其它
21+
> 任何你觉得有利于解决问题的补充说明
22+
23+
### 你使用的是 egen 哪个版本?
24+
25+
### 你设置的的 Go 环境?
26+
> 上传 `go env` 的结果

.github/ISSUE_TEMPLATE/question.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: Question
3+
about: Want to ask some questions
4+
title: ''
5+
labels: question
6+
---
7+
8+
**仅限中文**
9+
10+
在提之前请先查找[已有 issues](https://github.com/gotomicro/egen/issues),避免重复上报。
11+
12+
并且确保自己已经:
13+
- [ ] 阅读过文档
14+
- [ ] 阅读过注释
15+
- [ ] 阅读过例子
16+
17+
### 你的问题
18+
19+
### 你使用的是 egen 哪个版本?
20+
21+
### 你设置的的 Go 环境?
22+
> 上传 `go env` 的结果

.github/linters/.golangci.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Copyright 2021 gotomicro
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
run:
16+
timeout: 5m
17+
skip-files:
18+
- generated.*
19+
- gen.*
20+
21+
issues:
22+
new: true
23+
24+
linters:
25+
enable:
26+
- asciicheck
27+
- bodyclose
28+
- deadcode
29+
- depguard
30+
- gci
31+
- gocritic
32+
- gofmt
33+
- gofumpt
34+
- goimports
35+
- goprintffuncname
36+
- gosimple
37+
- govet
38+
- ineffassign
39+
- misspell
40+
- nilerr
41+
- rowserrcheck
42+
- staticcheck
43+
- structcheck
44+
- stylecheck
45+
- typecheck
46+
- unconvert
47+
- unused
48+
- unparam
49+
- varcheck
50+
- whitespace
51+
- errcheck
52+
- errname
53+
- gochecknoglobals
54+
- sqlclosecheck
55+
# disable:
56+
57+
linters-settings:
58+
gci:
59+
local-prefixes: github.com/gotomicro/egen
60+
goimports:
61+
local-prefixes: github.com/gotomicro/egen

.github/pre-push

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/sh
2+
# Copyright 2021 gotomicro
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
# git test pre-push hook
16+
#
17+
# To use, store as .git/hooks/pre-push inside your repository and make sure
18+
# it has execute permissions.
19+
#
20+
# This script does not handle file names that contain spaces.
21+
22+
# Pre-push configuration
23+
remote=$1
24+
url=$2
25+
echo >&2 "Try pushing $2 to $1"
26+
27+
TEST="go test ./... -race -cover -failfast"
28+
LINTER="golangci-lint run"
29+
30+
# Run test and return if failed
31+
printf "Running go test..."
32+
$TEST
33+
RESULT=$?
34+
if [ $RESULT -ne 0 ]; then
35+
echo >&2 "$TEST"
36+
echo >&2 "Check code to pass test."
37+
exit 1
38+
fi
39+
40+
# Run linter and return if failed
41+
printf "Running go linter..."
42+
$LINTER
43+
RESULT=$?
44+
if [ $RESULT -ne 0 ]; then
45+
echo >&2 "$LINTER"
46+
echo >&2 "Check code to pass linter."
47+
exit 1
48+
fi
49+
50+
exit 0

.github/workflows/changelog.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright 2021 gotomicro
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: changelog
16+
17+
on:
18+
pull_request:
19+
types: [opened, synchronize, reopened, labeled, unlabeled]
20+
branches:
21+
- develop
22+
- main
23+
24+
jobs:
25+
changelog:
26+
runs-on: ubuntu-latest
27+
if: "!contains(github.event.pull_request.labels.*.name, 'Skip Changelog')"
28+
29+
steps:
30+
- uses: actions/checkout@v2
31+
32+
- name: Check for CHANGELOG changes
33+
run: |
34+
# Only the latest commit of the feature branch is available
35+
# automatically. To diff with the base branch, we need to
36+
# fetch that too (and we only need its latest commit).
37+
git fetch origin ${{ github.base_ref }} --depth=1
38+
if [[ $(git diff --name-only FETCH_HEAD | grep CHANGELOG) ]]
39+
then
40+
echo "A CHANGELOG was modified. Looks good!"
41+
else
42+
echo "No CHANGELOG was modified."
43+
echo "Please add a CHANGELOG entry, or add the \"Skip Changelog\" label if not required."
44+
false
45+
fi

.github/workflows/go.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Copyright 2021 gotomicro
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Go
16+
17+
on:
18+
push:
19+
branches: [ main ]
20+
pull_request:
21+
branches: [ main ]
22+
23+
jobs:
24+
build:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v2
28+
- name: Set up Go
29+
uses: actions/setup-go@v2
30+
with:
31+
go-version: 1.18
32+
33+
- name: Build
34+
run: go build -v ./...
35+
36+
- name: Test
37+
run: go test -race -coverprofile=cover.out -v ./...
38+
39+
- name: Post Coverage
40+
uses: codecov/codecov-action@v2
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright 2021 gotomicro
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Integration Test
16+
17+
on:
18+
push:
19+
branches: [ main ]
20+
pull_request:
21+
branches: [ main ]
22+
23+
jobs:
24+
build:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v2
28+
- name: Set up Go
29+
uses: actions/setup-go@v2
30+
with:
31+
go-version: 1.18
32+
33+
- name: Test
34+
run: sh ./script/integrate_test.sh

.github/workflows/license.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright 2021 gotomicro
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Check License Lines
16+
on:
17+
pull_request:
18+
types: [opened, synchronize, reopened, labeled, unlabeled]
19+
branches:
20+
- develop
21+
- main
22+
jobs:
23+
check-license-lines:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@master
27+
- name: Check License Lines
28+
uses: kt3k/[email protected]

0 commit comments

Comments
 (0)