-
Notifications
You must be signed in to change notification settings - Fork 14
225 lines (192 loc) · 9.25 KB
/
TestPHPUnit.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
name: Test PHPUnit Integration
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
Test-PHPUnit-Functional:
runs-on: ubuntu-22.04
strategy:
matrix:
drupal-version: [ 10, 11 ]
steps:
- name: Install xmllint
run: sudo apt-get update && sudo apt-get install -y libxml2-utils
- name: Create a Drupal project
run: composer create-project drupal/recommended-project:^${{ matrix.drupal-version }} . --ignore-platform-reqs
- uses: actions/checkout@v4
with:
path: drainpipe
- name: Setup drainpipe-dev
run: mv drainpipe/drainpipe-dev .
- uses: ./drainpipe/scaffold/github/actions/common/set-env
- name: Install DDEV
uses: ./drainpipe/scaffold/github/actions/common/ddev
with:
git-name: Drainpipe Bot
git-email: no-reply@example.com
- name: Setup Project
run: |
ddev config --auto
ddev start
ddev composer config extra.drupal-scaffold.gitignore true
ddev composer config --json extra.drupal-scaffold.allowed-packages '["lullabot/drainpipe-dev", "lullabot/drainpipe"]'
ddev composer config --no-plugins allow-plugins.composer/installers true
ddev composer config --no-plugins allow-plugins.drupal/core-composer-scaffold true
ddev composer config --no-plugins allow-plugins.lullabot/drainpipe true
ddev composer config --no-plugins allow-plugins.lullabot/drainpipe-dev true
ddev composer config repositories.drainpipe --json '{"type": "path", "url": "drainpipe", "options": {"symlink": false}}'
ddev composer config repositories.drainpipe-dev --json '{"type": "path", "url": "drainpipe-dev", "options": {"symlink": false}}'
ddev composer config minimum-stability dev
ddev composer require "lullabot/drainpipe @dev" --with-all-dependencies
ddev composer require "lullabot/drainpipe-dev @dev" --dev --with-all-dependencies
# Restart is required to enable the provided Selenium containers
ddev restart
- name: Add Custom Testing Module
run: |
mkdir web/modules/custom
cp -R drainpipe/tests/fixtures/phpunit/testmodule web/modules/custom/
cp drainpipe/tests/fixtures/phpunit/Taskfile.yml .
- name: Run PHPUnit Functional Tests
run: |
ddev drush site:install -y
ddev drush user:password admin password
ddev task test:phpunit:functional format=junit
docker logs ddev-drainpipe-chrome | tee test_result/ddev-chrome.log
docker logs ddev-drainpipe-firefox | tee test_result/ddev-firefox.log
- name: Upload test artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: test_result-phpunit-functional-${{ matrix.drupal-version }}
path: test_result
- name: Confirm All PHPUnit Functional Tests were run
uses: GuillaumeFalourd/assert-command-line-output@v2.4
with:
command_line: xmllint --xpath 'string(//testsuites/testsuite/@tests)' test_result/phpunit-functional.xml
contains: 6
expected_result: PASSED
Test-PHPUnit-Functional-DTT:
runs-on: ubuntu-22.04
strategy:
matrix:
drupal-version: [ 10, 11 ]
steps:
- name: Install xmllint
run: sudo apt-get update && sudo apt-get install -y libxml2-utils
- name: Create a Drupal project
run: composer create-project drupal/recommended-project . --ignore-platform-req=ext-gd
- uses: actions/checkout@v4
with:
path: drainpipe
- name: Setup drainpipe-dev
run: mv drainpipe/drainpipe-dev .
- name: Install DDEV
uses: ./drainpipe/scaffold/github/actions/common/ddev
with:
git-name: Drainpipe Bot
git-email: no-reply@example.com
- name: Setup Project
run: |
ddev config --auto
ddev start
ddev composer config extra.drupal-scaffold.gitignore true
ddev composer config --json extra.drupal-scaffold.allowed-packages '["lullabot/drainpipe-dev", "lullabot/drainpipe", "weitzman/drupal-test-traits"]'
ddev composer config --no-plugins allow-plugins.composer/installers true
ddev composer config --no-plugins allow-plugins.drupal/core-composer-scaffold true
ddev composer config --no-plugins allow-plugins.lullabot/drainpipe true
ddev composer config --no-plugins allow-plugins.lullabot/drainpipe-dev true
ddev composer config --no-plugins allow-plugins.weitzman/drupal-test-traits true
ddev composer config repositories.drainpipe --json '{"type": "path", "url": "drainpipe", "options": {"symlink": false}}'
ddev composer config repositories.drainpipe-dev --json '{"type": "path", "url": "drainpipe-dev", "options": {"symlink": false}}'
ddev composer config minimum-stability dev
ddev composer require "lullabot/drainpipe @dev" --with-all-dependencies
ddev composer require "lullabot/drainpipe-dev @dev" weitzman/drupal-test-traits lullabot/mink-selenium2-driver --dev --with-all-dependencies
# Restart is required to enable the provided Selenium containers
ddev restart
- name: Add Custom Testing Module
run: |
mkdir web/modules/custom
cp -R drainpipe/tests/fixtures/phpunit/testmodule web/modules/custom/
cp drainpipe/tests/fixtures/phpunit/Taskfile-testtraits.yml Taskfile.yml
- name: Run PHPUnit Functional Tests
run: |
ddev drush site:install -y
ddev drush user:password admin password
ddev task test:phpunit:functional format=junit
docker logs ddev-drainpipe-chrome | tee test_result/ddev-chrome.log
docker logs ddev-drainpipe-firefox | tee test_result/ddev-firefox.log
- name: Upload test artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: test_result-phpunit-dtt-${{ matrix.drupal-version }}
path: test_result
- name: Confirm All PHPUnit Functional Tests were run
uses: GuillaumeFalourd/assert-command-line-output@v2
with:
command_line: xmllint --xpath 'string(//testsuites/testsuite/@tests)' test_result/phpunit-functional.xml
contains: 9
expected_result: PASSED
Test-PHPUnit-Static:
runs-on: ubuntu-22.04
strategy:
matrix:
drupal-version: [ 10, 11 ]
steps:
- name: Install xmllint
run: sudo apt-get update && sudo apt-get install -y libxml2-utils
- name: Create a Drupal project
run: composer create-project drupal/recommended-project . --ignore-platform-req=ext-gd
- uses: actions/checkout@v4
with:
path: drainpipe
- name: Setup drainpipe-dev
run: mv drainpipe/drainpipe-dev .
- uses: ./drainpipe/scaffold/github/actions/common/set-env
- name: Install DDEV
uses: ./drainpipe/scaffold/github/actions/common/ddev
with:
git-name: Drainpipe Bot
git-email: no-reply@example.com
- name: Setup Project
run: |
ddev config --auto
ddev start
ddev composer config extra.drupal-scaffold.gitignore true
ddev composer config --json extra.drupal-scaffold.allowed-packages '["lullabot/drainpipe-dev", "lullabot/drainpipe"]'
ddev composer config --no-plugins allow-plugins.composer/installers true
ddev composer config --no-plugins allow-plugins.drupal/core-composer-scaffold true
ddev composer config --no-plugins allow-plugins.lullabot/drainpipe true
ddev composer config --no-plugins allow-plugins.lullabot/drainpipe-dev true
ddev composer config repositories.drainpipe --json '{"type": "path", "url": "drainpipe", "options": {"symlink": false}}'
ddev composer config repositories.drainpipe-dev --json '{"type": "path", "url": "drainpipe-dev", "options": {"symlink": false}}'
ddev composer config minimum-stability dev
ddev composer require "lullabot/drainpipe @dev" --with-all-dependencies
ddev composer require "lullabot/drainpipe-dev @dev" --dev --with-all-dependencies
# Restart is required to enable the provided Selenium containers
ddev restart
- name: Add Custom Testing Module
run: |
mkdir web/modules/custom
cp -R drainpipe/tests/fixtures/phpunit/testmodule web/modules/custom/
cp drainpipe/tests/fixtures/phpunit/Taskfile.yml .
- name: Run PHPUnit Tests
run: ddev task test:phpunit:static format=junit
- name: Upload test artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: test_result-phpunit-static-${{ matrix.drupal-version }}
path: test_result
- name: Confirm All PHPUnit Functional Tests were run
uses: GuillaumeFalourd/assert-command-line-output@v2
with:
command_line: xmllint --xpath 'string(//testsuites/testsuite/@tests)' test_result/phpunit.xml
contains: 12
expected_result: PASSED