37
37
echo "GIT_BASE=${GITHUB_BASE_REF}" >> $GITHUB_ENV
38
38
echo "GIT_BRANCH=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
39
39
echo "GIT_REPO=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_ENV
40
-
40
+
41
41
- name : Set composer branch reference for version branches
42
42
if : endsWith(github.ref, '.x')
43
43
run : echo "COMPOSER_REF=${GIT_BRANCH}-dev" >> $GITHUB_ENV
46
46
if : endsWith(github.ref, '.x') == false
47
47
run : echo "COMPOSER_REF=dev-${GIT_BRANCH}" >> $GITHUB_ENV
48
48
49
+ - name : Get the latest tagged release for branch version
50
+ run : |
51
+ 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)
52
+ if [ -z $LATEST_RELEASE ]; then LATEST_RELEASE=1; fi
53
+ echo "LATEST_RELEASE=${LATEST_RELEASE}" >> $GITHUB_ENV
54
+
49
55
- name : Cached workspace
50
56
uses : actions/cache@v2
51
57
with :
@@ -66,16 +72,15 @@ jobs:
66
72
- name : Create LocalGov Drupal project
67
73
run : |
68
74
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
75
+ composer --working-dir=./html require --no-install localgovdrupal/localgov:${{ matrix.localgov-version }}-dev
76
+ 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
+ composer --working-dir=./html install
71
78
72
- - name : Setup package source and authentication for the test target
79
+ - name : Obtain the test target from the repo that triggered this workflow
73
80
run : |
74
81
composer --working-dir=html config repositories.1 vcs [email protected] :${GIT_REPO}.git
75
82
composer global config github-oauth.github.com ${{ github.token }}
76
-
77
- - name : Obtain the test target from the repo that triggered this workflow
78
- run : composer --working-dir=html require --with-all-dependencies localgovdrupal/${{ github.event.repository.name }}:"${COMPOSER_REF} as ${GIT_BASE%'.x'}"
83
+ composer --working-dir=./html require --with-all-dependencies localgovdrupal/${{ github.event.repository.name }}:"${COMPOSER_REF} as ${LATEST_RELEASE}"
79
84
80
85
phpcs :
81
86
name : Coding standards checks
@@ -158,11 +163,11 @@ jobs:
158
163
159
164
steps :
160
165
161
- - name : Clone drupal_container
166
+ - name : Clone Drupal container
162
167
uses : actions/checkout@v2
163
168
with :
164
169
repository : localgovdrupal/drupal-container
165
- ref : master
170
+ ref : php${{ matrix.php-version }}
166
171
167
172
- name : Cached workspace
168
173
uses : actions/cache@v2
@@ -178,7 +183,5 @@ jobs:
178
183
- name : Run PHPUnit tests
179
184
run : |
180
185
mkdir -p ./html/web/sites/simpletest && chmod 777 ./html/web/sites/simpletest
181
- sed -i "s#http://localgov.lndo.site#http://drupal#; s#mysql://database:database@database/database#sqlite://localhost//dev/shm/test.sqlite#" ./html/phpunit.xml.dist
182
186
docker exec -t drupal bash -c 'chown docker:docker -R /var/www/html'
183
- # docker exec -u docker -t drupal bash -c "cd /var/www/html && ./bin/phpunit --testdox"
184
187
docker exec -u docker -t drupal bash -c "cd /var/www/html && ./bin/paratest --processes=4"
0 commit comments