You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2020/10/31 12:02:47 UTC

[skywalking-satellite] 01/01: Set up workflow to check license

This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch chore/check-license
in repository https://gitbox.apache.org/repos/asf/skywalking-satellite.git

commit 7ee23e3cb4b550166a3fa83e2114e9857c1f542c
Author: kezhenxu94 <ke...@163.com>
AuthorDate: Sat Oct 31 20:02:23 2020 +0800

    Set up workflow to check license
---
 .github/workflows/build-and-test.yaml | 11 +++++-
 .gitignore                            |  1 +
 Makefile                              | 73 +++++++++++++++++++++++++++++++++++
 main.go                               | 22 +++++++++++
 4 files changed, 106 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml
index 1705001..b7f89e0 100644
--- a/.github/workflows/build-and-test.yaml
+++ b/.github/workflows/build-and-test.yaml
@@ -20,7 +20,7 @@ on:
   pull_request:
   push:
     branches:
-      - master
+      - main
     paths:
       - '!**.md'
 
@@ -31,3 +31,12 @@ jobs:
     steps:
       - uses: actions/checkout@v2
 
+      - name: Check License
+        run: make license
+
+      - name: Get dependencies
+        run: make deps
+
+      - name: Lint
+        run: make lint
+
diff --git a/.gitignore b/.gitignore
index cd1f72f..51f1814 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,4 +3,5 @@
 .DS_Store
 *~
 bin/
+coverage.txt
 
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..5402756
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,73 @@
+#
+# 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.
+#
+
+VERSION ?= latest
+OUT_DIR = bin
+BINARY = skywalking-sidecar
+
+RELEASE_BIN = skywalking-sidecar-$(VERSION)-bin
+RELEASE_SRC = skywalking-sidecar-$(VERSION)-src
+
+OS = $(shell uname)
+
+GO = go
+GO_PATH = $$($(GO) env GOPATH)
+GO_BUILD = $(GO) build
+GO_GET = $(GO) get
+GO_TEST = $(GO) test
+GO_LINT = $(GO_PATH)/bin/golangci-lint
+GO_LICENSER = $(GO_PATH)/bin/go-licenser
+GO_PACKR = $(GO_PATH)/bin/packr2
+GO_BUILD_FLAGS = -v
+GO_BUILD_LDFLAGS = -X main.version=$(VERSION)
+GQL_GEN = $(GO_PATH)/bin/gqlgen
+
+PLATFORMS := windows linux darwin
+os = $(word 1, $@)
+ARCH = amd64
+
+SHELL = /bin/bash
+
+all: clean license deps lint test build
+
+tools:
+	$(GO_PACKR) -v || $(GO_GET) -u github.com/gobuffalo/packr/v2/...
+	$(GO_LINT) version || curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GO_PATH)/bin v1.21.0
+	$(GO_LICENSER) -version || GO111MODULE=off $(GO_GET) -u github.com/elastic/go-licenser
+
+deps: tools
+	$(GO_GET) -v -t -d ./...
+
+.PHONY: lint
+lint: tools
+	$(GO_LINT) run -v ./...
+
+.PHONE: test
+test: clean lint
+	$(GO_TEST) ./... -coverprofile=coverage.txt -covermode=atomic
+
+.PHONY: license
+license: clean tools
+	$(GO_LICENSER) -d -licensor='Apache Software Foundation (ASF)' .
+
+.PHONY: verify
+verify: clean license lint test
+
+.PHONY: clean
+clean: tools
+	-rm -rf coverage.txt
+
diff --git a/main.go b/main.go
new file mode 100644
index 0000000..4840527
--- /dev/null
+++ b/main.go
@@ -0,0 +1,22 @@
+// Licensed to 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. Apache Software Foundation (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.
+
+package main;
+
+func main() {
+	print("OK");
+}