Initial commit #1
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: Tests | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
tests: | |
name: Run tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache composer dependencies | |
uses: actions/cache@v3 | |
with: | |
path: vendor | |
key: composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
composer- | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.2' | |
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv | |
coverage: none | |
- name: Copy .env file | |
run: | | |
cp .env.ci .env | |
cp .env.ci .env.testing | |
- name: Run composer | |
run: | | |
composer install -n --prefer-dist | |
- name: Run test suite | |
run: | | |
php artisan test | |
env: | |
DB_DATABASE: cicd_testing | |
- name: Run Larastan | |
run: | | |
./vendor/bin/phpstan analyse | |
- name: Run Pint | |
run: | | |
./vendor/bin/pint --test | |
services: | |
mysql: | |
image: mysql:8.0 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: yes | |
MYSQL_DATABASE: cicd_testing | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=5s --health-retries=3 |