Skip to content

Commit 60fe1ca

Browse files
committed
Basic implementation
1 parent bfbf8d0 commit 60fe1ca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+9908
-0
lines changed
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
3+
curl \
4+
--fail \
5+
--request POST \
6+
--header "Authorization: Basic $(echo -n 'root:${ARANGO_ROOT_PASSWORD}' | base64)" \
7+
--header 'Accept: application/json' \
8+
--data "{\"name\": \"${ARANGODB_CACHE_OPTION_DATABASE}\"}" \
9+
'http://arangodb:8529/_api/database'

.circleci/arangodb-wait.bash

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
3+
timeout \
4+
30 \
5+
$SHELL -c \
6+
-- \
7+
"while ! curl \
8+
--fail \
9+
--silent \
10+
--show-error \
11+
--header 'Authorization: Basic $(echo -n 'root:${ARANGO_ROOT_PASSWORD}' | base64)' \
12+
--header 'Accept: application/json' \
13+
'http://arangodb:8529/_api/version';
14+
do
15+
sleep 1;
16+
echo Waiting for ArangoDB on http://arangodb:8529;
17+
done;"

.circleci/config.yml

+245
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
2+
version: 2.1
3+
4+
.env_common: &env_common
5+
SHELL: '/bin/bash'
6+
7+
.env_composer: &env_composer
8+
COMPOSER_NO_INTERACTION: '1'
9+
COMPOSER_MEMORY_LIMIT: '-1'
10+
COMPOSER_DISABLE_XDEBUG_WARN: '1'
11+
12+
.env_arangodb_common: &env_arangodb_common
13+
ARANGO_ROOT_PASSWORD: 'root'
14+
15+
.env_arangodb_server: &env_arangodb_server
16+
ARANGO_NO_AUTH: 1
17+
18+
.env_arangodb_client: &env_arangodb_client
19+
ARANGODB_CACHE_OPTION_ENDPOINT: 'tcp://arangodb:8529'
20+
ARANGODB_CACHE_OPTION_AUTHUSER: 'root'
21+
ARANGODB_CACHE_OPTION_AUTHPASSWD: 'root'
22+
ARANGODB_CACHE_OPTION_DATABASE: 'cache'
23+
24+
.docker:
25+
php704: &docker_php704
26+
image: 'circleci/php:7.4'
27+
environment:
28+
<<: *env_common
29+
<<: *env_composer
30+
<<: *env_arangodb_common
31+
<<: *env_arangodb_client
32+
33+
php703: &docker_php703
34+
image: 'circleci/php:7.3'
35+
environment:
36+
<<: *env_common
37+
<<: *env_composer
38+
<<: *env_arangodb_common
39+
<<: *env_arangodb_client
40+
41+
arangodb703: &docker_arangodb307
42+
image: 'arangodb:3.7.3'
43+
environment:
44+
<<: *env_arangodb_common
45+
<<: *env_arangodb_server
46+
47+
orbs:
48+
codecov: codecov/[email protected]
49+
50+
executors:
51+
php704_arangodb307:
52+
docker:
53+
-
54+
name: 'main'
55+
<<: *docker_php704
56+
-
57+
name: 'arangodb'
58+
<<: *docker_arangodb307
59+
60+
php703:
61+
docker:
62+
-
63+
name: 'main'
64+
<<: *docker_php703
65+
66+
php703_arangodb307:
67+
docker:
68+
-
69+
name: 'main'
70+
<<: *docker_php703
71+
-
72+
name: 'arangodb'
73+
<<: *docker_arangodb307
74+
75+
commands:
76+
composer_install:
77+
description: 'Install Composer dependencies with cache restore and save'
78+
steps:
79+
-
80+
restore_cache:
81+
name: 'Composer - cache restore'
82+
keys:
83+
- 'composer-{{ checksum "./composer.lock" }}-1'
84+
85+
-
86+
run:
87+
name: 'Composer - install'
88+
command: >
89+
composer install --no-progress
90+
91+
-
92+
save_cache:
93+
name: 'Composer - cache save'
94+
key: 'composer-{{ checksum "./composer.lock" }}-1'
95+
paths:
96+
- '~/.composer/cache/'
97+
98+
99+
lint:
100+
description: 'Run linters'
101+
steps:
102+
-
103+
run:
104+
name: 'Run linters'
105+
command: 'bin/robo lint'
106+
107+
php_extension_igbinary:
108+
description: 'PHP extension - igbinary'
109+
steps:
110+
-
111+
run:
112+
name: 'PHP extension - igbinary - install'
113+
command: 'sudo pecl install igbinary'
114+
-
115+
run:
116+
name: 'PHP extension - igbinary - configure'
117+
command: |
118+
sudo ${SHELL} -c "echo 'extension=igbinary.so' > '/usr/local/etc/php/conf.d/igbinary.ini'"
119+
120+
php_extension_msgpack:
121+
description: 'PHP extension - msgpack'
122+
steps:
123+
-
124+
run:
125+
name: 'PHP extension - msgpack - install'
126+
command: 'sudo pecl install msgpack'
127+
-
128+
run:
129+
name: 'PHP extension - msgpack - configure'
130+
command: |
131+
sudo ${SHELL} -c "echo 'extension=msgpack.so' > '/usr/local/etc/php/conf.d/msgpack.ini'"
132+
133+
arangodb_wait:
134+
description: 'Wait until ArangoDB ready to serve'
135+
steps:
136+
-
137+
run:
138+
name: 'Wait until ArangoDB ready to serve'
139+
command: '. ./.circleci/arangodb-wait.bash'
140+
141+
arangodb_database_create:
142+
description: 'Create ArangoDB database'
143+
steps:
144+
-
145+
run:
146+
name: 'Create ArangoDB database'
147+
command: '. ./.circleci/arangodb-database-create.bash'
148+
149+
test:
150+
description: 'Run tests'
151+
steps:
152+
-
153+
run:
154+
name: 'Delete all the reports'
155+
command: 'rm -rf ./reports/'
156+
-
157+
run:
158+
name: 'Test - unit'
159+
command: 'bin/robo test Unit'
160+
-
161+
codecov/upload:
162+
flags: 'unit'
163+
file: './reports/machine/coverage/coverage.xml'
164+
-
165+
store_test_results:
166+
name: 'Store unit test results'
167+
path: './reports/machine/unit'
168+
-
169+
run:
170+
name: 'Delete all the reports'
171+
command: 'rm -rf ./reports/'
172+
-
173+
run:
174+
name: 'Test - acceptance'
175+
command: 'bin/robo test Acceptance'
176+
-
177+
codecov/upload:
178+
flags: 'acceptance'
179+
file: './reports/machine/coverage/coverage.xml'
180+
-
181+
store_test_results:
182+
name: 'Store unit test results'
183+
path: './reports/machine/unit'
184+
185+
jobs:
186+
dummy:
187+
executor: 'php703_arangodb307'
188+
working_directory: '~/repo'
189+
steps:
190+
- 'checkout'
191+
- 'arangodb_wait'
192+
- 'arangodb_database_create'
193+
build:
194+
executor: 'php703'
195+
working_directory: '~/repo'
196+
steps:
197+
- 'checkout'
198+
- 'composer_install'
199+
lint:
200+
executor: 'php703'
201+
working_directory: '~/repo'
202+
steps:
203+
- 'checkout'
204+
- 'composer_install'
205+
- 'lint'
206+
test_php704:
207+
executor: 'php704_arangodb307'
208+
working_directory: '~/repo'
209+
steps:
210+
- 'checkout'
211+
- 'php_extension_msgpack'
212+
- 'php_extension_igbinary'
213+
- 'composer_install'
214+
- 'arangodb_wait'
215+
- 'arangodb_database_create'
216+
- 'test'
217+
test_php703:
218+
executor: 'php703_arangodb307'
219+
working_directory: '~/repo'
220+
steps:
221+
- 'checkout'
222+
- 'php_extension_msgpack'
223+
- 'php_extension_igbinary'
224+
- 'composer_install'
225+
- 'arangodb_wait'
226+
- 'arangodb_database_create'
227+
- 'test'
228+
229+
workflows:
230+
lint_and_test:
231+
jobs:
232+
-
233+
build: {}
234+
-
235+
lint:
236+
requires:
237+
- build
238+
-
239+
test_php704:
240+
requires:
241+
- build
242+
-
243+
test_php703:
244+
requires:
245+
- build

.editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = LF
5+
indent_style = space
6+
indent_size = 4
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true

.gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
/bin/
3+
/reports/
4+
/tests/_data/actual/
5+
/tests/_envs/*.local.yml
6+
/tests/_output/
7+
/tests/_support/_generated/
8+
/vendor/
9+
10+
/.phpunit.result.cache
11+
/phpunit.xml

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Psr/Cache compatible pool implementation with ArangoDB
2+
3+
[![CircleCI](https://circleci.com/gh/sweetchuck/cache-backend-arangodb.svg?style=svg)](https://circleci.com/gh/sweetchuck/cache-backend-arangodb)
4+
[![codecov](https://codecov.io/gh/Sweetchuck/cache-backend-arangodb/branch/1.x/graph/badge.svg)](https://codecov.io/gh/Sweetchuck/cache-backend-arangodb)
5+
6+
7+
## Links
8+
9+
* [ArangoDB](https://www.arangodb.com/)
10+
* [PHP-FIG - Caching Interface](https://github.com/php-fig/cache)
11+
* [PHP Cache](http://www.php-cache.com/en/latest/)
12+
* [PHP Cache - Integration tests](https://github.com/php-cache/integration-tests)

0 commit comments

Comments
 (0)