Skip to content

Commit 427507f

Browse files
committed
设置 github action
1 parent 4a27235 commit 427507f

36 files changed

+809
-276
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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/ecodeclub/ginx/issues),避免重复上报。
13+
14+
并且确保自己已经:
15+
- [ ] 阅读过文档
16+
- [ ] 阅读过代码注释
17+
- [ ] 阅读过相关测试
18+
19+
### 问题简要描述
20+
21+
### 复现步骤
22+
> 通过编写单元、集成及e2e测试来复现Bug
23+
24+
### 错误日志或者截图
25+
26+
### 你期望的结果
27+
28+
### 你排查的结果,或者你觉得可行的修复方案
29+
> 可选。希望你能够尽量先排查问题,这对于你个人能力提升很有帮助。
30+
31+
### 你设置的的 Go 环境?
32+
> 上传 `go env` 的结果
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
### 你设置的的 Go 环境?
24+
> 上传 `go env` 的结果

.github/ISSUE_TEMPLATE/question.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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/ecodeclub/ginx/issues),避免重复提问。
11+
12+
并且确保自己已经:
13+
- [ ] 阅读过文档
14+
- [ ] 阅读过代码注释
15+
- [ ] 阅读过相关测试
16+
17+
### 你的问题
18+
19+
### 你设置的的 Go 环境?
20+
> 上传 `go env` 的结果

.github/ISSUE_TEMPLATE/refactor.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: Refactor request
3+
about: Refactor existing code
4+
title: ''
5+
labels: refactor
6+
assignees: ''
7+
8+
---
9+
10+
**仅限中文**
11+
12+
### 当前实现缺陷
13+
14+
### 重构方案
15+
> 描述可以如何重构,以及重构之后带来的效果,如可读性、性能等方面的提升
16+
17+
### 其它
18+
> 任何你觉得有利于解决问题的补充说明

.github/workflows/go-fmt.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright 2023 ecodeclub
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: Format Go code
16+
17+
on:
18+
push:
19+
branches: [ main,dev ]
20+
pull_request:
21+
branches: [ main,dev ]
22+
23+
jobs:
24+
build:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v3
28+
- name: Set up Go
29+
uses: actions/setup-go@v3
30+
with:
31+
go-version: ">=1.20.0"
32+
33+
- name: Install goimports
34+
run: go install golang.org/x/tools/cmd/goimports@latest
35+
36+
- name: Check
37+
run: |
38+
make check
39+
if [ -n "$(git status --porcelain)" ]; then
40+
echo >&2 "错误: 请在本地运行命令'make check'后再提交."
41+
exit 1
42+
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 2023 ecodeclub
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: [ dev,main ]
20+
pull_request:
21+
branches: [ dev,main ]
22+
23+
jobs:
24+
build:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v3
28+
- name: Set up Go
29+
uses: actions/setup-go@v3
30+
with:
31+
go-version: 1.20.0
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: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Copyright 2023 ecodeclub
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: golangci-lint
16+
on:
17+
push:
18+
branches:
19+
- dev
20+
- main
21+
pull_request:
22+
branches:
23+
- dev
24+
- main
25+
permissions:
26+
contents: read
27+
# Optional: allow read access to pull request. Use with `only-new-issues` option.
28+
pull-requests: read
29+
jobs:
30+
golangci:
31+
name: lint
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/setup-go@v3
35+
with:
36+
go-version: 1.20.0
37+
- uses: actions/checkout@v3
38+
- name: golangci-lint
39+
uses: golangci/golangci-lint-action@v3
40+
with:
41+
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
42+
version: latest
43+
44+
# Optional: working directory, useful for monorepos
45+
# working-directory: somedir
46+
47+
# Optional: golangci-lint command line arguments.
48+
args: -c .golangci.yml
49+
50+
# Optional: show only new issues if it's a pull request. The default value is `false`.
51+
only-new-issues: true
52+
53+
# Optional: if set to true then the all caching functionality will be complete disabled,
54+
# takes precedence over all other caching options.
55+
# skip-cache: true
56+
57+
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
58+
# skip-pkg-cache: true
59+
60+
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
61+
# skip-build-cache: true

.github/workflows/license.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright 2023 ecodeclub
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+
- dev
23+
jobs:
24+
check-license-lines:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@master
28+
- name: Check License Lines
29+
uses: kt3k/license_checker@v1.0.6

.github/workflows/stale.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 2023 ecodeclub
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: Mark stale issues and pull requests
16+
17+
on:
18+
schedule:
19+
- cron: "30 1 * * *"
20+
21+
jobs:
22+
stale:
23+
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- uses: actions/stale@v4
28+
with:
29+
repo-token: ${{ secrets.GITHUB_TOKEN }}
30+
stale-issue-message: 'This issue is inactive for a long time.'
31+
stale-pr-message: 'This PR is inactive for a long time'
32+
stale-issue-label: 'inactive-issue'
33+
stale-pr-label: 'inactive-pr'

.golangci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright 2023 ecodeclub
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+
go: '1.21'
17+
skip-dirs:
18+
- .idea

0 commit comments

Comments
 (0)