Skip to content

Commit fdb10c9

Browse files
authored
Merge pull request #4 from thanhthanh-yen/master
Add automation test environment with GithubAction for PHP 0.8
2 parents 7c61ead + a8a2ebe commit fdb10c9

File tree

6 files changed

+155
-0
lines changed

6 files changed

+155
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh -xe
2+
3+
params="$GRIDDB_NOTIFICATION_ADDRESS $GRIDDB_NOTIFICATION_PORT $GRIDDB_CLUSTER_NAME $GRIDDB_USERNAME $GRIDDB_PASSWORD"
4+
test_folder=sample
5+
6+
test_files=$(cat <<-END
7+
BlobData.php
8+
Connect.php
9+
ContainerInformation.php
10+
ContainerNames.php
11+
CreateCollection.php
12+
CreateIndex.php
13+
CreateTimeSeries.php
14+
GetRow.php
15+
PutRow.php
16+
RemoveRowByRowkey.php
17+
RemoveRowByTQL.php
18+
TimeSeriesRowExpiration.php
19+
TQLAggregation.php
20+
TQLSelect.php
21+
TQLTimeseries.php
22+
UpdateRowByTQL.php
23+
sample1.php
24+
sample2.php
25+
sample3.php
26+
END
27+
)
28+
29+
for test_file in $test_files; do
30+
php $test_folder/$test_file $params
31+
done
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/sh -xe
2+
3+
test_folder=test/testCode
4+
5+
test_files=$(cat <<-END
6+
BS001ContainerBasicScenario.php
7+
BS004ContainerPutGet.php
8+
BS004ContainerPutGetNullSpec.php
9+
BS005ContainerIndex.php
10+
BS007AggregationWithDoubleTimestamp.php
11+
BS008ContainerPutGetRemoveSpec.php
12+
BS009RowSetManualCommitSpec.php
13+
BS010QueryWithLimitSpec.php
14+
BS012ErrorUtilitySpec.php
15+
BS013PartitionController.php
16+
BS015ContainerInfoSetGetSpec.php
17+
BS016ExpirationInfoSetGetSpec.php
18+
BS018EnumSpec.php
19+
BS019AttributeSpec.php
20+
BS021KeywordParametersSpec.php
21+
END
22+
)
23+
24+
for test_file in $test_files; do
25+
phpunit $test_folder/$test_file
26+
done
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
name: Install GridDB server, C client, build PHP client and execute test
3+
4+
on: [push]
5+
6+
jobs:
7+
build:
8+
9+
runs-on: ubuntu-18.04
10+
env:
11+
GRIDDB_NOTIFICATION_ADDRESS: "239.0.0.1"
12+
GRIDDB_NOTIFICATION_PORT: "31999"
13+
GRIDDB_CLUSTER_NAME: "griddbubuntu"
14+
GRIDDB_USERNAME: "admin"
15+
GRIDDB_PASSWORD: "admin"
16+
17+
steps:
18+
- uses: actions/checkout@v1
19+
20+
- name: Setup environment
21+
run: |
22+
./.github/workflows/setup_environment.sh
23+
24+
- name: Install and start server
25+
run: |
26+
./.github/workflows/start_server.sh
27+
28+
- name: Build GridDB PHP client and export library
29+
run: |
30+
make
31+
echo "extension=/home/runner/work/php_client/php_client/griddb_php_client.so" | sudo tee -a /etc/php/7.4/cli/php.ini
32+
33+
- name: Run GridDB PHP samples
34+
run: |
35+
./.github/workflows/auto_test_samples.sh
36+
37+
- name: Execute scenario-base-test
38+
run: |
39+
./.github/workflows/auto_test_scenario-base-test.sh
40+
41+
- name: Stop server
42+
run: |
43+
./.github/workflows/stop_server.sh
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/sh -xe
2+
3+
# Install dependences
4+
sudo apt-get install gcc-4.8
5+
sudo apt-get install g++-4.8
6+
7+
# Install C client
8+
wget https://download.opensuse.org/repositories/home:/knonomura/xUbuntu_18.04/amd64/griddb-c-client_4.5.0_amd64.deb
9+
sudo dpkg -i griddb-c-client_4.5.0_amd64.deb
10+
11+
# Install SWIG
12+
wget https://prdownloads.sourceforge.net/swig/swig-4.0.0.tar.gz
13+
tar xvfz swig-4.0.0.tar.gz
14+
cd swig-4.0.0
15+
./configure
16+
make
17+
sudo make install
18+
cd ..
19+
20+
# Install PHP
21+
sudo apt-get update
22+
sudo apt -y install software-properties-common
23+
sudo apt-add-repository ppa:ondrej/php
24+
sudo apt-get update
25+
sudo apt -y install php7.4
26+
27+
# Install PHP composer
28+
curl -sS https://getcomposer.org/installer | sudo php
29+
sudo mv composer.phar /usr/local/bin/composer
30+
sudo chmod +x /usr/local/bin/composer
31+
32+
# Install Zend Framework
33+
composer require zendframework/zendframework
34+
sudo mv /usr/include/php/20190902/* /usr/include/php/
35+
phpunit --version
36+

.github/workflows/start_server.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh -xe
2+
3+
# Install GridDB sever
4+
wget https://github.com/griddb/griddb/releases/download/v4.5.0/griddb_4.5.0_amd64.deb
5+
sudo dpkg -i griddb_4.5.0_amd64.deb
6+
7+
# Start server
8+
sudo su - gsadm -c "gs_passwd admin -p $GRIDDB_PASSWORD"
9+
sudo su - gsadm -c "sed -i 's/\"clusterName\":\"\"/\"clusterName\":\"$GRIDDB_CLUSTER_NAME\"/g' conf/gs_cluster.json"
10+
sudo su - gsadm -c "export no_proxy=127.0.0.1"
11+
sudo su - gsadm -c "gs_startnode -u $GRIDDB_USERNAME/$GRIDDB_PASSWORD -w"
12+
sudo su - gsadm -c "gs_joincluster -c $GRIDDB_CLUSTER_NAME -u $GRIDDB_USERNAME/$GRIDDB_PASSWORD"

.github/workflows/stop_server.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh -xe
2+
3+
export GS_HOME=$PWD
4+
export GS_LOG=$PWD/log
5+
6+
sudo su - gsadm -c "gs_stopcluster -u $GRIDDB_USERNAME/$GRIDDB_PASSWORD"
7+
sudo su - gsadm -c "gs_stopnode -u $GRIDDB_USERNAME/$GRIDDB_PASSWORD"

0 commit comments

Comments
 (0)