File: D:/HostingSpaces/SBogers10/base.komma.pro/.github/workflows/quality_assurance_with_cypress.yml.bak
name: Quality assurance
on:
push:
branches:
- feature/ci
jobs:
Tests:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_USER: Willie
MYSQL_PASSWORD: password12$
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: kms_base_testing
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Verify MySQL connection
run: |
printf installing mysql-client to be able to verify the connection:\n
sudo apt-get install -y mysql-client
printf \n
printf Databases in MySQL instance:\n
mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -uWillie -ppassword12$ -e "SHOW DATABASES"
- name: Setup PHP with some tools
uses: shivammathur/setup-php@v1
with:
php-version: '7.3'
tools: composer, phpunit
- name: Checkout project
uses: actions/checkout@v2
- name: Install composer packages
run: |
composer config -g github-oauth.github.com ${{ secrets.ACCESS_TOKEN }}
composer install --no-interaction --no-suggest
- name: Show installed private packages
run: composer show | grep kms
- name: Create .env files
run: |
php -r "file_exists('.env') || copy('.env.ci.example', '.env');"
- name: Generate key
run: php artisan key:generate
- name: Setup directory Permissions
run: chmod -R 777 storage bootstrap/cache
- name: Setup testing database
env:
DB_HOST: 127.0.0.1
DB_DATABASE: kms_base_testing
DB_USERNAME: Willie
DB_PASSWORD: password12$
DB_PORT: ${{ job.services.mysql.ports[3306] }}
run: |
php artisan config:clear
php -r "echo 'Database user to use: '.getenv('DB_USERNAME').PHP_EOL;";
php -r "echo 'Database to use: '.getenv('DB_DATABASE').PHP_EOL;";
php -r "echo 'Host to use: '.getenv('DB_HOST').PHP_EOL;";
php -r "echo 'Port to use: '.getenv('DB_PORT').PHP_EOL;";
php artisan migrate:fresh
php artisan kms:seed
php artisan db:seed
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: Install node packages and transpile assets
run: |
npm install
npm run prod
- name: Publish kms assets to boilerplate
run: php artisan vendor:publish --tag=kms-core-public --force
- name: Run unit tests via PHPUnit
run: |
nohup bash -c 'php artisan serve > /dev/null 2>&1 &'
vendor/bin/phpunit -c ./phpunit.xml
env:
DB_HOST: 127.0.0.1
DB_DATABASE: kms_base_testing
DB_USERNAME: Willie
DB_PASSWORD: password12$
DB_PORT: ${{ job.services.mysql.ports[3306] }}
- name: Upload laravel logs if testing failed
uses: actions/upload-artifact@v1
if: failure()
with:
name: Laravel logs
path: ./storage/logs
- name: Run cypress end to end tests in chrome
uses: cypress-io/github-action@v1
with:
browser: chrome
headless: true
- name: Upload laravel logs if end to end testing failed
uses: actions/upload-artifact@v1
if: failure()
with:
name: Laravel logs
path: ./storage/logs
- name: Upload cypress end to end video's if end to end testing failed
uses: actions/upload-artifact@v1
if: failure()
with:
name: Cypress video's
path: ./tests/Cypress/videos