Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and PHP APP | |
on: [push, pull_request] | |
env: | |
PHP_VERSION: '8.2' | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@7c0b4c8c8ebed23eca9ec2802474895d105b11bc | |
with: | |
php-version: ${{ env.PHP_VERSION }} | |
- name: Check if composer.json exists | |
id: check_files | |
uses: andstor/file-existence-action@87d74d4732ddb824259d80c8a508c0124bf1c673 | |
with: | |
files: 'composer.json' | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
if: steps.check_files.outputs.files_exists == 'true' | |
run: | | |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Set up dependency caching for faster installs | |
uses: actions/cache@v3 | |
if: steps.check_files.outputs.files_exists == 'true' | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Run composer install if composer.json exists | |
if: steps.check_files.outputs.files_exists == 'true' | |
run: composer validate --no-check-publish && composer install --prefer-dist --no-progress | |
- name: Run composer install if composer.json does not exist | |
if: steps.check_files.outputs.files_exists == 'false' | |
run: echo "No composer.json found, skipping composer install" | |
- name: Run PHP Unit Tests | |
run: composer run tests |