Skip to content

Commit 7992a2b

Browse files
authored
fix: 修复CI问题#4
fix: 修复CI问题 Signed-off-by: longyue0521 <[email protected]>
1 parent cf53b00 commit 7992a2b

14 files changed

+139
-40
lines changed

.github/pull_request_template.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## 自查清单
2+
3+
注意: 请完成下列自查清单中的**所有**自查项,完成一项勾选一项.
4+
5+
- [ ] 当前PR不存在未合并的代码或者其他冲突.
6+
- [ ] 当前PR中的**产品代码**有恰当的注释、文档及**必备的单元、集成及e2e测试代码**.
7+
8+
## PR概述
9+
<!--
10+
简明扼要地描述一下这个PR所做的事情以及它试图解决的问题。 可以添加图片、链接等来补充说明.
11+
-->
12+
13+
## 关联Issue
14+
<!--
15+
这个PR是否会关闭某些未解决的Issue?如果是的话,请在这里使用类似于`#901`的方式来提及Issue或`close #877`的方式来关闭对应的Issue.
16+
-->
17+
18+
## 其他内容
19+
<!--
20+
在这里写下任何你想与代码审查者想要沟通的内容.
21+
-->

.github/workflows/go-fmt.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ jobs:
3030
with:
3131
go-version: ">=1.21.0"
3232

33-
- name: Install goimports
34-
run: go install golang.org/x/tools/cmd/goimports@latest
33+
- name: Install dependencies
34+
run: |
35+
go install mvdan.cc/gofumpt@latest && \
36+
go install golang.org/x/tools/cmd/goimports@latest && \
37+
go install github.com/golangci/golangci-lint/cmd/[email protected]
3538
3639
- name: Check
3740
run: |

.github/workflows/go.yml

+1-7
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,4 @@ jobs:
3131
go-version: '>=1.21.0'
3232

3333
- 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@v3
34+
run: go build -v ./...

.github/workflows/integration_test.yml renamed to .github/workflows/testing.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
name: Integration Test
15+
name: Integration and E2E Test
1616

1717
on:
1818
push:
@@ -30,5 +30,11 @@ jobs:
3030
with:
3131
go-version: '>=1.21.0'
3232

33-
- name: Test
34-
run: sudo sh ./script/integrate_test.sh
33+
- name: Unit Test
34+
run: make ut
35+
36+
- name: Run E2E Test
37+
run: make e2e
38+
39+
- name: Post Coverage
40+
uses: codecov/codecov-action@v3

.licenserc.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"**/*.go": "// Copyright 2021 ecodeclub",
3+
"**/*.{yml,toml}": "# Copyright 2021 ecodeclub",
4+
"**/*.sh": "# Copyright 2021 ecodeclub"
5+
}

Makefile

+7-15
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ setup:
66
@echo "初始化开发环境......"
77
@find "$(SCRIPTS_PATH)" -type f -name '*.sh' -exec chmod +x {} \;
88
@bash $(SCRIPTS_PATH)/setup/setup.sh
9-
@$(MAKE) tidy
9+
@make tidy
1010

1111
# 依赖清理
1212
.PHONY: tidy
@@ -16,8 +16,8 @@ tidy:
1616
# 代码风格
1717
.PHONY: fmt
1818
fmt:
19-
@goimports -l -w $$(find . -type f -name '*.go' -not -path "./.idea/*" -not -path "./cmd/monolithic/ioc/wire_gen.go")
20-
@gofumpt -l -w $$(find . -type f -name '*.go' -not -path "./.idea/*" -not -path "./cmd/monolithic/ioc/wire_gen.go")
19+
@goimports -l -w $$(find . -type f -name '*.go' -not -path "./.idea/*")
20+
@gofumpt -l -w $$(find . -type f -name '*.go' -not -path "./.idea/*")
2121

2222
# 静态扫描
2323
.PHONY: lint
@@ -29,20 +29,12 @@ lint:
2929
ut:
3030
@go test -race -cover -coverprofile=unit.out -failfast -shuffle=on ./...
3131

32-
# 集成测试
33-
.PHONY: it
34-
it:
35-
@make dev_3rd_down
36-
@make dev_3rd_up
37-
@go test -tags=integration -race -cover -coverprofile=integration.out -failfast -shuffle=on ./...
38-
@make dev_3rd_down
39-
4032
# 端到端测试
4133
.PHONY: e2e
4234
e2e:
4335
@make dev_3rd_down
4436
@make dev_3rd_up
45-
@go test -tags=e2e -race -cover -coverprofile=e2e.out -failfast -shuffle=on ./...
37+
@go test -tags=e2e -race -cover -coverprofile=e2e.out -failfast -shuffle=on ./e2e/...
4638
@make dev_3rd_down
4739

4840
# 启动本地研发 docker 依赖
@@ -58,8 +50,8 @@ dev_3rd_down:
5850
check:
5951
@echo "\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 检查阶段 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"
6052
@echo "整理项目依赖中......"
61-
@$(MAKE) tidy
53+
@make tidy
6254
@echo "代码风格检查中......"
63-
@$(MAKE) fmt
55+
@make fmt
6456
@echo "代码静态扫描中......"
65-
@$(MAKE) lint
57+
@make lint

e2e/e2e_test.go

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//go:build e2e
2+
3+
// Copyright 2021 ecodeclub
4+
//
5+
// Licensed under the Apache License, Version 2.0 (the "License");
6+
// you may not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing, software
12+
// distributed under the License is distributed on an "AS IS" BASIS,
13+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
// See the License for the specific language governing permissions and
15+
// limitations under the License.
16+
package e2e
17+
18+
import (
19+
"testing"
20+
21+
"github.com/stretchr/testify/assert"
22+
)
23+
24+
func TestE2E(t *testing.T) {
25+
assert.True(t, true)
26+
}

scripts/cicd/3rd-dependency-check.sh

+13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
#!/bin/sh
2+
# Copyright 2021 ecodeclub
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.
215

316
output=$(make tidy)
417
if [ -n "$output" ]; then

scripts/cicd/code-static-check.sh

+13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
#!/bin/sh
2+
# Copyright 2021 ecodeclub
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.
215

316
output=$(make lint)
417
if [ -n "$output" ]; then

scripts/cicd/code-style-check.sh

+13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
#!/bin/sh
2+
# Copyright 2021 ecodeclub
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.
215

316
output=$(make fmt)
417
if [ -n "$output" ]; then

scripts/cicd/end-to-end-testing.sh

+13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
#!/bin/sh
2+
# Copyright 2021 ecodeclub
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.
215

316
echo "运行端到端测试中......"
417
make e2e

scripts/cicd/integration-testing.sh

-8
This file was deleted.

scripts/cicd/unit-testing.sh

+13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
#!/bin/sh
2+
# Copyright 2021 ecodeclub
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.
215

316
echo "运行单元测试中......"
417
make ut

scripts/setup/git/pre-push

-5
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ if [ $? -ne 0 ]; then
2626
exit 1
2727
fi
2828

29-
sh "$(pwd)/scripts/cicd/integration-testing.sh"
30-
if [ $? -ne 0 ]; then
31-
exit 1
32-
fi
33-
3429
sh "$(pwd)/scripts/cicd/end-to-end-testing.sh"
3530
if [ $? -ne 0 ]; then
3631
exit 1

0 commit comments

Comments
 (0)