Skip to content

Commit

Permalink
ci: Fix CI failures after branch adjustment (#2280)
Browse files Browse the repository at this point in the history
* ci: Fix CI failures after branch adjustment

Signed-off-by: Xuewei Niu <justxuewei@apache.org>

* style: Format comments by go 1.20

Go formatter whose version is above 1.19 formats comments as well, see:
https://go.dev/blog/go1.19.

Signed-off-by: Xuewei Niu <justxuewei@apache.org>

---------

Signed-off-by: Xuewei Niu <justxuewei@apache.org>
  • Loading branch information
justxuewei authored Mar 30, 2023
1 parent 3c831fb commit a633946
Show file tree
Hide file tree
Showing 38 changed files with 642 additions and 621 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ name: "CodeQL"

on:
push:
branches: [master, ]
branches: "*"
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: '0 4 * * 5'
branches: "*"

permissions:
contents: read
Expand Down
48 changes: 23 additions & 25 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI

on:
push:
branches: [master, develop, "1.5", "3.0"]
branches: "*"
pull_request:
branches: "*"

Expand All @@ -21,19 +21,15 @@ jobs:
os:
- ubuntu-latest

env:
DING_TOKEN: ${{ secrets.DING_TOKEN }}
DING_SIGN: ${{ secrets.DING_SIGN }}

steps:

- name: Set up Go ${{ matrix.go_version }}
- name: Setup Go ${{ matrix.go_version }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go_version }}
id: go

- name: Check out code into the Go module directory
- name: Checkout
uses: actions/checkout@v3

- name: Cache dependencies
Expand All @@ -47,18 +43,19 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
- name: Merge base
- name: Merge code into the upstream
if: ${{ github.event_name == 'pull_request' }}
run: |
git fetch origin 3.1
git checkout -b 3.1 origin/3.1
echo "$GITHUB_BASE_REF, $GITHUB_REF_NAME, $GITHUB_REF"
git fetch origin $GITHUB_BASE_REF
git checkout -b $GITHUB_BASE_REF origin/$GITHUB_BASE_REF
git remote add devrepo https://github.com/${{github.event.pull_request.head.repo.full_name}}.git
git fetch devrepo ${{github.event.pull_request.head.sha}}
git config --global user.email "dubbo-go@github-ci.com"
git config --global user.name "robot"
git merge ${{github.event.pull_request.head.sha}}
- name: Get dependencies
- name: Install dependencies
run: |
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
Expand All @@ -67,29 +64,30 @@ jobs:
go get -v -t -d ./...
fi
- name: gofmt
- name: Format code
run: |
go fmt ./... && git status && [[ -z `git status -s` ]]
# diff -u <(echo -n) <(gofmt -d -s .)
- name: Verify
run: |
make verify
# This step only runs when the event type is a pull_request
- name: Integrate Test
- name: Integration Testing
if: ${{ github.event_name == 'pull_request' }}
run: |
chmod +x integrate_test.sh && [[ -n "${{github.event.pull_request.head.repo.full_name}}" ]] && [[ -n "${{github.event.pull_request.head.sha}}" ]] && [[ -n "${{github.base_ref}}" ]] && ./integrate_test.sh ${{github.event.pull_request.head.repo.full_name}} ${{github.event.pull_request.head.sha}} ${{github.base_ref}}
# This step only runs when the event type is a push
- name: Integrate Test
if: ${{ github.event_name == 'push' }}
run: |
chmod +x integrate_test.sh && ./integrate_test.sh $GITHUB_REPOSITORY $GITHUB_SHA $GITHUB_BASE_REF
if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
chmod +x integrate_test.sh \
&& [[ -n "${{github.event.pull_request.head.repo.full_name}}" ]] \
&& [[ -n "${{github.event.pull_request.head.sha}}" ]] \
&& [[ -n "${{github.base_ref}}" ]] \
&& ./integrate_test.sh ${{github.event.pull_request.head.repo.full_name}} ${{github.event.pull_request.head.sha}} ${{github.base_ref}}
elif [ "$GITHUB_EVENT_NAME" == "push" ]; then
chmod +x integrate_test.sh && ./integrate_test.sh $GITHUB_REPOSITORY $GITHUB_SHA $GITHUB_BASE_REF
else
echo "$GITHUB_EVENT_NAME is an unsupported event type."
exit 1
fi
- name: Post Coverage
- name: Codecov
run: bash <(curl -s https://codecov.io/bash)

- name: Hello world
run: echo Hello world ${{ secrets.DING_TOKEN }} ${{ secrets.DING_SIGN }}
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: golangci-lint
on:
push:
branches: [master, develop, "1.5", "3.0"]
branches: "*"
pull_request:
branches: "*"

Expand Down
2 changes: 1 addition & 1 deletion common/constant/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const (
MaxServerRecvMsgSize = "max-server-recv-msg-size"
)

//tls constant
// tls constant
const (
TLSKey = "tls_key"
TLSCert = "tls_cert"
Expand Down
2 changes: 1 addition & 1 deletion common/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ func (c *URL) GetNonDefaultParam(s string) (string, bool) {
r = c.params.Get(s)
}

return r, r != ""
return r, r != ""
}

// GetParams gets values
Expand Down
5 changes: 3 additions & 2 deletions config/config_center_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ func (c *CenterConfig) GetUrlMap() url.Values {
return urlMap
}

//translateConfigAddress translate config address
// eg:address=nacos://127.0.0.1:8848 will return 127.0.0.1:8848 and protocol will set nacos
// translateConfigAddress translate config address
//
// eg:address=nacos://127.0.0.1:8848 will return 127.0.0.1:8848 and protocol will set nacos
func (c *CenterConfig) translateConfigAddress() string {
if strings.Contains(c.Address, "://") {
translatedUrl, err := url.Parse(c.Address)
Expand Down
3 changes: 1 addition & 2 deletions config/config_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ func registerServiceInstance() {
}
}

//
//// nolint
// // nolint
func createInstance(url *common.URL) (registry.ServiceInstance, error) {
appConfig := GetApplicationConfig()
port, err := strconv.ParseInt(url.Port, 10, 32)
Expand Down
2 changes: 1 addition & 1 deletion config/graceful_shutdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func waitingProviderProcessedTimeout(shutdownConfig *ShutdownConfig) {
}
}

//for provider. It will wait for processing receiving requests
// for provider. It will wait for processing receiving requests
func waitForSendingAndReceivingRequests() {
logger.Info("Graceful shutdown --- Keep waiting until sending/accepting requests finish or timeout. ")
if rootConfig == nil || rootConfig.Shutdown == nil {
Expand Down
1 change: 0 additions & 1 deletion config/metadata_report_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ func publishServiceDefinition(url *common.URL) {
}
}

//
// selectMetadataServiceExportedURL get already be exported url
func selectMetadataServiceExportedURL() *common.URL {
var selectedUrl *common.URL
Expand Down
Loading

0 comments on commit a633946

Please sign in to comment.