-
Notifications
You must be signed in to change notification settings - Fork 22
Initial push #1
Initial push #1
Changes from 4 commits
8c83a88
89d9804
21084a1
81c8bf2
05d2b5a
dcaf3ef
89cf6d1
a8ba9e3
c18cf70
47d21ef
ac6e1e9
3eee0da
b9ef158
371788c
90dece9
d86c1cf
d896625
6ea86f1
8f30bc1
b79782c
3576587
a4008f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Copyright (c) 2017 Intel Corporation | ||
|
||
# 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. | ||
# | ||
|
||
#!/bin/bash | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line is redundant as it's isn't the first - same comment applies to |
||
|
||
if [ ! $(command -v gometalinter) ] | ||
then | ||
go get github.com/alecthomas/gometalinter | ||
gometalinter --install --vendor | ||
fi | ||
|
||
linter_args="--tests --vendor" | ||
|
||
# When running the linters in a CI environment we need to disable them all | ||
# by default and then explicitly enable the ones we are care about. This is | ||
# necessary since *if* gometalinter adds a new linter, that linter may cause | ||
# the CI build to fail when it really shouldn't. However, when this script is | ||
# run locally, all linters should be run to allow the developer to review any | ||
# failures (and potentially decide whether we need to explicitly enable a new | ||
# linter in the CI). | ||
if [ "$CI" = true ]; then | ||
linter_args+=" --disable-all" | ||
fi | ||
|
||
linter_args+=" --enable=misspell" | ||
linter_args+=" --enable=vet" | ||
linter_args+=" --enable=ineffassign" | ||
linter_args+=" --enable=gofmt" | ||
linter_args+=" --enable=gocyclo" | ||
linter_args+=" --cyclo-over=15" | ||
linter_args+=" --enable=golint" | ||
linter_args+=" --deadline=600s" | ||
|
||
eval gometalinter "${linter_args}" ./... |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright (c) 2017 Intel Corporation | ||
|
||
# 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. | ||
# | ||
|
||
#!/bin/bash | ||
|
||
set -e | ||
|
||
test_packages=$(go list ./... | grep -v vendor) | ||
echo "Run go test and generate coverage:" | ||
for pkg in $test_packages; do | ||
if [ "$pkg" = "github.com/kata-containers/ksm-throttler" ]; then | ||
sudo env GOPATH=$GOPATH GOROOT=$GOROOT PATH=$PATH go test -cover -coverprofile=profile.cov $pkg | ||
else | ||
sudo env GOPATH=$GOPATH GOROOT=$GOROOT PATH=$PATH go test -cover $pkg | ||
fi | ||
done |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (c) 2017 Intel Corporation | ||
# | ||
# 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. | ||
# | ||
|
||
set -e | ||
|
||
cidir=$(dirname "$0") | ||
tests_repo="github.com/clearcontainers/tests" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Presumably this is just a temporary URL until we populate https://github.com/kata-containers/tests? |
||
|
||
# Clone Tests repository. | ||
go get "$tests_repo" | ||
|
||
tests_repo_dir="${GOPATH}/src/${tests_repo}" | ||
|
||
echo "Update proxy and runtime vendoring" | ||
sudo -E PATH=$PATH bash -c "${cidir}/update-vendoring.sh" | ||
|
||
pushd "${tests_repo_dir}" | ||
echo "Setup Clear Containers" | ||
sudo -E PATH=$PATH bash -c ".ci/setup.sh" | ||
popd | ||
|
||
echo "Setup virtcontainers environment" | ||
chronic sudo -E PATH=$PATH bash -c "${cidir}/../utils/virtcontainers-setup.sh" | ||
|
||
echo "Install virtcontainers" | ||
chronic make | ||
chronic sudo make install |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
language: go | ||
sudo: required | ||
go: | ||
- 1.7 | ||
- 1.8 | ||
- tip | ||
go_import_path: github.com/kata-containers/ksm-throttler | ||
|
||
before_install: | ||
- go get github.com/mattn/goveralls | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just an idea, but how about trying out codecov.io instead? clearcontainers/jenkins#28 Or we could run both and see how they compare? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added |
||
- go get golang.org/x/tools/cmd/cover | ||
- go get github.com/pierrre/gotestcover | ||
- go get github.com/fzipp/gocyclo | ||
- go get github.com/gordonklaus/ineffassign | ||
- go get github.com/golang/lint/golint | ||
- go get github.com/client9/misspell/cmd/misspell | ||
- go get github.com/ciao-project/ciao/test-cases | ||
|
||
install: | ||
- go_packages=$(go list ./... | grep -v vendor) | ||
- go_files=`go list -f '{{.Dir}}/*.go' $go_packages` | ||
- go get -t -v $go_packages | ||
|
||
script: | ||
- go env | ||
- misspell -error $go_packages | ||
- go vet $go_packages | ||
- if [[ "$TRAVIS_GO_VERSION" != "tip" ]] ; then golint $go_packages; fi | ||
- gocyclo -over 15 $go_files | ||
- go list -f '{{.Dir}}' $go_packages | xargs -L 1 ineffassign | ||
- gofmt -s -l $go_files | wc -l | xargs -I % bash -c "test % -eq 0" | ||
- make | ||
- make check | ||
- export GOROOT=`go env GOROOT` && sudo -E PATH=$PATH:$GOROOT/bin $GOPATH/bin/test-cases -v -timeout 9 -short -coverprofile /tmp/cover.out $go_packages | ||
|
||
after_success: | ||
- "$GOPATH/bin/goveralls -service=travis-ci -coverprofile=/tmp/cover.out" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
PREFIX := /usr | ||
BIN_DIR := $(PREFIX)/bin | ||
|
||
# | ||
# Pretty printing | ||
# | ||
|
||
V = @ | ||
Q = $(V:1=) | ||
QUIET_GOBUILD = $(Q:@=@echo ' GOBUILD '$@;) | ||
|
||
# | ||
# Build | ||
# | ||
|
||
all: build binaries | ||
|
||
build: | ||
$(QUIET_GOBUILD)go build $(go list ./... | grep -v /vendor/) | ||
|
||
throttler: | ||
$(QUIET_GOBUILD)go build -o ksm-throttler throttler.go ksm.go | ||
|
||
binaries: throttler | ||
|
||
# | ||
# Tests | ||
# | ||
|
||
check: check-go-static check-go-test | ||
|
||
check-go-static: | ||
bash .ci/go-lint.sh | ||
|
||
check-go-test: | ||
bash .ci/go-test.sh | ||
|
||
# | ||
# Clean | ||
# | ||
|
||
clean: | ||
rm -f ksm-throttler | ||
|
||
.PHONY: \ | ||
all \ | ||
build \ | ||
binaries \ | ||
check \ | ||
check-go-static \ | ||
check-go-test \ | ||
install \ | ||
uninstall \ | ||
clean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to keep that ?