@@ -2,72 +2,103 @@ name: Test LocalGov Drupal Subsites
2
2
3
3
on :
4
4
push :
5
- branches : [ master ]
5
+ branches :
6
+ - ' 2.x'
6
7
pull_request :
7
- branches : [ master ]
8
+ branches :
9
+ - ' 2.x'
8
10
9
11
jobs :
10
12
11
13
build :
12
14
name : Install LocalGov Drupal
13
15
runs-on : ubuntu-latest
14
16
17
+ strategy :
18
+ fail-fast : false
19
+ matrix :
20
+ include :
21
+ - localgov-version : " 2.x"
22
+ drupal-version : " ~9.1"
23
+ php-version : " 7.4"
24
+
15
25
steps :
16
26
27
+ - name : Save git branch and git repo names to env if this is not a pull request
28
+ if : github.event_name != 'pull_request'
29
+ run : |
30
+ echo "GIT_BASE=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
31
+ echo "GIT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
32
+ echo "GIT_REPO=${GITHUB_REPOSITORY}" >> $GITHUB_ENV
33
+
34
+ - name : Save git branch and git repo names to env if this is a pull request
35
+ if : github.event_name == 'pull_request'
36
+ run : |
37
+ echo "GIT_BASE=${GITHUB_BASE_REF}" >> $GITHUB_ENV
38
+ echo "GIT_BRANCH=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
39
+ echo "GIT_REPO=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_ENV
40
+
41
+ - name : Set composer branch reference for version branches
42
+ if : endsWith(github.ref, '.x')
43
+ run : echo "COMPOSER_REF=${GIT_BRANCH}-dev" >> $GITHUB_ENV
44
+
45
+ - name : Set composer branch reference for non-version branches
46
+ if : endsWith(github.ref, '.x') == false
47
+ run : echo "COMPOSER_REF=dev-${GIT_BRANCH}" >> $GITHUB_ENV
48
+
17
49
- name : Cached workspace
18
50
uses : actions/cache@v2
19
51
with :
20
52
path : ./html
21
- key : ${{ runner.os }}-localgov-build -${{ github.run_id }}
53
+ key : localgov-build- ${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }} -${{ github.run_id }}
22
54
23
55
- name : Setup PHP
24
56
uses : shivammathur/setup-php@v2
25
57
with :
26
- php-version : ' 7.4 '
58
+ php-version : ${{ matrix.php-version }}
27
59
28
60
- name : Clone drupal_container
29
61
uses : actions/checkout@v2
30
62
with :
31
63
repository : localgovdrupal/drupal-container
32
- ref : master
64
+ ref : php${{ matrix.php-version }}
33
65
34
66
- name : Create LocalGov Drupal project
35
- run : composer create-project --stability dev localgovdrupal/localgov-project ./html
36
-
37
- - name : Save git branch and git repo names to env if this is not a pull request
38
- if : github.event_name != 'pull_request'
39
67
run : |
40
- echo "GIT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
41
- echo "GIT_REPO=${GITHUB_REPOSITORY}" >> $GITHUB_ENV
42
-
43
- - name : Save git branch and git repo names to env if this is a pull request
44
- if : github.event_name == 'pull_request'
45
- run : |
46
- echo "GIT_BRANCH=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
47
- echo "GIT_REPO=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_ENV
68
+ composer create-project --stability dev --no-install localgovdrupal/localgov-project ./html "${{ matrix.localgov-version }}"
69
+ composer 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 }}
70
+ composer install
48
71
49
72
- name : Setup package source and authentication for the test target
50
73
run : |
51
74
composer --working-dir=html config repositories.1 vcs [email protected] :${GIT_REPO}.git
52
75
composer global config github-oauth.github.com ${{ github.token }}
53
76
54
77
- name : Obtain the test target from the repo that triggered this workflow
55
- run : composer --working-dir=html require --with-all-dependencies localgovdrupal/${{ github.event.repository.name }}:"dev-${GIT_BRANCH } as 1.0.x -dev"
78
+ run : composer --working-dir=html require --with-all-dependencies localgovdrupal/${{ github.event.repository.name }}:"${COMPOSER_REF } as ${GIT_BASE} -dev"
56
79
57
80
phpcs :
58
81
name : Coding standards checks
59
82
needs : build
60
83
runs-on : ubuntu-latest
61
84
85
+ strategy :
86
+ fail-fast : false
87
+ matrix :
88
+ include :
89
+ - localgov-version : " 2.x"
90
+ drupal-version : " ~9.1"
91
+ php-version : " 7.4"
92
+
62
93
steps :
63
94
64
95
- name : Cached workspace
65
96
uses : actions/cache@v2
66
97
with :
67
98
path : ./html
68
- key : ${{ runner.os }}-localgov-build -${{ github.run_id }}
99
+ key : localgov-build- ${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }} -${{ github.run_id }}
69
100
restore-keys : |
70
- ${{ runner.os }}-localgov-build -
101
+ localgov-build- ${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }} -
71
102
72
103
- name : Setup PHP
73
104
uses : shivammathur/setup-php@v2
@@ -84,15 +115,23 @@ jobs:
84
115
needs : build
85
116
runs-on : ubuntu-latest
86
117
118
+ strategy :
119
+ fail-fast : false
120
+ matrix :
121
+ include :
122
+ - localgov-version : " 2.x"
123
+ drupal-version : " ~9.1"
124
+ php-version : " 7.4"
125
+
87
126
steps :
88
127
89
128
- name : Cached workspace
90
129
uses : actions/cache@v2
91
130
with :
92
131
path : ./html
93
- key : ${{ runner.os }}-localgov-build -${{ github.run_id }}
132
+ key : localgov-build- ${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }} -${{ github.run_id }}
94
133
restore-keys : |
95
- ${{ runner.os }}-localgov-build -
134
+ localgov-build- ${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }} -
96
135
97
136
- name : Setup PHP
98
137
uses : shivammathur/setup-php@v2
@@ -109,6 +148,14 @@ jobs:
109
148
needs : build
110
149
runs-on : ubuntu-latest
111
150
151
+ strategy :
152
+ fail-fast : false
153
+ matrix :
154
+ include :
155
+ - localgov-version : " 2.x"
156
+ drupal-version : " ~9.1"
157
+ php-version : " 7.4"
158
+
112
159
steps :
113
160
114
161
- name : Clone drupal_container
@@ -121,9 +168,9 @@ jobs:
121
168
uses : actions/cache@v2
122
169
with :
123
170
path : ./html
124
- key : ${{ runner.os }}-localgov-build -${{ github.run_id }}
171
+ key : localgov-build- ${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }} -${{ github.run_id }}
125
172
restore-keys : |
126
- ${{ runner.os }}-localgov-build -
173
+ localgov-build- ${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }} -
127
174
128
175
- name : Start Docker environment
129
176
run : docker-compose -f docker-compose.yml up -d
0 commit comments