@@ -15,15 +15,35 @@ jobs:
15
15
server :
16
16
- 7.2.2
17
17
runs-on : ubuntu-latest
18
- services :
19
- couchbase :
20
- image : couchbase:enterprise-${{ matrix.server }}
21
- ports :
22
- - 8091-8096:8091-8096
23
- - 18091-18096:18091-18096
24
- - 11210:11210
25
- - 11207:11207
26
18
steps :
19
+ - name : Install cbdinocluster
20
+ run : |
21
+ mkdir -p "$HOME/bin"
22
+ wget -nv -O $HOME/bin/cbdinocluster https://github.com/couchbaselabs/cbdinocluster/releases/download/v0.0.79/cbdinocluster-linux-amd64
23
+ chmod +x $HOME/bin/cbdinocluster
24
+ echo "$HOME/bin" >> $GITHUB_PATH
25
+ - name : Initialize cbdinocluster
26
+ run : |
27
+ cbdinocluster -v init --auto
28
+ - name : Start couchbase cluster
29
+ env :
30
+ CLUSTERCONFIG : |
31
+ nodes:
32
+ - count: 3
33
+ version: ${{ matrix.server }}
34
+ services: [kv, n1ql, index, fts, cbas]
35
+ docker:
36
+ kv-memory: 2048
37
+ run : |
38
+ CBDC_ID=$(cbdinocluster -v alloc --def="${CLUSTERCONFIG}")
39
+ cbdinocluster -v buckets add ${CBDC_ID} default --ram-quota-mb=100 --flush-enabled=true --num-replicas=2
40
+ cbdinocluster -v collections add ${CBDC_ID} default _default test
41
+ # we ignore errors here because the indexer might fail this with a 'automatically trying again later'
42
+ cbdinocluster -v query ${CBDC_ID} "CREATE PRIMARY INDEX ON default" || true
43
+ CBDC_IP=$(cbdinocluster -v ip $CBDC_ID)
44
+ echo "CBDC_ID=$CBDC_ID" >> "$GITHUB_ENV"
45
+ echo "CBDC_IP=$CBDC_IP" >> "$GITHUB_ENV"
46
+
27
47
- uses : actions/checkout@v4
28
48
with :
29
49
submodules : recursive
@@ -44,15 +64,22 @@ jobs:
44
64
- name : Generate Files
45
65
run : |
46
66
go generate ./...
47
- - name : Initialize Test Cluster
48
- run : ./.github/bin/init-cluster
49
- - name : Check Test Cluster
50
- run : ./.github/bin/check-cluster
51
- - name : Setup Cluster
52
- run : |
53
- curl -X POST -u Administrator:password http://127.0.0.1:8091/pools/default/buckets/default/scopes/_default/collections -d name=test
54
67
- name : Run Tests
55
68
timeout-minutes : 10
56
69
env :
57
- SGTEST_CBCONNSTR : 127.0.0.1
70
+ SGTEST_CBCONNSTR : ${{ env.CBDC_IP }}
58
71
run : go test -v $(go list ./... | grep -v /contrib/)
72
+
73
+ - name : Collect couchbase logs
74
+ timeout-minutes : 10
75
+ if : failure()
76
+ run : |
77
+ mkdir -p ./logs
78
+ cbdinocluster -v collect-logs $CBDC_ID ./logs
79
+ - name : Upload couchbase logs
80
+ if : failure()
81
+ uses : actions/upload-artifact@v4
82
+ with :
83
+ name : cbcollect-logs
84
+ path : ./logs/*
85
+ retention-days : 5
0 commit comments