Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
GitHub Action build for laravelshift.com
name: Build
on: [ pull_request ]
jobs:
build:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: ${{ secrets.DB_PASSWORD }}
MYSQL_DATABASE: db_test
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v2
- name: Cache composer dependencies
uses: actions/cache@v1
with:
path: ./vendor
key: composer-vendor-${{ hashFiles('**/composer.lock') }}
- uses: shivammathur/setup-php@v2
with:
php-version: 7.4
coverage: none
- uses: overtrue/phplint@master
- name: Validate composer.json and composer.lock
run: composer validate
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: Run PHPUnit tests
env:
DB_CONNECTION: mysql
DB_HOST: 127.0.0.1
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
DB_DATABASE: db_test
DB_USERNAME: root
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
run: php artisan test --parallel
- name: Run Dusk tests
env:
APP_ENV: testing
APP_URL: http://127.0.0.1:8000
DB_CONNECTION: mysql
DB_HOST: 127.0.0.1
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
DB_DATABASE: db_test
DB_USERNAME: root
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
SESSION_DRIVER: file
SESSION_DOMAIN: 127.0.0.1
run: |
cp .env.dev .env
echo '' > storage/logs/laravel.log
npm install
npm run prod
php artisan migrate:fresh --seed
php artisan db:seed --class=UsersTableSeeder
php artisan db:seed --class=OrdersTableSeeder
php artisan dusk:chrome-driver `/opt/google/chrome/chrome --version | cut -d " " -f3 | cut -d "." -f1`
php artisan serve > storage/logs/server.log 2>&1 &
php artisan dusk
- name: Upload Screenshots
if: failure()
uses: actions/upload-artifact@v2
with:
name: screenshots
path: tests/Browser/screenshots
- name: Upload Console Logs
if: failure()
uses: actions/upload-artifact@v2
with:
name: logs
path: |
tests/Browser/console
storage/logs/*.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment