Skip to content

Instantly share code, notes, and snippets.

@RhysLees
Created April 19, 2022 23:17
Show Gist options
  • Save RhysLees/cbee9bc0bf9cc353ea2d02c35186b4ae to your computer and use it in GitHub Desktop.
Save RhysLees/cbee9bc0bf9cc353ea2d02c35186b4ae to your computer and use it in GitHub Desktop.
name: Laravel
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
laravel-tests:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['8.1']
name: Tests
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
- name: Add HTTP basic auth credentials
run: echo '${{ secrets.COMPOSER_AUTH_JSON }}' > $GITHUB_WORKSPACE/auth.json
- name: Install Dependencies
run: |
composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
composer dump-autoload
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- 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 PHP Unit
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
CACHE_DRIVER: array
SESSION_DRIVER: array
QUEUE_DRIVER: sync
run: vendor/bin/phpunit --verbose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment