Skip to content

Commit

Permalink
fixes #13: Setup PHP first so we can get composer cache dir.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsqd committed Jul 31, 2024
1 parent 721bd06 commit b2aafa8
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions .github/workflows/validate-feature-branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Validate Feature Branches
on:
# Run on any branch so validate branch can always run.
push:
# Commit message validation requires a target branch which is only available in a PR.
pull_request:
branches:
- 'feature/*'
Expand All @@ -15,13 +16,6 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: /tmp/composer-cache
# This project doesn't commit composer.lock, use composer.lock instead if you do.
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand All @@ -30,9 +24,21 @@ jobs:
# https://github.com/shivammathur/setup-php?tab=readme-ov-file#disable-coverage
coverage: none

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
# This project doesn't commit composer.lock, use composer.lock instead if you do.
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer

- name: Install Composer dependencies
run: |
composer install --ignore-platform-reqs --optimize-autoloader
composer install --ignore-platform-reqs --optimize-autoloader --no-progress --no-ansi
- name: Run on a change to any branch
if: github.event_name == 'push'
Expand Down

0 comments on commit b2aafa8

Please sign in to comment.