1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 13:42:49 +01:00
invoiceninja/.github/workflows/phpunit.yml

133 lines
3.7 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
2023-02-17 05:10:38 +01:00
- v5-stable
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:
2022-08-29 09:08:53 +02:00
operating-system: ['ubuntu-20.04', 'ubuntu-22.04']
2023-01-18 23:12:34 +01:00
php-versions: ['8.1','8.2']
2020-12-18 01:34:40 +01:00
phpunit-versions: ['latest']
2023-01-18 23:12:34 +01:00
ci_node_total: [ 8 ]
ci_node_index: [ 0, 1, 2, 3, 4, 5, 6, 7]
laravel: [9.*]
dependency-version: [prefer-stable]
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'
2023-01-18 23:12:34 +01:00
REDIS_PORT: 6379
BROADCAST_DRIVER: log
2023-01-18 23:12:34 +01:00
CACHE_DRIVER: redis
QUEUE_CONNECTION: redis
SESSION_DRIVER: redis
NINJA_ENVIRONMENT: hosted
MULTI_DB_ENABLED: false
2023-01-18 21:39:14 +01:00
NINJA_LICENSE: ${{ secrets.ninja_license }}
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
2023-01-18 23:12:34 +01:00
redis:
image: redis
ports:
- 6379/tcp
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --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
2023-01-18 23:12:34 +01:00
- name: Start MariaDB service
run: |
2021-12-13 22:02:00 +01:00
sudo systemctl start mysql.service
- 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
2023-01-18 23:12:34 +01:00
- name: Setup PHP shivammathur/setup-php@v2
2020-12-18 01:47:11 +01:00
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
2023-01-18 23:12:34 +01:00
extensions: mysql, mysqlnd, sqlite3, bcmath, gmp, gd, curl, zip, openssl, mbstring, xml, redis
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
2023-01-18 23:12:34 +01:00
2023-03-02 10:28:26 +01:00
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.php }}-composer-
2023-01-18 23:12:34 +01:00
- name: Install composer dependencies
run: |
composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
composer install
2023-01-18 23:12:34 +01:00
- name: Prepare Laravel Application
2023-01-18 23:12:34 +01:00
env:
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
run: |
php artisan key:generate
2021-02-04 11:45:11 +01:00
php artisan optimize
php artisan cache:clear
php artisan config:cache
2023-01-18 23:12:34 +01:00
php artisan ninja:post-update
- name: Migrate Database
run: |
php artisan migrate:fresh --seed --force && php artisan db:seed --force
2023-01-22 04:10:57 +01:00
- name: Run Testsuite
run: |
cat .env
2022-08-19 09:07:23 +02:00
vendor/bin/snappdf download
2023-01-18 23:12:34 +01:00
tests/ci
env:
DB_PORT: ${{ job.services.mysql.ports[3306] }}
2021-11-28 06:41:16 +01:00
PHP_CS_FIXER_IGNORE_ENV: true
2023-01-18 23:12:34 +01:00
CI_NODE_TOTAL: ${{ matrix.ci_node_total }}
CI_NODE_INDEX: ${{ matrix.ci_node_index }}