Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .asf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
github:
features:
wiki: true
issues: true
projects: true
notifications:
commits: commits@dubbo.apache.org
issues: notifications@dubbo.apache.org
pullrequests: notifications@dubbo.apache.org
jira_options: link label link label
20 changes: 20 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
target-branch: "main"

- package-ecosystem: "github-actions"
# Workflow files stored in the
# default location of `.github/workflows`
directory: "/"
schedule:
interval: "monthly"
target-branch: "main"
119 changes: 119 additions & 0 deletions .github/workflows/github-actions.yml
Comment thread
zbchi marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
#

name: CI

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

# Cancel in-progress runs for the same branch or PR
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
license-check-and-import-format:
name: License Check and Import Format
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5

- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
cache: true

- name: Cache imports-formatter
id: cache-go-bin
uses: actions/cache@v4
with:
path: ~/go/bin
key: ${{ runner.os }}-go-imports-formatter-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-imports-formatter-

- name: Download imports-formatter if not cached
if: steps.cache-go-bin.outputs.cache-hit != 'true'
run: |
go install github.com/dubbogo/tools/cmd/imports-formatter@latest

- name: Check License Header
uses: apache/skywalking-eyes/header@main # NOSONAR

- name: Check Golang fmt
run: |
gofmt -s -w .
git diff --exit-code

- name: Check Import Formatting
run: |
imports-formatter
git diff --exit-code

golangci-lint:
needs: license-check-and-import-format
name: Golang Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5

- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
cache: true

- name: golangci-lint
uses: golangci/golangci-lint-action@v8 # NOSONAR
with:
version: v2.4.0

unit-test:
needs: golangci-lint
name: Unit Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5

- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
cache: true

- name: Run Tests and Generate Coverage
run: |
go test ./... -race -coverprofile=coverage.txt -covermode=atomic

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4 # NOSONAR
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
flags: unittests
44 changes: 44 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
*.DS_Store
*__debug_bin*

dist/
*.log
# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
coverage.txt

# .env is a user-specific environment configuration file
*.env

*.idea
*.iml
target/
classes
dubbo.json

# Gopkg.lock
vendor/

logs/
.vscode/
cache/
log/
coverage.txt

# maven
.classpath
.project
.settings/

# license header
/license-header-checker-linux/
/license-header-checker-linux.zip
45 changes: 45 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
version: "2"
linters-settings:
gocyclo:
min-complexity: 10
dupl:
threshold: 100
goconst:
min-len: 2
min-occurrences: 2
depguard:
rules:
main:
deny:
- pkg: "github.com/sirupsen/logrus"
desc: logging is allowed only by logutils.Log, logrus, is allowed to use only in logutils package
lll:
line-length: 140
goimports:
local-prefixes: github.com/apache/dubbo-go-extensions
gocritic:
enabled-tags:
- performance
- style
- experimental
disabled-checks:
- wrapperFunc

linters:
disable-all: true
enable:
- staticcheck
- ineffassign
- misspell

issues:
exclude-dirs:
- test/testdata_etc
- pkg/golinters/goanalysis/(checker|passes)
exclude-rules:
- text: "weak cryptographic primitive"
linters:
- gosec
- linters:
- staticcheck
text: "SA1019:"
57 changes: 57 additions & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.

header:
license:
spdx-id: Apache-2.0
content: |
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.

paths-ignore:
- '**/*.md'
- '**/*.json'
- '**/*.yaml'
- '**/*.yml'
- '**/*.properties'
- '**/*.proto'
- '**/*.tpl'
- '**/go.mod'
- '**/go.sum'
- '.git/'
- '.github/**'
- '.gitignore'
- '.gitmodules'
- 'LICENSE'
- 'NOTICE'

comment: on-failure

# If you don't want to check dependencies' license compatibility, remove the following part
dependency:
files:
- go.mod
Loading