|
| 1 | +version: 2.1 |
| 2 | +executors: |
| 3 | + base: |
| 4 | + docker: |
| 5 | + - image: circleci/golang:1.12 |
| 6 | + working_directory: /go/src/github.com/spatialcurrent/gocat |
| 7 | +jobs: |
| 8 | + pre_deps_golang: |
| 9 | + executor: base |
| 10 | + steps: |
| 11 | + - checkout |
| 12 | + - run: go get -d ./... |
| 13 | + - run: go get github.com/inconshreveable/mousetrap # for windows CLI builds |
| 14 | + - run: sudo chown -R circleci /go/src |
| 15 | + - save_cache: |
| 16 | + key: v1-go-src-{{ .Branch }}-{{ .Revision }} |
| 17 | + paths: |
| 18 | + - /go/src |
| 19 | + test: |
| 20 | + executor: base |
| 21 | + steps: |
| 22 | + - run: sudo chown -R circleci /go/src |
| 23 | + - restore_cache: |
| 24 | + keys: |
| 25 | + - v1-go-src-{{ .Branch }}-{{ .Revision }} |
| 26 | + - run: |
| 27 | + name: Get shadow |
| 28 | + command: go get golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow |
| 29 | + - run: |
| 30 | + name: Install shadow |
| 31 | + command: go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow |
| 32 | + - run: |
| 33 | + name: Download and install errcheck |
| 34 | + command: go get -u github.com/kisielk/errcheck |
| 35 | + - run: |
| 36 | + name: Download and install misspell |
| 37 | + command: go get -u github.com/client9/misspell/cmd/misspell |
| 38 | + - run: |
| 39 | + name: Download and install ineffassign |
| 40 | + command: go get -u github.com/gordonklaus/ineffassign |
| 41 | + - run: |
| 42 | + name: Download and install staticheck |
| 43 | + command: go get -u honnef.co/go/tools/cmd/staticcheck |
| 44 | + - run: bash scripts/test.sh |
| 45 | + validate: |
| 46 | + executor: base |
| 47 | + steps: |
| 48 | + - run: sudo chown -R circleci /go/src |
| 49 | + - restore_cache: |
| 50 | + keys: |
| 51 | + - v1-go-src-{{ .Branch }}-{{ .Revision }} |
| 52 | + - run: |
| 53 | + name: Install Dig |
| 54 | + command: sudo apt update && sudo apt install dnsutils |
| 55 | + - run: |
| 56 | + name: "Update ~/.ssh/known_hosts" |
| 57 | + command: | |
| 58 | + mkdir ~/.ssh/ |
| 59 | + touch ~/.ssh/known_hosts |
| 60 | + for ip in $(dig @8.8.8.8 github.com +short); do ssh-keyscan github.com,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts |
| 61 | + - run: go get github.com/spatialcurrent/go-header/... |
| 62 | + - run: go install github.com/spatialcurrent/go-header/cmd/goheader |
| 63 | + - run: goheader fix --fix-year 2019 --exit-code-on-changes 1 --verbose |
| 64 | + build_cli: |
| 65 | + executor: base |
| 66 | + steps: |
| 67 | + - run: sudo chown -R circleci /go/src |
| 68 | + - restore_cache: |
| 69 | + keys: |
| 70 | + - v1-go-src-{{ .Branch }}-{{ .Revision }} |
| 71 | + - run: bash scripts/build_cli.sh |
| 72 | + - store_artifacts: |
| 73 | + path: bin |
| 74 | + destination: / |
| 75 | +workflows: |
| 76 | + main: |
| 77 | + jobs: |
| 78 | + - pre_deps_golang |
| 79 | + - test: |
| 80 | + requires: |
| 81 | + - pre_deps_golang |
| 82 | + - validate: |
| 83 | + requires: |
| 84 | + - pre_deps_golang |
| 85 | + - build_cli: |
| 86 | + requires: |
| 87 | + - pre_deps_golang |
0 commit comments