Skip to content

Commit

Permalink
add license checker in workflow (#117)
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Liu <jasonliu747@gmail.com>
  • Loading branch information
jasonliu747 authored May 5, 2022
1 parent 9a6a707 commit 94bcf4d
Show file tree
Hide file tree
Showing 219 changed files with 2,356 additions and 2,240 deletions.
28 changes: 23 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,25 @@ on:
pull_request: {}
workflow_dispatch: {}

env:
GO_VERSION: '1.17'

jobs:
get-go-version:
runs-on: ubuntu-latest
outputs:
go-version: ${{ steps.read-go-version.outputs.version }}
steps:
- uses: actions/checkout@v3
- id: read-go-version
name: Determine Go version from go.mod
run: echo "::set-output name=version::$(grep "go 1." go.mod | cut -d " " -f 2)"

golangci-lint:
runs-on: ubuntu-latest
needs:
- get-go-version
steps:
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
go-version: ${{ needs.get-go-version.outputs.go-version }}
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
Expand All @@ -35,16 +44,25 @@ jobs:

staticcheck:
runs-on: ubuntu-latest
needs:
- get-go-version
steps:
- uses: actions/setup-go@v3
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- uses: actions/checkout@v3
- uses: dominikh/staticcheck-action@v1
with:
install-go: false

unit-tests:
runs-on: ubuntu-latest
needs:
- get-go-version
steps:
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
go-version: ${{ needs.get-go-version.outputs.go-version }}
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/license.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,10 @@ jobs:
run: |
gem install license_finder
license_finder --decisions_file .license/dependency_decisions.yml
- uses: actions/setup-go@v3
with:
go-version: 1.17
- name: Check license header
run: |
make lint-license && git add apis pkg cmd
git diff --cached --exit-code || (echo 'Please make sure every file has a correct license inserted' && exit 1);
16 changes: 15 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,16 @@ vet: ## Run go vet against code.
go vet ./...

.PHONY: lint
lint: golangci-lint ## Lint Go code.
lint: lint-go lint-license ## Lint all code.

.PHONY: lint-go
lint-go: golangci-lint ## Lint Go code.
$(GOLANGCI_LINT) run -v --timeout=5m

.PHONY: lint-license
lint-license: license-header-checker ## Check license headers.
$(LICENSE_HEADER_CHECKER) -a -v -i vendor "$(LICENSE_HEADER_GO)" . go

.PHONY: test
test: manifests generate fmt vet envtest ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -race -covermode atomic -coverprofile cover.out
Expand Down Expand Up @@ -171,11 +178,13 @@ KUSTOMIZE ?= $(LOCALBIN)/kustomize
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
ENVTEST ?= $(LOCALBIN)/setup-envtest
GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint
LICENSE_HEADER_CHECKER ?= $(LOCALBIN)/license-header-checker

## Tool Versions
KUSTOMIZE_VERSION ?= v3.8.7
CONTROLLER_TOOLS_VERSION ?= v0.8.0
GOLANGCILINT_VERSION ?= v1.45.2
LICENSEHEADERCHECKER_VERSION ?= v1.3.0

KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
.PHONY: kustomize
Expand All @@ -197,3 +206,8 @@ $(ENVTEST): $(LOCALBIN)
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
$(GOLANGCI_LINT): $(LOCALBIN)
GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCILINT_VERSION)

.PHONY: license-header-checker
license-header-checker: $(LICENSE_HEADER_CHECKER) ## Download license-header-checker locally if necessary.
$(LICENSE_HEADER_CHECKER):
GOBIN=$(LOCALBIN) go install github.com/lsm-dev/license-header-checker/cmd/license-header-checker@$(LICENSEHEADERCHECKER_VERSION)
20 changes: 10 additions & 10 deletions apis/config/v1alpha1/cluster_colocation_profile_types.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/*
Copyright 2022 The Koordinator Authors.
Copyright 2022 The Koordinator Authors.
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
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
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.
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 v1alpha1
Expand Down
20 changes: 10 additions & 10 deletions apis/config/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/*
Copyright 2022 The Koordinator Authors.
Copyright 2022 The Koordinator Authors.
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
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
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.
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 v1alpha1 contains API Schema definitions for the config v1alpha1 API group
Expand Down
20 changes: 10 additions & 10 deletions apis/config/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions apis/doc.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/*
Copyright 2022 The Koordinator Authors.
Copyright 2022 The Koordinator Authors.
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
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
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.
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 apis
20 changes: 10 additions & 10 deletions apis/extension/constants.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/*
Copyright 2022 The Koordinator Authors.
Copyright 2022 The Koordinator Authors.
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
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
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.
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 extension
Expand Down
21 changes: 11 additions & 10 deletions apis/extension/pod.go
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
/*
Copyright 2022 The Koordinator Authors.
Copyright 2022 The Koordinator Authors.
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
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
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.
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 extension

import (
"encoding/json"

corev1 "k8s.io/api/core/v1"

slov1aplhpa1 "github.com/koordinator-sh/koordinator/apis/slo/v1alpha1"
Expand Down
20 changes: 10 additions & 10 deletions apis/extension/priority.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/*
Copyright 2022 The Koordinator Authors.
Copyright 2022 The Koordinator Authors.
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
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
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.
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 extension
Expand Down
20 changes: 10 additions & 10 deletions apis/extension/qos.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/*
Copyright 2022 The Koordinator Authors.
Copyright 2022 The Koordinator Authors.
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
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
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.
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 extension
Expand Down
20 changes: 10 additions & 10 deletions apis/extension/resource.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/*
Copyright 2022 The Koordinator Authors.
Copyright 2022 The Koordinator Authors.
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
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
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.
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 extension
Expand Down
Loading

0 comments on commit 94bcf4d

Please sign in to comment.