From ecd72ea0e8ceb5473b3069b6f457dd2fc0b83832 Mon Sep 17 00:00:00 2001 From: spacewander Date: Mon, 31 May 2021 12:19:58 +0800 Subject: [PATCH] ci: enable --- .github/workflows/license-checker.yml | 38 ++++++++++++++++++ .github/workflows/lint.yml | 55 +++++++++++++++++++++++++++ .github/workflows/spell-checker.yml | 37 ++++++++++++++++++ .github/workflows/unit-test-ci.yml | 42 ++++++++++++++++++++ .licenserc.yaml | 35 +++++++++++++++++ Makefile | 2 +- 6 files changed, 208 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/license-checker.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/spell-checker.yml create mode 100644 .github/workflows/unit-test-ci.yml create mode 100644 .licenserc.yaml diff --git a/.github/workflows/license-checker.yml b/.github/workflows/license-checker.yml new file mode 100644 index 0000000..586c7a9 --- /dev/null +++ b/.github/workflows/license-checker.yml @@ -0,0 +1,38 @@ +# +# 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: License checker + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + check-license: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Check License Header + uses: apache/skywalking-eyes@v0.1.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..7872fd7 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,55 @@ +# +# 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: lint + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + golang-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: setup go + uses: actions/setup-go@v1 + with: + go-version: '1.15' + + - name: Download golangci-lint + run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.39.0 + + - name: golangci-lint + run: | + export PATH=$PATH:$(go env GOPATH)/bin/ + make lint + + - name: run gofmt + working-directory: ./ + run: | + diffs=`gofmt -l .` + if [[ -n $diffs ]]; then + echo "Files are not formatted by gofmt:" + echo $diffs + exit 1 + fi diff --git a/.github/workflows/spell-checker.yml b/.github/workflows/spell-checker.yml new file mode 100644 index 0000000..b31a48c --- /dev/null +++ b/.github/workflows/spell-checker.yml @@ -0,0 +1,37 @@ +# +# 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: spell-checker +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] +jobs: + misspell: + name: runner / misspell + runs-on: ubuntu-latest + steps: + - name: Check out code. + uses: actions/checkout@v1 + - name: Install + run: | + wget -O - -q https://git.io/misspell | sh -s -- -b . + - name: Misspell + run: | + find . -name "*.go" -or -name "*.md" -or -name "*.yml" -type f | xargs ./misspell -error diff --git a/.github/workflows/unit-test-ci.yml b/.github/workflows/unit-test-ci.yml new file mode 100644 index 0000000..b88bdf7 --- /dev/null +++ b/.github/workflows/unit-test-ci.yml @@ -0,0 +1,42 @@ +# +# 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: unit-test-ci + +on: + push: + branches: + - master + pull_request: + branches: + - master +jobs: + run-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: setup go + uses: actions/setup-go@v1 + with: + go-version: '1.15' + - name: run unit test + run: | + make test + - name: upload coverage profile + run: | + bash <(curl -s https://codecov.io/bash) diff --git a/.licenserc.yaml b/.licenserc.yaml new file mode 100644 index 0000000..4b1557d --- /dev/null +++ b/.licenserc.yaml @@ -0,0 +1,35 @@ +# +# 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 + copyright-owner: Apache Software Foundation + + paths-ignore: + - 'dist' + - 'licenses' + - '**/*.md' + - '**/testdata/**' + - '**/go.mod' + - '**/go.sum' + - 'LICENSE' + - 'NOTICE' + - '**/*.json' + - '.github/ISSUE_TEMPLATE' + - '.github/PULL_REQUEST_TEMPLATE' + + comment: on-failure diff --git a/Makefile b/Makefile index 1f124cb..465326e 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ build: .PHONY: lint lint: - golangci-lint run --verbose + golangci-lint run --verbose ./... .PHONY: test test: