Skip to content

Commit

Permalink
尝试修复ci (#2)
Browse files Browse the repository at this point in the history
* fix: 尝试修复ci

* fix: 尝试修复ci

* fix: 尝试修复ci

* fix: 修复ci

* fix: 修复ci
  • Loading branch information
WenZu-Zhou authored Mar 1, 2024
1 parent 04a4b17 commit 9bb9a47
Show file tree
Hide file tree
Showing 22 changed files with 218 additions and 87 deletions.
50 changes: 0 additions & 50 deletions .github/pre-push

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/go-fmt.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 ecodeclub
# Copyright 2023 ecodeclub
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -24,11 +24,11 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ">=1.20.0"
go-version: '>=1.21.0'

- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@latest
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 ecodeclub
# Copyright 2023 ecodeclub
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -16,19 +16,19 @@ name: Go

on:
push:
branches: [ dev ]
branches: [ dev,main ]
pull_request:
branches: [ dev ]
branches: [ dev,main ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: 1.20.0
go-version: '1.21.0'

- name: Build
run: go build -v ./...
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 ecodeclub
# Copyright 2023 ecodeclub
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -33,8 +33,8 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.20.0
- uses: actions/checkout@v3
go-version: '1.21.0'
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
Expand Down
33 changes: 18 additions & 15 deletions .github/pre-commit → .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/sh
# Copyright 2021 ecodeclub
# Copyright 2023 ecodeclub
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -12,20 +11,24 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# To use, store as .git/hooks/pre-commit inside your repository and make sure
# it has execute permissions.
#
# This script does not handle file names that contain spaces.

# Pre-commit configuration
name: Integration Test

make check
printf "执行检查中...\n"
on:
push:
branches: [ main, dev]
pull_request:
branches: [ main, dev]

if [ $? -ne 0 ]; then
echo >&2 "[ERROR]: 有文件发生变更,请将变更文件添加到本次提交中"
exit 1
fi
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.21.0'

exit 0
- name: Test
run: make e2e
11 changes: 7 additions & 4 deletions .github/workflows/license.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 ecodeclub
# Copyright 2023 ecodeclub
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -24,6 +24,9 @@ jobs:
check-license-lines:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Check License Lines
uses: kt3k/[email protected]
- uses: denoland/setup-deno@v1
with:
deno-version: "1.40.4"
- uses: actions/checkout@v4
- name: Check license
run: deno run --allow-read https://deno.land/x/[email protected]/main.ts
4 changes: 2 additions & 2 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 ecodeclub
# Copyright 2023 ecodeclub
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,4 +30,4 @@ jobs:
stale-issue-message: 'This issue is inactive for a long time.'
stale-pr-message: 'This PR is inactive for a long time'
stale-issue-label: 'inactive-issue'
stale-pr-label: 'inactive-pr'
stale-pr-label: 'inactive-pr'
18 changes: 18 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2023 ecodeclub
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

run:
go: '1.21'
skip-dirs:
- .idea
13 changes: 13 additions & 0 deletions .license_header
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2023 ecodeclub

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
5 changes: 5 additions & 0 deletions .licenserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"**/*.go": "// Copyright 2023 ecodeclub",
"**/*.{yml,toml}": "# Copyright 2023 ecodeclub",
"**/*.sh": "# Copyright 2023 ecodeclub"
}
2 changes: 1 addition & 1 deletion .script/goimports.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 ecodeclub
# Copyright 2023 ecodeclub
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
21 changes: 21 additions & 0 deletions .script/integrate_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2023 ecodeclub
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#!/usr/bin/env bash

set -e
docker compose -f .script/integration_test_compose.yml down
docker compose -f .script/integration_test_compose.yml up -d
go test ./... -tags=e2e
docker compose -f .script/integration_test_compose.yml down
21 changes: 21 additions & 0 deletions .script/integration_test_compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2023 ecodeclub
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

version: '3.0'

services:
redis:
image: redis:latest
ports:
- "16379:6379"
2 changes: 1 addition & 1 deletion .script/setup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 ecodeclub
# Copyright 2023 ecodeclub
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,17 @@ tidy:
.PHONY: check
check:
@$(MAKE) fmt
@$(MAKE) tidy
@$(MAKE) tidy

# e2e 测试
.PHONY: e2e
e2e:
sh ./.script/integrate_test.sh

.PHONY: e2e_up
e2e_up:
docker compose -f .script/integration_test_compose.yml up -d

.PHONY: e2e_down
e2e_down:
docker compose -f .script/integration_test_compose.yml down
14 changes: 14 additions & 0 deletions balancer/doc.go
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
// Copyright 2023 ecodeclub
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Package balancer 集中存放各种负载均衡算法实现
package balancer
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/ecodeclub/grpcx

go 1.21.5
go 1.21
14 changes: 14 additions & 0 deletions go_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2023 ecodeclub
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package grpcx

import "testing"
Expand Down
14 changes: 14 additions & 0 deletions interceptor/otel/doc.go
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
// Copyright 2023 ecodeclub
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Package otel 支持接入 opentelemetry 的各种度量
package otel
14 changes: 14 additions & 0 deletions interceptor/prometheus/doc.go
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
// Copyright 2023 ecodeclub
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Package prometheus 接入 prometheus
package prometheus
Loading

0 comments on commit 9bb9a47

Please sign in to comment.