Преглед изворни кода

[CI] Added license checker

Signed-off-by: Andrea Barberio <insomniac@slackware.it>
Andrea Barberio пре 6 година
родитељ
комит
d641d29c13
2 измењених фајлова са 23 додато и 0 уклоњено
  1. 14 0
      .travis/checklicenses_config.json
  2. 9 0
      .travis/linters.sh

+ 14 - 0
.travis/checklicenses_config.json

@@ -0,0 +1,14 @@
+{
+    "gopkg": "github.com/coredhcp/coredhcp",
+    "licenses": [
+        [
+            "^// Copyright 2018-present the CoreDHCP Authors\\. All rights reserved",
+            "// This source code is licensed under the MIT license found in the",
+            "// LICENSE file in the root directory of this source tree\\."
+        ]
+    ],
+    "accept": [
+        ".*\\.go"
+    ],
+    "reject": []
+}

+ 9 - 0
.travis/linters.sh

@@ -3,3 +3,12 @@
 go get github.com/golangci/golangci-lint/cmd/golangci-lint
 go install github.com/golangci/golangci-lint/cmd/golangci-lint
 golangci-lint run
+
+# check license headers
+# this needs to be run from the top level directory, because it uses
+# `git ls-files` under the hood.
+go get -u github.com/u-root/u-root/tools/checklicenses
+go install github.com/u-root/u-root/tools/checklicenses
+cd "${TRAVIS_BUILD_DIR}"
+echo "[*] Running checklicenses"
+go run github.com/u-root/u-root/tools/checklicenses -c .travis/checklicenses_config.json