|
7 | 7 | pull_request:
|
8 | 8 | branches:
|
9 | 9 | - '2.x'
|
10 |
| - |
11 |
| -env: |
12 |
| - LOCALGOV_DRUPAL_PROJECT: localgovdrupal/localgov_subsites |
13 |
| - LOCALGOV_DRUPAL_PROJECT_PATH: web/modules/contrib/localgov_subsites |
| 10 | + workflow_dispatch: |
14 | 11 |
|
15 | 12 | jobs:
|
16 |
| - |
17 |
| - build: |
18 |
| - name: Install LocalGov Drupal |
19 |
| - runs-on: ubuntu-latest |
20 |
| - |
21 |
| - strategy: |
22 |
| - fail-fast: false |
23 |
| - matrix: |
24 |
| - include: |
25 |
| - - localgov-version: '2.x' |
26 |
| - drupal-version: '~9.4' |
27 |
| - php-version: '8.1' |
28 |
| - - localgov-version: '3.x' |
29 |
| - drupal-version: '~10.0' |
30 |
| - php-version: '8.1' |
31 |
| - |
32 |
| - steps: |
33 |
| - |
34 |
| - - name: Save git branch and git repo names to env if this is not a pull request |
35 |
| - if: github.event_name != 'pull_request' |
36 |
| - run: | |
37 |
| - echo "GIT_BASE=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV |
38 |
| - echo "GIT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV |
39 |
| - echo "HEAD_USER=localgovdrupal" >> $GITHUB_ENV |
40 |
| -
|
41 |
| - - name: Save git branch and git repo names to env if this is a pull request |
42 |
| - if: github.event_name == 'pull_request' |
43 |
| - run: | |
44 |
| - echo "GIT_BASE=${GITHUB_BASE_REF}" >> $GITHUB_ENV |
45 |
| - echo "GIT_BRANCH=${GITHUB_HEAD_REF}" >> $GITHUB_ENV |
46 |
| - export HEAD="${{ github.event.pull_request.head.label }}" |
47 |
| - echo "HEAD_USER=${HEAD%%:*}" >> $GITHUB_ENV |
48 |
| -
|
49 |
| - - name: Set composer branch reference for version branches |
50 |
| - if: endsWith(github.ref, '.x') |
51 |
| - run: echo "COMPOSER_REF=${GIT_BRANCH}-dev" >> $GITHUB_ENV |
52 |
| - |
53 |
| - - name: Set composer branch reference for non-version branches |
54 |
| - if: endsWith(github.ref, '.x') == false |
55 |
| - run: echo "COMPOSER_REF=dev-${GIT_BRANCH}" >> $GITHUB_ENV |
56 |
| - |
57 |
| - - name: Get the latest tagged release for branch version |
58 |
| - run: | |
59 |
| - LATEST_RELEASE=$(curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${GITHUB_REPOSITORY}/git/matching-refs/tags/${GIT_BASE%'.x'} | grep -Po '(?<=refs/tags/)[^"]+' | tail -1) |
60 |
| - if [ -z $LATEST_RELEASE ]; then LATEST_RELEASE=1; fi |
61 |
| - echo "LATEST_RELEASE=${LATEST_RELEASE}" >> $GITHUB_ENV |
62 |
| -
|
63 |
| - - name: Cached workspace |
64 |
| - uses: actions/cache@v2 |
65 |
| - with: |
66 |
| - path: ./html |
67 |
| - key: localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}-${{ github.run_id }}-${{ secrets.CACHE_VERSION }} |
68 |
| - |
69 |
| - - name: Setup PHP |
70 |
| - uses: shivammathur/setup-php@v2 |
71 |
| - with: |
72 |
| - php-version: ${{ matrix.php-version }} |
73 |
| - |
74 |
| - - name: Clone drupal_container |
75 |
| - uses: actions/checkout@v2 |
76 |
| - with: |
77 |
| - repository: localgovdrupal/drupal-container |
78 |
| - ref: php${{ matrix.php-version }} |
79 |
| - |
80 |
| - - name: Create LocalGov Drupal project |
81 |
| - run: | |
82 |
| - composer create-project --stability dev --no-install localgovdrupal/localgov-project ./html "${{ matrix.localgov-version }}" |
83 |
| - composer --working-dir=./html require --no-install localgovdrupal/localgov:${{ matrix.localgov-version }}-dev |
84 |
| - 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 }} |
85 |
| - composer --working-dir=./html install |
86 |
| -
|
87 |
| - - name: Obtain the test target using Composer |
88 |
| - if: env.HEAD_USER == 'localgovdrupal' |
89 |
| - run: | |
90 |
| - composer --working-dir=html config repositories.1 vcs [email protected]:${LOCALGOV_DRUPAL_PROJECT}.git |
91 |
| - composer global config github-oauth.github.com ${{ github.token }} |
92 |
| - composer --working-dir=./html require --with-all-dependencies ${LOCALGOV_DRUPAL_PROJECT}:"${COMPOSER_REF} as ${LATEST_RELEASE}" |
93 |
| -
|
94 |
| - - name: Obtain the test target using Git |
95 |
| - if: env.HEAD_USER != 'localgovdrupal' |
96 |
| - uses: actions/checkout@v2 |
97 |
| - with: |
98 |
| - path: ${{ env.LOCALGOV_DRUPAL_PROJECT_PATH }} |
99 |
| - |
100 |
| - phpcs: |
101 |
| - name: Coding standards checks |
102 |
| - needs: build |
103 |
| - runs-on: ubuntu-latest |
104 |
| - |
105 |
| - strategy: |
106 |
| - fail-fast: false |
107 |
| - matrix: |
108 |
| - include: |
109 |
| - - localgov-version: '2.x' |
110 |
| - drupal-version: '~9.4' |
111 |
| - php-version: '8.1' |
112 |
| - - localgov-version: '3.x' |
113 |
| - drupal-version: '~10.0' |
114 |
| - php-version: '8.1' |
115 |
| - |
116 |
| - steps: |
117 |
| - |
118 |
| - - name: Cached workspace |
119 |
| - uses: actions/cache@v2 |
120 |
| - with: |
121 |
| - path: ./html |
122 |
| - key: localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}-${{ github.run_id }}-${{ secrets.CACHE_VERSION }} |
123 |
| - restore-keys: | |
124 |
| - localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}- |
125 |
| -
|
126 |
| - - name: Setup PHP |
127 |
| - uses: shivammathur/setup-php@v2 |
128 |
| - with: |
129 |
| - php-version: ${{ matrix.php-version }} |
130 |
| - |
131 |
| - - name: Run coding standards checks |
132 |
| - run: | |
133 |
| - cd html |
134 |
| - ./bin/phpcs -p ${LOCALGOV_DRUPAL_PROJECT_PATH} |
135 |
| -
|
136 |
| - phpstan: |
137 |
| - name: Deprecated code checks |
138 |
| - needs: build |
139 |
| - runs-on: ubuntu-latest |
140 |
| - |
141 |
| - strategy: |
142 |
| - fail-fast: false |
143 |
| - matrix: |
144 |
| - include: |
145 |
| - - localgov-version: '2.x' |
146 |
| - drupal-version: '~9.4' |
147 |
| - php-version: '8.1' |
148 |
| - - localgov-version: '3.x' |
149 |
| - drupal-version: '~10.0' |
150 |
| - php-version: '8.1' |
151 |
| - |
152 |
| - steps: |
153 |
| - |
154 |
| - - name: Cached workspace |
155 |
| - uses: actions/cache@v2 |
156 |
| - with: |
157 |
| - path: ./html |
158 |
| - key: localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}-${{ github.run_id }}-${{ secrets.CACHE_VERSION }} |
159 |
| - restore-keys: | |
160 |
| - localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}- |
161 |
| -
|
162 |
| - - name: Setup PHP |
163 |
| - uses: shivammathur/setup-php@v2 |
164 |
| - with: |
165 |
| - php-version: ${{ matrix.php-version }} |
166 |
| - |
167 |
| - - name: Run deprecated code checks |
168 |
| - run: | |
169 |
| - cd html |
170 |
| - ./bin/phpstan analyse -c ./phpstan.neon ${LOCALGOV_DRUPAL_PROJECT_PATH} |
171 |
| - phpunit: |
172 |
| - name: PHPUnit tests |
173 |
| - needs: build |
174 |
| - runs-on: ubuntu-latest |
175 |
| - |
176 |
| - strategy: |
177 |
| - fail-fast: false |
178 |
| - matrix: |
179 |
| - include: |
180 |
| - - localgov-version: '2.x' |
181 |
| - drupal-version: '~9.4' |
182 |
| - php-version: '8.1' |
183 |
| - - localgov-version: '3.x' |
184 |
| - drupal-version: '~10.0' |
185 |
| - php-version: '8.1' |
186 |
| - |
187 |
| - steps: |
188 |
| - |
189 |
| - - name: Clone Drupal container |
190 |
| - uses: actions/checkout@v2 |
191 |
| - with: |
192 |
| - repository: localgovdrupal/drupal-container |
193 |
| - ref: php${{ matrix.php-version }} |
194 |
| - |
195 |
| - - name: Cached workspace |
196 |
| - uses: actions/cache@v2 |
197 |
| - with: |
198 |
| - path: ./html |
199 |
| - key: localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}-${{ github.run_id }}-${{ secrets.CACHE_VERSION }} |
200 |
| - restore-keys: | |
201 |
| - localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}- |
202 |
| -
|
203 |
| - - name: Start Docker environment |
204 |
| - run: docker-compose -f docker-compose.yml up -d |
205 |
| - |
206 |
| - - name: Run PHPUnit tests |
207 |
| - run: | |
208 |
| - mkdir -p ./html/web/sites/simpletest && chmod 777 ./html/web/sites/simpletest |
209 |
| - sed -i "s#http://localgov.lndo.site#http://drupal#" ./html/phpunit.xml.dist |
210 |
| - docker exec -t drupal bash -c 'chown docker:docker -R /var/www/html' |
211 |
| - docker exec -u docker -t drupal bash -c "cd /var/www/html && ./bin/paratest --processes=4 /var/www/html/${{ env.LOCALGOV_DRUPAL_PROJECT_PATH }}" |
| 13 | + tests: |
| 14 | + uses: localgovdrupal/localgov_shared_workflows/.github/workflows/[email protected] |
| 15 | + with: |
| 16 | + project: 'localgovdrupal/localgov_subsites' |
| 17 | + project_path: 'web/modules/contrib/localgov_subsites' |
0 commit comments