1
- name : Test LocalGov Drupal Subsites
1
+ # #
2
+ # Managed by https://github.com/localgovdrupal/github_workflow_manager
3
+ ---
4
+ name : Test localgovdrupal/localgov_subsites drupal-module
2
5
3
6
on :
4
7
push :
8
11
branches :
9
12
- ' 2.x'
10
13
14
+ env :
15
+ LOCALGOV_DRUPAL_PROJECT : localgovdrupal/localgov_subsites
16
+ LOCALGOV_DRUPAL_PROJECT_PATH : web/modules/contrib/localgov_subsites
17
+
11
18
jobs :
12
19
13
20
build :
@@ -17,10 +24,13 @@ jobs:
17
24
strategy :
18
25
fail-fast : false
19
26
matrix :
20
- include :
21
- - localgov-version : " 2.x"
22
- drupal-version : " ~9.1"
23
- php-version : " 7.4"
27
+ localgov-version :
28
+ - ' 2.x'
29
+ drupal-version :
30
+ - ' ~9.3'
31
+ php-version :
32
+ - ' 7.4'
33
+ - ' 8.1'
24
34
25
35
steps :
26
36
@@ -29,14 +39,15 @@ jobs:
29
39
run : |
30
40
echo "GIT_BASE=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
31
41
echo "GIT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
32
- echo "GIT_REPO=${GITHUB_REPOSITORY} " >> $GITHUB_ENV
42
+ echo "HEAD_USER=localgovdrupal " >> $GITHUB_ENV
33
43
34
44
- name : Save git branch and git repo names to env if this is a pull request
35
45
if : github.event_name == 'pull_request'
36
46
run : |
37
47
echo "GIT_BASE=${GITHUB_BASE_REF}" >> $GITHUB_ENV
38
48
echo "GIT_BRANCH=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
39
- echo "GIT_REPO=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_ENV
49
+ export HEAD="${{ github.event.pull_request.head.label }}"
50
+ echo "HEAD_USER=${HEAD%%:*}" >> $GITHUB_ENV
40
51
41
52
- name : Set composer branch reference for version branches
42
53
if : endsWith(github.ref, '.x')
@@ -76,11 +87,18 @@ jobs:
76
87
composer --working-dir=./html require --no-install drupal/core-recommended:${{ matrix.drupal-version }} drupal/core-composer-scaffold:${{ matrix.drupal-version }} drupal/core-project-message:${{ matrix.drupal-version }} drupal/core-dev:${{ matrix.drupal-version }}
77
88
composer --working-dir=./html install
78
89
79
- - name : Obtain the test target from the repo that triggered this workflow
90
+ - name : Obtain the test target using Composer
91
+ if : env.HEAD_USER == 'localgovdrupal'
80
92
run : |
81
- composer --working-dir=html config repositories.1 vcs [email protected] :${GIT_REPO }.git
93
+ composer --working-dir=html config repositories.1 vcs [email protected] :${LOCALGOV_DRUPAL_PROJECT }.git
82
94
composer global config github-oauth.github.com ${{ github.token }}
83
- composer --working-dir=./html require --with-all-dependencies localgovdrupal/${{ github.event.repository.name }}:"${COMPOSER_REF} as ${LATEST_RELEASE}"
95
+ composer --working-dir=./html require --with-all-dependencies ${LOCALGOV_DRUPAL_PROJECT}:"${COMPOSER_REF} as ${LATEST_RELEASE}"
96
+
97
+ - name : Obtain the test target using Git
98
+ if : env.HEAD_USER != 'localgovdrupal'
99
+ uses : actions/checkout@v2
100
+ with :
101
+ path : ${{ env.LOCALGOV_DRUPAL_PROJECT_PATH }}
84
102
85
103
phpcs :
86
104
name : Coding standards checks
@@ -90,10 +108,13 @@ jobs:
90
108
strategy :
91
109
fail-fast : false
92
110
matrix :
93
- include :
94
- - localgov-version : " 2.x"
95
- drupal-version : " ~9.1"
96
- php-version : " 7.4"
111
+ localgov-version :
112
+ - ' 2.x'
113
+ drupal-version :
114
+ - ' ~9.3'
115
+ php-version :
116
+ - ' 7.4'
117
+ - ' 8.1'
97
118
98
119
steps :
99
120
@@ -108,12 +129,12 @@ jobs:
108
129
- name : Setup PHP
109
130
uses : shivammathur/setup-php@v2
110
131
with :
111
- php-version : ' 7.4 '
132
+ php-version : ${{ matrix.php-version }}
112
133
113
134
- name : Run coding standards checks
114
135
run : |
115
136
cd html
116
- ./bin/phpcs -p
137
+ ./bin/phpcs -p ${LOCALGOV_DRUPAL_PROJECT_PATH}
117
138
118
139
phpstan :
119
140
name : Deprecated code checks
@@ -123,10 +144,13 @@ jobs:
123
144
strategy :
124
145
fail-fast : false
125
146
matrix :
126
- include :
127
- - localgov-version : " 2.x"
128
- drupal-version : " ~9.1"
129
- php-version : " 7.4"
147
+ localgov-version :
148
+ - ' 2.x'
149
+ drupal-version :
150
+ - ' ~9.3'
151
+ php-version :
152
+ - ' 7.4'
153
+ - ' 8.1'
130
154
131
155
steps :
132
156
@@ -141,13 +165,12 @@ jobs:
141
165
- name : Setup PHP
142
166
uses : shivammathur/setup-php@v2
143
167
with :
144
- php-version : ' 7.4 '
168
+ php-version : ${{ matrix.php-version }}
145
169
146
170
- name : Run deprecated code checks
147
171
run : |
148
172
cd html
149
- ./bin/phpstan analyse -c ./phpstan.neon ./web/profiles/contrib/localgov/ ./web/modules/contrib/localgov_*
150
-
173
+ ./bin/phpstan analyse -c ./phpstan.neon ${LOCALGOV_DRUPAL_PROJECT_PATH}
151
174
phpunit :
152
175
name : PHPUnit tests
153
176
needs : build
@@ -156,10 +179,13 @@ jobs:
156
179
strategy :
157
180
fail-fast : false
158
181
matrix :
159
- include :
160
- - localgov-version : " 2.x"
161
- drupal-version : " ~9.1"
162
- php-version : " 7.4"
182
+ localgov-version :
183
+ - ' 2.x'
184
+ drupal-version :
185
+ - ' ~9.3'
186
+ php-version :
187
+ - ' 7.4'
188
+ - ' 8.1'
163
189
164
190
steps :
165
191
@@ -183,5 +209,6 @@ jobs:
183
209
- name : Run PHPUnit tests
184
210
run : |
185
211
mkdir -p ./html/web/sites/simpletest && chmod 777 ./html/web/sites/simpletest
212
+ sed -i "s#http://localgov.lndo.site#http://drupal#" ./html/phpunit.xml.dist
186
213
docker exec -t drupal bash -c 'chown docker:docker -R /var/www/html'
187
- docker exec -u docker -t drupal bash -c "cd /var/www/html && ./bin/paratest --processes=4"
214
+ docker exec -u docker -t drupal bash -c "cd /var/www/html && ./bin/paratest --processes=4 ${{ env.LOCALGOV_DRUPAL_PROJECT_PATH }} "
0 commit comments