Skip to content

Commit cfbf742

Browse files
committed
Updated CI script
1 parent bf8792c commit cfbf742

File tree

2 files changed

+83
-0
lines changed

2 files changed

+83
-0
lines changed

.github/workflows/php.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ permissions:
1212
jobs:
1313
run:
1414
runs-on: ${{ matrix.operating-system }}
15+
timeout-minutes: 60
1516
strategy:
1617
matrix:
1718
operating-system: [ubuntu-latest]
@@ -24,6 +25,9 @@ jobs:
2425
- name: Checkout
2526
uses: actions/checkout@v3
2627

28+
- name: Install Couchbase Server
29+
run: ./tests/Scripts/install_couchbase.sh
30+
2731
- name: Setup cache environment
2832
id: extcache
2933
uses: shivammathur/cache-extensions@v1

tests/Scripts/install_couchbase.sh

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# https://packages.couchbase.com/releases/7.1.1/couchbase-server-community_7.1.1-ubuntu18.04_amd64.deb
6+
export CB_VERSION=7.1.1
7+
export CB_RELEASE_URL=https://packages.couchbase.com/releases
8+
export CB_PACKAGE=couchbase-server-community_7.1.1-ubuntu18.04_amd64.deb
9+
10+
# Community Edition requires that all nodes provision all services or data service only
11+
export SERVICES="kv,n1ql,index,fts"
12+
13+
export USERNAME=test
14+
export PASSWORD=phpfastcache
15+
16+
export MEMORY_QUOTA=256
17+
export INDEX_MEMORY_QUOTA=256
18+
export FTS_MEMORY_QUOTA=256
19+
20+
21+
# Check if couchbase server is up
22+
check_db() {
23+
curl --silent http://127.0.0.1:8091/pools > /dev/null
24+
echo $?
25+
}
26+
27+
# Variable used in echo
28+
i=1
29+
# Echo with
30+
numbered_echo() {
31+
echo "[$i] $*"
32+
i=$(($i+1))
33+
}
34+
35+
echo "# Prepare Couchbase dependencies"
36+
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A3FAA648D9223EDA
37+
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1616981CC4A088B2
38+
echo "deb https://packages.couchbase.com/ubuntu bionic bionic/main" | sudo tee /etc/apt/sources.list.d/couchbase.list
39+
echo "deb https://packages.couchbase.com/clients/c/repos/deb/ubuntu1804 bionic bionic/main" | sudo tee /etc/apt/sources.list.d/couchbase.list
40+
sudo apt-get update
41+
sudo apt-get install -yq libcouchbase3 libcouchbase-dev build-essential libssl1.1 runit wget python3-httplib2 chrpath tzdata lsof lshw sysstat net-tools numactl libtinfo5
42+
43+
echo "# Downloading couchbase v${CB_VERSION}"
44+
wget -q -N $CB_RELEASE_URL/$CB_VERSION/$CB_PACKAGE
45+
sudo dpkg -i ./$CB_PACKAGE && rm -f ./$CB_PACKAGE
46+
47+
# Wait until it's ready
48+
until [[ $(check_db) = 0 ]]; do
49+
>&2 numbered_echo "Waiting for Couchbase Server to be available"
50+
sleep 1
51+
done
52+
53+
echo "# Couchbase Server Online"
54+
echo "# Starting setup process"
55+
echo "# 1) Setting up memory"
56+
curl -i "http://127.0.0.1:8091/pools/default" \
57+
-d memoryQuota=${MEMORY_QUOTA} \
58+
-d indexMemoryQuota=${INDEX_MEMORY_QUOTA} \
59+
-d ftsMemoryQuota=${FTS_MEMORY_QUOTA}
60+
61+
echo "# 2) Setting up services"
62+
curl -i "http://127.0.0.1:8091/node/controller/setupServices" \
63+
-d services="${SERVICES}"
64+
65+
echo "# 3) Setting up user credentials"
66+
curl -i "http://127.0.0.1:8091/settings/web" \
67+
-d port=8091 \
68+
-d username=${USERNAME} \
69+
-d password=${PASSWORD}
70+
71+
echo "# 4) Setting up the bucket"
72+
curl -i "http://127.0.0.1:8091/pools/default/buckets" \
73+
-d name=phpfastcache \
74+
-d ramQuotaMB=256 \
75+
-d flushEnabled=1 \
76+
-u ${USERNAME}:${PASSWORD} \
77+
78+
79+
echo "# Couchbase running successfully"

0 commit comments

Comments
 (0)