1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 16:31:33 +02:00
invoiceninja/.github/workflows/phpunit.yml

114 lines
2.9 KiB
YAML
Raw Normal View History

2021-02-04 10:01:20 +01:00
on:
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
name: phpunit
jobs:
2020-12-18 01:34:40 +01:00
run:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: ['ubuntu-18.04', 'ubuntu-20.04']
2021-11-28 02:19:25 +01:00
php-versions: ['7.4','8.0','8.1']
2020-12-18 01:34:40 +01:00
phpunit-versions: ['latest']
2020-12-18 01:47:11 +01:00
env:
DB_DATABASE1: ninja
2021-02-04 11:45:11 +01:00
DB_USERNAME1: root
DB_PASSWORD1: ninja
2021-02-04 11:45:11 +01:00
DB_HOST1: '127.0.0.1'
DB_DATABASE: ninja
2021-02-04 11:45:11 +01:00
DB_USERNAME: root
DB_PASSWORD: ninja
2021-02-04 11:45:11 +01:00
DB_HOST: '127.0.0.1'
BROADCAST_DRIVER: log
CACHE_DRIVER: file
QUEUE_CONNECTION: sync
SESSION_DRIVER: file
NINJA_ENVIRONMENT: hosted
MULTI_DB_ENABLED: false
NINJA_LICENSE: 123456
TRAVIS: true
2020-09-07 01:29:46 +02:00
MAIL_MAILER: log
services:
mariadb:
2021-02-04 10:59:30 +01:00
image: mariadb:latest
ports:
2021-02-04 11:51:09 +01:00
- 32768:3306
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
2021-02-04 10:59:30 +01:00
MYSQL_USER: ninja
MYSQL_PASSWORD: ninja
MYSQL_DATABASE: ninja
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
2021-07-26 13:26:22 +02:00
steps:
- name: Add hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 ninja.test" | sudo tee -a /etc/hosts
- name: Start mysql service
run: |
2021-02-04 10:16:50 +01:00
sudo /etc/init.d/mysql start
- 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
- uses: actions/checkout@v1
with:
2021-02-21 11:28:43 +01:00
ref: v5-develop
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
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
- name: Migrate Database
run: |
php artisan migrate:fresh --seed --force && php artisan db:seed --force
- name: Prepare JS/CSS assets
run: |
npm i
npm run production
- name: Run Testsuite
run: |
cat .env
vendor/bin/phpunit --testdox
env:
DB_PORT: ${{ job.services.mysql.ports[3306] }}
2021-11-28 06:41:16 +01:00
PHP_CS_FIXER_IGNORE_ENV: true
2020-12-31 14:21:40 +01:00
- name: Run php-cs-fixer
run: |
vendor/bin/php-cs-fixer fix