...
1name: CI
2
3on:
4 push:
5 branches:
6 - master
7 pull_request:
8
9jobs:
10 build:
11 name: Build
12 runs-on: ubuntu-latest
13 strategy:
14 matrix: # Support latest and one minor back
15 go: ["1.17", "1.18", "1.19"]
16 env:
17 GOFLAGS: -mod=readonly
18
19 services:
20 etcd:
21 image: gcr.io/etcd-development/etcd:v3.5.0
22 ports:
23 - 2379
24 env:
25 ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379
26 ETCD_ADVERTISE_CLIENT_URLS: http://0.0.0.0:2379
27 options: --health-cmd "ETCDCTL_API=3 etcdctl --endpoints http://localhost:2379 endpoint health" --health-interval 10s --health-timeout 5s --health-retries 5
28
29 consul:
30 image: consul:1.10
31 ports:
32 - 8500
33
34 zk:
35 image: zookeeper:3.5
36 ports:
37 - 2181
38
39 eureka:
40 image: springcloud/eureka
41 ports:
42 - 8761
43 env:
44 eureka.server.responseCacheUpdateIntervalMs: 1000
45
46 steps:
47 - name: Set up Go
48 uses: actions/setup-go@v2.1.3
49 with:
50 stable: "false"
51 go-version: ${{ matrix.go }}
52
53 - name: Checkout code
54 uses: actions/checkout@v2
55
56 - name: Run tests
57 env:
58 ETCD_ADDR: http://localhost:${{ job.services.etcd.ports[2379] }}
59 CONSUL_ADDR: localhost:${{ job.services.consul.ports[8500] }}
60 ZK_ADDR: localhost:${{ job.services.zk.ports[2181] }}
61 EUREKA_ADDR: http://localhost:${{ job.services.eureka.ports[8761] }}/eureka
62 run: go test -v -race -coverprofile=coverage.coverprofile -covermode=atomic -tags integration ./...
63
64 - name: Upload coverage
65 uses: codecov/codecov-action@v1
66 with:
67 token: ${{ secrets.CODECOV_TOKEN }}
68 file: coverage.coverprofile
View as plain text