Skip to content

Test upstream composer config #1024

Test upstream composer config

Test upstream composer config #1024

Workflow file for this run

name: Test upstream composer config
on:
push:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: 0 0 * * *
jobs:
composer:
runs-on: ubuntu-latest
name: Test composer install
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@d2f58713aaf7809d0c4d11e827c9e9dbbc55b34e
with:
php-version: 7.4
tools: composer:v2
- name: Find the pull request source branch name
if: ${{ github.event_name == 'pull_request' }}
run: echo "AZ_TRIMMED_REF=${GITHUB_HEAD_REF}" >> ${GITHUB_ENV}
- name: Check if matching Quickstart dev branch name exists
if: ${{ github.event_name == 'pull_request' }}
run: if [ $(git ls-remote --heads https://github.com/az-digital/az_quickstart.git $AZ_TRIMMED_REF | wc -l) = 1 ]; then echo "QUICKSTART_BRANCH=${AZ_TRIMMED_REF}" >> ${GITHUB_ENV}; fi
- name: Use Quickstart dev branch if it exists
if: env.QUICKSTART_BRANCH
run: composer require --working-dir=upstream --no-update az-digital/az_quickstart:dev-${QUICKSTART_BRANCH}
- name: Simulate Pantheon's composer install command
run: composer --no-cache --no-interaction --no-progress --prefer-dist --ansi install
- name: Simulate Pantheon adding composer.lock to git
run: |
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config --global user.name "${GITHUB_ACTOR}"
COMPOSER_LOCK_CHANGED=$(git status --porcelain composer.lock)
if [[ ! -z "$COMPOSER_LOCK_CHANGED" ]]; then
git add composer.lock
git commit -m "Simulate Pantheon adding composer.lock to git"
fi
# Checks for any changes made not covered by .gitignore.
- name: Ensure changes are covered by .gitignore
run: |
MODIFIED_OR_ADDED_LIST=$(git status --porcelain)
if [[ ! -z "$MODIFIED_OR_ADDED_LIST" ]]; then
2>&1 echo "The build step affected files that are not ignored by git:"
2>&1 echo $MODIFIED_OR_ADDED_LIST
exit 1
fi