2021-02-04 10:01:20 +01:00
|
|
|
on:
|
2020-03-25 14:03:23 +01:00
|
|
|
push:
|
|
|
|
branches:
|
2020-10-15 11:45:41 +02:00
|
|
|
- v5-develop
|
2020-08-06 02:16:28 +02:00
|
|
|
pull_request:
|
2021-02-04 10:01:20 +01:00
|
|
|
branches:
|
2020-10-15 11:45:41 +02:00
|
|
|
- v5-develop
|
2021-02-04 10:01:20 +01:00
|
|
|
|
2020-03-25 14:03:23 +01:00
|
|
|
name: phpunit
|
|
|
|
jobs:
|
2020-12-18 01:34:40 +01:00
|
|
|
run:
|
|
|
|
runs-on: ${{ matrix.operating-system }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2020-12-18 01:55:25 +01:00
|
|
|
operating-system: ['ubuntu-18.04', 'ubuntu-20.04']
|
2021-02-04 10:01:20 +01:00
|
|
|
php-versions: ['7.4']
|
2020-12-18 01:34:40 +01:00
|
|
|
phpunit-versions: ['latest']
|
2020-12-18 01:47:11 +01:00
|
|
|
|
2020-03-26 04:23:57 +01:00
|
|
|
env:
|
|
|
|
DB_DATABASE1: ninja
|
2021-02-04 11:45:11 +01:00
|
|
|
DB_USERNAME1: root
|
2020-03-26 04:23:57 +01:00
|
|
|
DB_PASSWORD1: ninja
|
2021-02-04 11:45:11 +01:00
|
|
|
DB_HOST1: '127.0.0.1'
|
2020-03-26 04:23:57 +01:00
|
|
|
DB_DATABASE: ninja
|
2021-02-04 11:45:11 +01:00
|
|
|
DB_USERNAME: root
|
2020-03-26 04:23:57 +01:00
|
|
|
DB_PASSWORD: ninja
|
2021-02-04 11:45:11 +01:00
|
|
|
DB_HOST: '127.0.0.1'
|
2020-03-26 04:23:57 +01:00
|
|
|
BROADCAST_DRIVER: log
|
|
|
|
CACHE_DRIVER: file
|
|
|
|
QUEUE_CONNECTION: sync
|
|
|
|
SESSION_DRIVER: file
|
2020-05-14 11:08:49 +02:00
|
|
|
NINJA_ENVIRONMENT: hosted
|
2020-03-28 12:34:04 +01:00
|
|
|
MULTI_DB_ENABLED: false
|
2020-04-15 02:30:52 +02:00
|
|
|
NINJA_LICENSE: 123456
|
2020-03-29 14:22:14 +02:00
|
|
|
TRAVIS: true
|
2020-09-07 01:29:46 +02:00
|
|
|
MAIL_MAILER: log
|
2020-03-29 14:22:14 +02:00
|
|
|
|
2020-03-25 14:03:23 +01:00
|
|
|
services:
|
2020-03-26 04:23:57 +01:00
|
|
|
mariadb:
|
2021-02-04 10:59:30 +01:00
|
|
|
image: mariadb:latest
|
2020-03-26 04:23:57 +01:00
|
|
|
ports:
|
2021-02-04 11:45:11 +01:00
|
|
|
- 3306
|
2020-03-25 14:03:23 +01:00
|
|
|
env:
|
2020-03-26 04:23:57 +01:00
|
|
|
MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
2021-02-04 10:59:30 +01:00
|
|
|
MYSQL_USER: ninja
|
2020-03-26 04:23:57 +01:00
|
|
|
MYSQL_PASSWORD: ninja
|
2020-03-25 14:03:23 +01:00
|
|
|
MYSQL_DATABASE: ninja
|
2020-03-26 04:23:57 +01:00
|
|
|
MYSQL_ROOT_PASSWORD: ninja
|
|
|
|
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
|
2021-02-04 10:01:20 +01:00
|
|
|
|
2020-03-25 14:03:23 +01:00
|
|
|
steps:
|
2020-03-26 04:23:57 +01:00
|
|
|
- name: Start mysql service
|
|
|
|
run: |
|
2021-02-04 10:16:50 +01:00
|
|
|
sudo /etc/init.d/mysql start
|
2020-03-26 04:23:57 +01:00
|
|
|
- name: Verify MariaDB connection
|
|
|
|
env:
|
|
|
|
DB_PORT: ${{ job.services.mariadb.ports[3306] }}
|
|
|
|
DB_PORT1: ${{ job.services.mariadb.ports[3306] }}
|
|
|
|
|
|
|
|
run: |
|
|
|
|
while ! mysqladmin ping -h"127.0.0.1" -P"$DB_PORT" --silent; do
|
|
|
|
sleep 1
|
|
|
|
done
|
2020-12-18 01:47:11 +01:00
|
|
|
- name: Setup PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php-versions }}
|
2021-02-04 11:30:50 +01:00
|
|
|
extensions: mysql, mysqlnd, sqlite3, bcmath, gmp, gd, curl, zip, openssl, mbstring, xml
|
2021-02-04 10:01:20 +01:00
|
|
|
|
2020-03-25 14:03:23 +01:00
|
|
|
- uses: actions/checkout@v1
|
|
|
|
with:
|
2020-10-15 12:45:23 +02:00
|
|
|
ref: v5-develop
|
2020-03-25 14:03:23 +01:00
|
|
|
fetch-depth: 1
|
|
|
|
|
|
|
|
- name: Copy .env
|
|
|
|
run: |
|
|
|
|
cp .env.ci .env
|
|
|
|
- name: Install composer dependencies
|
|
|
|
run: |
|
|
|
|
composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
composer install
|
|
|
|
- name: Prepare Laravel Application
|
|
|
|
run: |
|
|
|
|
php artisan key:generate
|
2021-02-04 11:45:11 +01:00
|
|
|
php artisan optimize
|
2020-03-26 04:23:57 +01:00
|
|
|
php artisan cache:clear
|
|
|
|
php artisan config:cache
|
2021-02-04 11:45:11 +01:00
|
|
|
- name: Create DB and schemas
|
|
|
|
run: |
|
|
|
|
mkdir -p database
|
|
|
|
touch database/database.sqlite
|
2020-03-25 14:03:23 +01:00
|
|
|
- name: Migrate Database
|
|
|
|
run: |
|
2020-05-20 00:49:58 +02:00
|
|
|
php artisan migrate:fresh --seed --force && php artisan db:seed --force
|
2020-03-26 04:23:57 +01:00
|
|
|
- name: Prepare JS/CSS assets
|
|
|
|
run: |
|
|
|
|
npm i
|
|
|
|
npm run production
|
2020-03-25 14:03:23 +01:00
|
|
|
- name: Run Testsuite
|
2020-03-28 12:34:04 +01:00
|
|
|
run: |
|
|
|
|
cat .env
|
|
|
|
vendor/bin/phpunit --testdox
|
2020-03-26 04:23:57 +01:00
|
|
|
env:
|
|
|
|
DB_PORT: ${{ job.services.mysql.ports[3306] }}
|
|
|
|
|
2020-12-31 14:21:40 +01:00
|
|
|
- name: Run php-cs-fixer
|
|
|
|
run: |
|
2021-02-04 11:45:11 +01:00
|
|
|
vendor/bin/php-cs-fixer fix
|