Skip to content

Commit bb27e97

Browse files
committed
Update GitHub Actions workflow and Couchbase configuration
1 parent ec1c651 commit bb27e97

File tree

2 files changed

+79
-12
lines changed

2 files changed

+79
-12
lines changed

.github/workflows/tests.yaml

Lines changed: 78 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,96 @@
11
name: Tests
2+
23
on:
34
push:
4-
workflow_dispatch:
5-
schedule:
6-
- cron: "0 0 * * 0"
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
schedule:
9+
- cron: "0 */6 * * *"
10+
711
jobs:
812
run_tests:
913
name: Run Tests
1014
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
java-version: ["8", "11", "17"]
1118
steps:
12-
- uses: actions/checkout@v2
13-
- name: Set up JDK 17
14-
uses: actions/setup-java@v2
19+
- name: Update repositories
20+
run: |
21+
apt update || echo "apt-update failed" # && apt -y upgrade
22+
23+
- name: Set up JDK ${{ matrix.java-version }}
24+
uses: actions/setup-java@v4
1525
with:
16-
java-version: 17
17-
distribution: 'adopt'
26+
java-version: ${{ matrix.java-version }}
27+
distribution: "adopt"
1828
cache: gradle
19-
- id: run
29+
30+
- name: Checkout ${{ github.event.repository.name }}
31+
uses: actions/checkout@v4
32+
33+
- name: Setup couchbase
2034
run: |
21-
./gradlew --no-daemon test
35+
apt install -y iputils-ping || echo "apt-install failed"
36+
ping -c 1 couchbase && (
37+
apt install -y socat
38+
socat TCP-LISTEN:8091,fork TCP:couchbase:8091 &
39+
socat TCP-LISTEN:8092,fork TCP:couchbase:8092 &
40+
socat TCP-LISTEN:8093,fork TCP:couchbase:8093 &
41+
socat TCP-LISTEN:8094,fork TCP:couchbase:8094 &
42+
socat TCP-LISTEN:8095,fork TCP:couchbase:8095 &
43+
socat TCP-LISTEN:8096,fork TCP:couchbase:8096 &
44+
socat TCP-LISTEN:9140,fork TCP:couchbase:9140 &
45+
socat TCP-LISTEN:11210,fork TCP:couchbase:11210 &
46+
socat TCP-LISTEN:11211,fork TCP:couchbase:11211 &
47+
socat TCP-LISTEN:11207,fork TCP:couchbase:11207 &
48+
socat TCP-LISTEN:18091,fork TCP:couchbase:18091 &
49+
socat TCP-LISTEN:18092,fork TCP:couchbase:18092 &
50+
socat TCP-LISTEN:18093,fork TCP:couchbase:18093 &
51+
socat TCP-LISTEN:18094,fork TCP:couchbase:18094 &
52+
socat TCP-LISTEN:18095,fork TCP:couchbase:18095 &
53+
socat TCP-LISTEN:18096,fork TCP:couchbase:18096 &
54+
) && echo "Initialized couchbase port forwarding" || echo "ping couchbase failed, not forwarding ports"
55+
printf "Waiting for CB startup..."
56+
wget -O /dev/null http://localhost:8091/ && echo "DONE" || (echo "FAIL" && panic)
57+
curl -v -X POST http://localhost:8091/node/controller/setupServices -d 'services=kv%2Cn1ql%2Cindex'
58+
curl -v -X POST http://localhost:8091/pools/default -d 'memoryQuota=256' -d 'indexMemoryQuota=256'
59+
curl -u Administrator:password -v -X POST http://localhost:8091/settings/web -d 'password=password&username=Administrator&port=SAME'
60+
curl -v -X POST http://localhost:8091/pools/default/buckets \
61+
-u Administrator:password \
62+
-d name=user_profile \
63+
-d bucketType=couchbase\
64+
-d ramQuotaMB=1024 \
65+
-d durabilityMinLevel=majorityAndPersistActive
66+
curl -u Administrator:password -v -X POST http://localhost:8091/settings/indexes -d 'storageMode=memory_optimized'
67+
curl -u Administrator:password -v -X GET http://localhost:8091/pools/default | jq '.' | grep hostname
68+
curl -u Administrator:password -v -X POST http://localhost:8091/sampleBuckets/install -d '["travel-sample"]'
69+
70+
- name: Run Gradle Tests
71+
id: run
72+
run: ./gradlew --no-daemon test
73+
2274
- name: Report Status
2375
if: always()
2476
uses: ravsamhq/notify-slack-action@v1
2577
with:
2678
status: ${{ job.status }}
27-
notify_when: 'failure'
79+
notify_when: "failure"
2880
env:
2981
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
82+
83+
services:
84+
couchbase:
85+
image: public.ecr.aws/z2f7n8a1/couchbase-da-containers:couchbase-neo
86+
options: >-
87+
--health-cmd "wget -q -O - localhost:8091"
88+
--health-interval 10s
89+
--health-timeout 5s
90+
--health-retries 10
91+
ports:
92+
- 8091-8096
93+
- 9140
94+
- 11210-11211
95+
- 11207
96+
- 18091-18096

src/main/resources/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ server.use-forward-headers=true
22
server.forward-headers-strategy=framework
33
spring.couchbase.bootstrap-hosts=localhost
44
spring.couchbase.bucket.name=travel-sample
5-
spring.couchbase.bucket.user=kaustav
5+
spring.couchbase.bucket.user=Administrator
66
spring.couchbase.bucket.password=password
77
spring.couchbase.scope.name=inventory
88
spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER

0 commit comments

Comments
 (0)