github.com/mier85/go-sensor@v1.30.1-0.20220920111756-9bf41b3bc7e0/.circleci/config.yml (about) 1 version: 2.1 2 3 jobs: 4 build: 5 description: "Run Go unit and integration tests using make targets" 6 parameters: 7 image: 8 description: "Image to use (1.x)" 9 type: string 10 go111module: 11 description: "GO111MODULE= env var value" 12 default: "auto" 13 type: enum 14 enum: ["on", "off", "auto"] 15 vendor_deps: 16 description: "Whether to vendor dependencies before running tests" 17 default: "no" 18 type: enum 19 enum: ["yes", "no"] 20 exclude_dirs: 21 description: "A space-separated list of directories to ignore" 22 default: "" 23 type: string 24 docker: 25 - image: << parameters.image >> 26 user: root 27 - image: postgres:14 28 environment: 29 POSTGRES_USER: postgres 30 POSTGRES_DB: postgres 31 POSTGRES_PASSWORD: mysecretpassword 32 working_directory: /go/src/github.com/mier85/go-sensor 33 steps: 34 - checkout 35 - run: 36 name: Waiting for Postgres to be ready 37 command: | 38 for i in `seq 1 10`; 39 do 40 nc -z localhost 5432 && echo Success && exit 0 41 echo -n . 42 sleep 1 43 done 44 echo Failed waiting for Postgress && exit 1 45 46 - restore_cache: 47 keys: 48 - go-mod-v4-{{ checksum "go.sum" }} 49 - run: 50 command: apt-get --allow-releaseinfo-change-suite update -y && apt-get install ca-certificates libgnutls30 -y || true 51 - run: 52 name: Run unit tests 53 environment: 54 RUN_LINTER: yes 55 GO111MODULE: << parameters.go111module >> 56 VENDOR_DEPS: << parameters.vendor_deps >> 57 EXCLUDE_DIRS: << parameters.exclude_dirs >> 58 command: make test 59 - run: 60 name: Run integration tests 61 command: make integration 62 environment: 63 GO111MODULE: << parameters.go111module >> 64 VENDOR_DEPS: << parameters.vendor_deps >> 65 EXCLUDE_DIRS: << parameters.exclude_dirs >> 66 - save_cache: 67 key: go-mod-v4-{{ checksum "go.sum" }} 68 paths: 69 - "/go/pkg/mod" 70 71 workflows: 72 version: 2 73 build: 74 jobs: 75 - build: 76 name: "go1.19" 77 image: "cimg/go:1.19" 78 - build: 79 name: "go1.18" 80 image: "cimg/go:1.18" 81 - build: 82 name: "go1.17" 83 image: "circleci/golang:1.17" 84 - build: 85 name: "go1.16" 86 image: "circleci/golang:1.16" 87 - build: 88 name: "go1.15" 89 image: "circleci/golang:1.15" 90 exclude_dirs: "./instrumentation/instaredigo" 91 - build: 92 name: "go1.14" 93 image: "circleci/golang:1.14" 94 exclude_dirs: "./example/echo ./instrumentation/instaecho ./instrumentation/instaredigo" 95 - build: 96 name: "go1.13" 97 image: "circleci/golang:1.13" 98 exclude_dirs: "./example/echo ./instrumentation/instaecho ./instrumentation/instaredigo" 99 - build: 100 name: "go1.12" 101 image: "circleci/golang:1.12" 102 go111module: "on" 103 exclude_dirs: "./example/echo ./instrumentation/instaecho ./instrumentation/instapgx ./instrumentation/instaredigo" 104 - build: 105 name: "go1.11" 106 image: "circleci/golang:1.11" 107 go111module: "on" 108 exclude_dirs: "./example/gorillamux ./instrumentation/instamux ./example/echo ./instrumentation/instaecho ./instrumentation/instapgx ./instrumentation/instaredigo" 109 - build: 110 name: "go1.10" 111 image: "circleci/golang:1.10" 112 vendor_deps: "yes" 113 exclude_dirs: "./instrumentation/cloud.google.com/go ./example/gin ./instrumentation/instagin ./example/gorillamux ./instrumentation/instamux ./example/echo ./instrumentation/instaecho ./instrumentation/instapgx ./instrumentation/instaredigo" 114 - build: 115 name: "go1.9" 116 image: "circleci/golang:1.9" 117 vendor_deps: "yes" 118 exclude_dirs: "./instrumentation/cloud.google.com/go ./instrumentation/instagin ./example/http-database-greeter ./example/grpc-client-server ./example/grpc-client-server/pb ./example/gin ./example/gorillamux ./instrumentation/instamux ./example/echo ./instrumentation/instaecho ./instrumentation/instapgx ./instrumentation/instaredigo"