Browse code

added Drupal in the CI process

Fabien Potencier authored on 30/04/2019 14:00:26
Showing 2 changed files
... ...
@@ -7,20 +7,10 @@ cache:
7 7
         - vendor
8 8
         - $HOME/.composer/cache/files
9 9
 
10
-php:
11
-    - 5.4
12
-    - 5.5
13
-    - 5.6
14
-    - 7.0
15
-    - 7.1
16
-    - 7.2
17
-    - 7.3
18
-
19 10
 env:
20 11
     - TWIG_EXT=no
21 12
 
22 13
 before_install:
23
-    # turn off XDebug
24 14
     - phpenv config-rm xdebug.ini || return 0
25 15
 
26 16
 install:
... ...
@@ -32,12 +22,22 @@ before_script:
32 22
 
33 23
 script: ./vendor/bin/simple-phpunit
34 24
 
35
-matrix:
25
+jobs:
36 26
     fast_finish: true
37 27
     include:
38 28
         - php: 5.4
29
+        - php: 5.4
39 30
           env: TWIG_EXT=yes
40 31
         - php: 5.5
32
+        - php: 5.5
41 33
           env: TWIG_EXT=yes
42 34
         - php: 5.6
35
+        - php: 5.6
43 36
           env: TWIG_EXT=yes
37
+        - php: 7.0
38
+        - php: 7.1
39
+        - php: 7.2
40
+        - php: 7.3
41
+        - stage: integration tests
42
+          php: 7.3
43
+          script: ./drupal_test.sh
44 44
new file mode 100755
... ...
@@ -0,0 +1,51 @@
1
+#!/bin/bash
2
+
3
+set -x
4
+set -e
5
+
6
+REPO=`pwd`
7
+cd /tmp
8
+rm -rf drupal-twig-test
9
+composer create-project --no-interaction drupal-composer/drupal-project:8.x-dev drupal-twig-test
10
+cd drupal-twig-test
11
+(cd vendor/twig && rm -rf twig && ln -sf $REPO twig)
12
+echo '$config["system.logging"]["error_level"] = "verbose";' >> web/sites/default/settings.php
13
+php ./web/core/scripts/drupal install --no-interaction demo_umami 2>/dev/null > output
14
+perl -p -i -e 's/^([A-Za-z]+)\: (.+)$/export DRUPAL_\1=\2/' output
15
+source output
16
+
17
+wget https://get.symfony.com/cli/installer -O - | bash
18
+export PATH="$HOME/.symfony/bin:$PATH"
19
+symfony server:start -d --no-tls
20
+ENDPOINT=`symfony server:status -no-ansi | sed -E 's/^.+ http/http/'`
21
+
22
+curl -OLsS https://get.blackfire.io/blackfire-player.phar
23
+chmod +x blackfire-player.phar
24
+cat > drupal-tests.bkf <<EOF
25
+name "Drupal tests"
26
+
27
+scenario
28
+    name "homepage"
29
+    set name "admin"
30
+    set pass "pass"
31
+
32
+    visit url('/')
33
+        expect status_code() == 200
34
+    click link('Articles')
35
+        expect status_code() == 200
36
+    click link('Dairy-free and delicious milk chocolate')
37
+        expect body() matches "/Dairy\-free milk chocolate is made in largely the same way as regular chocolate/"
38
+        expect status_code() == 200
39
+    click link('Log in')
40
+        expect status_code() == 200
41
+    submit button("Log in")
42
+        param name name
43
+        param pass pass
44
+        expect status_code() == 303
45
+    follow
46
+        expect status_code() == 200
47
+    click link('Structure')
48
+        expect status_code() == 200
49
+EOF
50
+./blackfire-player.phar run drupal-tests.bkf --endpoint=$ENDPOINT --variable name=$DRUPAL_Username --variable pass=$DRUPAL_Password
51
+symfony server:stop