Cleaned up docker and now using nginx #2
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: Quality Checks | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
- feature/* | |
pull_request: | |
branches: | |
- main | |
- develop | |
- feature/* | |
env: | |
PHP_VERSION: "8.3" | |
jobs: | |
setup: | |
name: Setup Environment | |
runs-on: ubuntu-latest | |
outputs: | |
composer-cache-dir: ${{ env.COMPOSER_CACHE_DIR }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install PHP v${{ env.PHP_VERSION }} | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ env.PHP_VERSION }} | |
tools: composer:v2 | |
- name: Validate Composer Files | |
run: composer validate --strict | |
- name: Get Composer Cache Directory | |
id: get-composer-cache | |
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV | |
- name: Cache Composer Dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.COMPOSER_CACHE_DIR }} | |
key: php-${{ env.PHP_VERSION }}-composer-${{ hashFiles('composer.lock') }} | |
restore-keys: php-${{ env.PHP_VERSION }}-composer- | |
- name: Install dependencies | |
run: composer install --prefer-dist --no-progress --no-suggest | |
test-and-lint: | |
needs: setup | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
task: [test, lint] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install PHP v${{ env.PHP_VERSION }} | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ env.PHP_VERSION }} | |
tools: composer:v2 | |
- name: Validate Composer Files | |
run: composer validate --strict | |
- name: Get Composer Cache Directory | |
id: get-composer-cache | |
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV | |
- name: Cache Composer Dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.COMPOSER_CACHE_DIR }} | |
key: php-${{ env.PHP_VERSION }}-composer-${{ hashFiles('composer.lock') }} | |
restore-keys: php-${{ env.PHP_VERSION }}-composer- | |
- name: Prepare Application | |
run: cp .env.ci .env | |
- name: Install dependencies | |
run: composer install --prefer-dist --no-progress --no-suggest | |
- name: Setup Database | |
if: matrix.task == 'test' | |
run: | | |
vendor/bin/phinx migrate | |
vendor/bin/phinx seed:run | |
- name: Serve application | |
if: matrix.task == 'test' | |
run: php -S 127.0.0.1:80 | |
- name: Run Tests | |
if: matrix.task == 'test' | |
run: vendor/bin/phpunit | |
- name: Run Linter | |
if: matrix.task == 'lint' | |
run: vendor/bin/php-cs-fixer |