Skip to content

Commit 7df4d5e

Browse files
authored
Merge pull request #63 from localgovdrupal/feature/update-github-actions
Update Github Actions to use standard config
2 parents 3edce04 + 5fa8f1d commit 7df4d5e

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

.github/workflows/test.yml

+14-11
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
echo "GIT_BASE=${GITHUB_BASE_REF}" >> $GITHUB_ENV
3838
echo "GIT_BRANCH=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
3939
echo "GIT_REPO=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_ENV
40-
40+
4141
- name: Set composer branch reference for version branches
4242
if: endsWith(github.ref, '.x')
4343
run: echo "COMPOSER_REF=${GIT_BRANCH}-dev" >> $GITHUB_ENV
@@ -46,6 +46,12 @@ jobs:
4646
if: endsWith(github.ref, '.x') == false
4747
run: echo "COMPOSER_REF=dev-${GIT_BRANCH}" >> $GITHUB_ENV
4848

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+
4955
- name: Cached workspace
5056
uses: actions/cache@v2
5157
with:
@@ -66,16 +72,15 @@ jobs:
6672
- name: Create LocalGov Drupal project
6773
run: |
6874
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
7178
72-
- name: Setup package source and authentication for the test target
79+
- name: Obtain the test target from the repo that triggered this workflow
7380
run: |
7481
composer --working-dir=html config repositories.1 vcs [email protected]:${GIT_REPO}.git
7582
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}"
7984
8085
phpcs:
8186
name: Coding standards checks
@@ -158,11 +163,11 @@ jobs:
158163

159164
steps:
160165

161-
- name: Clone drupal_container
166+
- name: Clone Drupal container
162167
uses: actions/checkout@v2
163168
with:
164169
repository: localgovdrupal/drupal-container
165-
ref: master
170+
ref: php${{ matrix.php-version }}
166171

167172
- name: Cached workspace
168173
uses: actions/cache@v2
@@ -178,7 +183,5 @@ jobs:
178183
- name: Run PHPUnit tests
179184
run: |
180185
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
182186
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"
184187
docker exec -u docker -t drupal bash -c "cd /var/www/html && ./bin/paratest --processes=4"

0 commit comments

Comments
 (0)