-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (48 loc) · 1.35 KB
/
ci.yml
File metadata and controls
51 lines (48 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Test and coverage
on: [push, pull_request]
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 2
- uses: actions/setup-go@v6
with:
go-version: '1.26'
- name: Run unit tests with coverage
run: go test -coverpkg=./... ./... -race -coverprofile=coverage.out -covermode=atomic
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v6.0.0
with:
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
integration-tests:
runs-on: ubuntu-latest
services:
consul:
image: hashicorp/consul:1.22
ports:
- 8500:8500
options: >-
--health-cmd "consul members"
--health-interval 5s
--health-timeout 5s
--health-retries 10
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: '1.26'
- name: Wait for Consul
run: |
until curl -s http://localhost:8500/v1/status/leader | grep -q .; do
echo "Waiting for Consul..."
sleep 2
done
echo "Consul is ready"
- name: Run integration tests
run: go test -race -tags=integration ./...
env:
CONSUL_ADDR: 127.0.0.1:8500