From 3fab7eaef8ffce274481cfb3c13b08047284fc32 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Mon, 13 Jul 2020 11:49:24 -0700 Subject: [PATCH] added license check to CI --- .github/workflows/README.md | 13 +++++++++++++ .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 43af343..7299882 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -13,6 +13,19 @@ # install kubectl sudo apt-get install kubectl + # install go + curl -O https://storage.googleapis.com/golang/go1.12.9.linux-amd64.tar.gz + tar -xvf go1.12.9.linux-amd64.tar.gz + sudo chown -R root:root ./go + sudo mv go /usr/local + echo 'export GOPATH=$HOME/go' >> ~/.profile + echo 'export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin' >> ~/.profile + source ~/.profile + + # install addlicense + go get -u github.com/google/addlicense + sudo ln -s $HOME/go/bin/addlicense /bin + # install kind curl -Lo ./kind "https://github.com/kubernetes-sigs/kind/releases/download/v0.7.0/kind-$(uname)-amd64" && \ chmod +x ./kind && \ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4574b62..e5054e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,3 +1,17 @@ +# Copyright 2020 Google LLC +# +# Licensed 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: "Continuous Integration" on: push: @@ -14,6 +28,17 @@ jobs: runs-on: self-hosted steps: - uses: actions/checkout@v2 + - name: License Check + run: | + set -x + git init + git add --all + git -c user.name="CI Bot" -c user.email="<>" commit -m "initial state" + addlicense ./ + if [[ -n $(git status -s) ]]; then + exit 1 + fi + - uses: actions/checkout@v2 - name: Setup Cluster run: | set -x