Skip to content

bobby@bobbyiliev.com #185

bobby@bobbyiliev.com

bobby@bobbyiliev.com #185

Workflow file for this run

name: Authenticaiton Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: mbstring, xml, ctype, iconv, mysql
- name: Cache Composer Packages
uses: actions/cache@v2
with:
path: ~/.composer/cache
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-git
- name: Setup Laravel Application
run: composer create-project --prefer-dist laravel/laravel laravel_app --no-interaction
- name: Set Working Directory
run: echo "Change directory context to Laravel app"
working-directory: ./laravel_app
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV
id: extract_branch
- name: Install DevDojo Auth from current branch
run: composer require devdojo/auth:dev-${{ env.branch }} --with-all-dependencies
working-directory: ./laravel_app
- name: Publish the DevDojo Auth Assets
run: php artisan vendor:publish --tag=auth:assets
working-directory: ./laravel_app
- name: Publish the DevDojo Configs
run: php artisan vendor:publish --tag=auth:config
working-directory: ./laravel_app
- name: Publish the DevDojo Auth Migrations
run: php artisan vendor:publish --tag=auth:migrations
working-directory: ./laravel_app
- name: Remove current tests and symlink to DevDojo Auth
run: |
rm -rf tests
ln -s vendor/devdojo/auth/tests tests
working-directory: ./laravel_app
- name: Create sqlite file
run: touch database/database.sqlite
working-directory: ./laravel_app
- name: List out .env
run: cat .env
working-directory: ./laravel_app
# Testing on a mac, this command should be:
# sed -i '' 's/DB_CONNECTION=mysql/DB_CONNECTION=sqlite/' .env
# sed -i '' 's/^DB_DATABASE=laravel/#DB_DATABASE=laravel/' .env
- name: Updating values in the .env
run: |
sed -i 's/DB_CONNECTION=mysql/DB_CONNECTION=sqlite/' .env
sed -i 's/^DB_DATABASE=laravel/#DB_DATABASE=laravel/' .env
working-directory: ./laravel_app
- name: Include Doctrine DBAL Package which is used for renaming columns
run: composer require doctrine/dbal
working-directory: ./laravel_app
- name: Run the migrations
run: php artisan migrate
working-directory: ./laravel_app
- name: Show contents of composer.json before removing PHPUnit
run: cat composer.json
working-directory: ./laravel_app
# Testing on a mac, this command should be:
# sed -i '' '/"phpunit\/phpunit"/d' composer.json
- name: Remove PHPUnit from composer.json
run: |
sed -i '/"phpunit\/phpunit"/d' composer.json
sed -i '/"nunomaduro\/collision": "\^8.0",/s/,$//' composer.json
working-directory: ./laravel_app
- name: Show contents of composer.json after removing PHPUnit
run: cat composer.json
working-directory: ./laravel_app
- name: Remove composer.lock and re-run composer install
run: |
rm composer.lock
composer install
working-directory: ./laravel_app
- name: Install PestPHP, PHPStan, Dusk, and Dusk API Conf
run: |
composer require pestphp/pest --dev --with-all-dependencies
composer require larastan/larastan:^2.0 --dev --with-all-dependencies
composer require laravel/dusk --dev --with-all-dependencies
composer require alebatistella/duskapiconf --dev --with-all-dependencies
composer require protonemedia/laravel-dusk-fakes:^1.6 --dev --with-all-dependencies
working-directory: ./laravel_app
- name: Upgrade Chrome Driver
run: php artisan dusk:chrome-driver --detect
working-directory: ./laravel_app
- name: Start Chrome Driver
run: ./vendor/laravel/dusk/bin/chromedriver-linux &
working-directory: ./laravel_app
- name: Check Chrome & ChromeDriver Versions
run: |
google-chrome --version
chromedriver --version
- name: Clear all view caches
run: php artisan view:clear
working-directory: ./laravel_app
- name: Run Artisan Serve
run: php artisan serve --no-reload &
working-directory: ./laravel_app
- name: Run Tests
run: ./vendor/bin/pest
working-directory: ./laravel_app
- name: Run Dusk Tests
env:
APP_URL: http://127.0.0.1:8000
APP_ENV: testing
run: php artisan dusk -vvv
working-directory: ./laravel_app
- 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: console
path: tests/Browser/console
- name: Move the PHP config file to the root directory
run: cp vendor/devdojo/auth/phpstan.neon phpstan.neon
working-directory: ./laravel_app
- name: Run PHPStan for DevDojo Auth
run: ./vendor/bin/phpstan analyse --memory-limit=1G vendor/devdojo/auth/src
working-directory: ./laravel_app