diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 51c3fb2..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,70 +0,0 @@ -# Golang CircleCI 2.0 configuration file -# -# Check https://circleci.com/docs/2.0/language-go/ for more details -version: 2 -jobs: - build: - docker: - # specify the version - - image: circleci/golang:1.10 - - # Specify service dependencies here if necessary - # CircleCI maintains a library of pre-built images - # documented at https://circleci.com/docs/2.0/circleci-images/ - # - image: circleci/postgres:9.4 - - #### TEMPLATE_NOTE: go expects specific checkout path representing url - #### expecting it in the form of - #### /go/src/github.com/circleci/go-tool - #### /go/src/bitbucket.org/circleci/go-tool - working_directory: /go/src/github.com/aylei/kubectl-debug - environment: - - GOCACHE: "/tmp/go/cache" - - DEP_VERSION: 0.4.1 - steps: - - checkout - - - setup_remote_docker: - docker_layer_caching: true - - # try to restore cache - - restore_cache: - key: gopkg-{{ .Branch }}-{{ checksum "Gopkg.lock" }} - paths: - - /go/src/github.com/aylei/kubectl-debug/vendor - - # install dep and do dep ensure - - run: - name: dep-ensure - command: | - if [ ! -d /go/src/github.com/aylei/kubectl-debug/vendor ]; then - curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 -o /go/bin/dep - chmod +x /go/bin/dep - /go/bin/dep ensure - fi - - - save_cache: - key: gopkg-{{ .Branch }}-{{ checksum "Gopkg.lock" }} - paths: - - /go/src/github.com/aylei/kubectl-debug/vendor - - # cache for build - - restore_cache: - keys: - - build-cache-{{ .Branch }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }} - paths: - - /tmp/go/cache - - - run: GOOS=linux GARCH=amd64 go build -o debug-agent ./cmd/agent - - - deploy: - command: | - if [ "${CIRCLE_BRANCH}" == "master" ]; then - docker build . -t aylei/debug-agent - docker login -u ${DOCKER_USER} -p ${DOCKER_PASS} https://index.docker.io/v1/ - docker push aylei/debug-agent - - - save_cache: - key: build-cache-{{ .Branch }}-{{ .Environment.CIRCLE_BUILD_NUM }} - paths: - - /tmp/go/cache diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..652275e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,28 @@ +language: go + +go: + - "1.10.x" + +env: + - DEP_VERSION="0.4.1" + +before_install: + - curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 -o $GOPATH/bin/dep + - chmod +x $GOPATH/bin/dep + +install: + - dep ensure + +before_script: + - GO_FILES=$(find . -iname '*.go' -type f | grep -v /vendor/) # All the .go files, excluding vendor/ + - go get github.com/golang/lint/golint + - go get honnef.co/go/tools/cmd/megacheck + +script: + - test -z $(gofmt -s -l $GO_FILES) # Fail if a .go file hasn't been formatted with gofmt + - go test -v -race ./... # Run all the tests with the race detector enabled + - go vet ./... # go vet is the official Go static analyzer + - megacheck ./... # "go vet on steroids" + linter + - golint -set_exit_status $(go list ./...) # one last linter + +