wip #24
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: Run Tests | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
services: | |
redis: | |
image: redis:7.4 | |
ports: | |
- 6379:6379 | |
mysql: | |
image: mysql:8.0 | |
ports: | |
- 3306:3306 | |
env: | |
MYSQL_DATABASE: laravel | |
MYSQL_ALLOW_EMPTY_PASSWORD: yes | |
# If you alter the extensions, bump this version number too | |
PHP_EXTENSIONS_CACHE_VERSION: 1 | |
PHP_EXTENSIONS: dom, curl, libxml, mbstring, zip, pcntl, pdo, gd, redis, igbinary, msgpack, lzf, zstd, lz4, memcached, gmp, :php-psr" | |
PHP_VERSION: 8.3 | |
steps: | |
- name: Checkout Code | |
uses: actions/[email protected] | |
- name: Setup cache environment | |
id: extcache | |
uses: shivammathur/cache-extensions@v1 | |
with: | |
php-version: ${{ env.PHP_VERSION }} | |
extensions: ${{ env.PHP_EXTENSIONS }} | |
key: extensions-${{ env.PHP_EXTENSIONS_CACHE_VERSION }} | |
- name: Cache extensions | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.extcache.outputs.dir }} | |
key: ${{ steps.extcache.outputs.key }} | |
restore-keys: ${{ steps.extcache.outputs.key }} | |
- name: Setup PHP and Composer | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ env.PHP_VERSION }} | |
tools: composer:v2 | |
extensions: ${{ env.PHP_EXTENSIONS }} | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: echo "directory=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache Composer Dependencies | |
uses: actions/[email protected] | |
with: | |
key: composer-${{ hashFiles('**/composer.lock') }} | |
path: ${{ steps.composer-cache.outputs.directory }} | |
restore-keys: composer- | |
- name: Install Project Dependencies | |
run: composer install -q --no-interaction --no-progress | |
- name: Copy Environment File | |
run: cp .env.example .env | |
- name: Generate Application Key | |
run: php artisan key:generate | |
- name: Run Tests | |
run: php artisan test --compact |