-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (60 loc) · 1.84 KB
/
Copy pathci.yml
File metadata and controls
63 lines (60 loc) · 1.84 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
52
53
54
55
56
57
58
59
60
61
62
63
name: Test and coverage
on: [push, pull_request]
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.3
with:
fetch-depth: 2
- uses: actions/setup-go@v6.4.0
with:
go-version: '1.26'
- name: Run coverage
run: go env -w GOTOOLCHAIN=go1.25.0+auto && go test -coverpkg=./... ./... -race -coverprofile=coverage.out -covermode=atomic
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v7
with:
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
integration-tests:
runs-on: ubuntu-latest
needs: unit-tests
services:
vault:
image: hashicorp/vault:2.0
ports:
- 8200:8200
env:
VAULT_DEV_ROOT_TOKEN_ID: root-token
VAULT_DEV_LISTEN_ADDRESS: 0.0.0.0:8200
VAULT_ADDR: http://127.0.0.1:8200
options: >-
--cap-add=IPC_LOCK
--health-cmd="vault status"
--health-interval=2s
--health-timeout=5s
--health-retries=15
--add-host=host.docker.internal:host-gateway
steps:
- uses: actions/checkout@v6.0.3
- uses: actions/setup-go@v6.4.0
with:
go-version: '1.26'
- name: Wait for Vault to be ready
run: |
for i in {1..30}; do
if curl -s http://127.0.0.1:8200/v1/sys/health | grep -q "initialized"; then
echo "Vault is ready"
break
fi
echo "Waiting for Vault..."
sleep 1
done
- name: Run integration tests
env:
VAULT_ADDR: http://127.0.0.1:8200
VAULT_TOKEN: root-token
AUDIT_HOST: host.docker.internal
run: go env -w GOTOOLCHAIN=go1.25.0+auto && go test -tags=integration -v -race ./...