Skip to content

Commit

Permalink
main: laravel.yml updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkeremcansev committed Jul 20, 2023
1 parent a0bcf09 commit 06ac7ea
Showing 1 changed file with 26 additions and 53 deletions.
79 changes: 26 additions & 53 deletions .github/workflows/laravel.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,35 @@
name: run-tests
name: Laravel

on:
workflow_dispatch:
push:
branches: [main]
branches: [ "main" ]
pull_request:
branches: [main]
branches: [ "main" ]

jobs:
test:
name: phpunit
runs-on: ubuntu-latest
container:
image: kirschbaumdevelopment/laravel-test-runner:8.1
laravel-tests:

services:
mysql-service:
image: mysql:8.0
env:
MYSQL_DATABASE: ww_commerce_test
MYSQL_ALLOW_EMPTY_PASSWORD: true
## map the "external" 33306 port with the "internal" 3306
ports:
- 33306:3306
# Set health checks to wait until mysql database has started (it takes some seconds to start)
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Copy testing enviroment
run: cp .env.example .env

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

- name: Install composer dependencies
uses: ramsey/composer-install@v2

- name: Generate key
run: php artisan key:generate

- name: Migration
run: php artisan migrate:refresh --seed

- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache

- name: Execute tests
env:
DB_PORT: 33306
run: vendor/bin/phpunit
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
with:
php-version: '8.1'
- uses: actions/checkout@v3
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Generate key
run: php artisan key:generate
- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache
- name: Create Database
run: |
mkdir -p database
touch database/database.sqlite
- name: Execute tests (Unit and Feature tests) via PHPUnit
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: vendor/bin/phpunit

0 comments on commit 06ac7ea

Please sign in to comment.