2021-05-31 12:53:22 +00:00
|
|
|
name: Tests
|
2020-02-09 22:54:04 +00:00
|
|
|
on:
|
|
|
|
pull_request: null
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
jobs:
|
2021-06-01 17:20:12 +00:00
|
|
|
integration:
|
2020-02-09 22:54:04 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
|
|
mysql:
|
|
|
|
image: mysql:5.7
|
|
|
|
env:
|
|
|
|
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
|
|
|
MYSQL_ROOT_PASSWORD: kimai
|
|
|
|
MYSQL_DATABASE: kimai
|
|
|
|
ports:
|
|
|
|
- 3306/tcp
|
|
|
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-05-31 12:53:22 +00:00
|
|
|
php: ['7.3', '7.4', '8.0']
|
2020-02-09 22:54:04 +00:00
|
|
|
|
2021-06-01 17:20:12 +00:00
|
|
|
name: Integration (${{ matrix.php }})
|
2020-02-09 22:54:04 +00:00
|
|
|
steps:
|
2021-06-01 17:20:12 +00:00
|
|
|
|
|
|
|
- name: Clone Kimai
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Setup PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
2020-02-09 22:54:04 +00:00
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php }}
|
|
|
|
coverage: none
|
2021-03-08 15:06:22 +00:00
|
|
|
extensions: mbstring, xml, ctype, iconv, intl, mysql, zip, gd, ldap
|
2021-06-01 17:20:12 +00:00
|
|
|
tools: cs2pr:1.1.0
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
uses: ramsey/composer-install@v1
|
|
|
|
|
|
|
|
- name: Validate Composer
|
|
|
|
run: composer validate --strict
|
|
|
|
|
|
|
|
- name: Check codestyles
|
|
|
|
run: vendor/bin/php-cs-fixer fix --dry-run --verbose --config=.php-cs-fixer.dist.php --using-cache=no --show-progress=none --format=checkstyle | cs2pr
|
|
|
|
|
|
|
|
- name: Run PHPStan on Codebase
|
|
|
|
run: vendor/bin/phpstan analyse src -c phpstan.neon --level=5 --no-progress --error-format=checkstyle | cs2pr
|
|
|
|
|
|
|
|
- name: Run PHPStan on Tests
|
|
|
|
run: vendor/bin/phpstan analyse tests -c tests/phpstan.neon --level=5 --no-progress --error-format=checkstyle | cs2pr
|
|
|
|
|
|
|
|
- name: Lint codebase
|
2021-09-16 22:58:25 +00:00
|
|
|
run: composer linting
|
2021-06-01 17:20:12 +00:00
|
|
|
|
|
|
|
- name: Install LDAP package
|
|
|
|
run: composer require laminas/laminas-ldap
|
|
|
|
|
2020-02-09 22:54:04 +00:00
|
|
|
- name: Setup problem matchers for PHPUnit
|
|
|
|
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
|
2021-06-01 17:20:12 +00:00
|
|
|
|
2020-02-09 22:54:04 +00:00
|
|
|
- name: Run unit tests
|
|
|
|
run: composer kimai:tests-unit
|
|
|
|
env:
|
2021-03-08 15:06:22 +00:00
|
|
|
DATABASE_URL: mysql://root:kimai@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/kimai?serverVersion=5.7
|
|
|
|
APP_ENV: dev
|
|
|
|
MAILER_URL: null://localhost
|
2021-06-01 17:20:12 +00:00
|
|
|
|
2021-03-08 15:06:22 +00:00
|
|
|
- name: Run integration tests
|
|
|
|
run: composer kimai:tests-integration
|
|
|
|
env:
|
|
|
|
DATABASE_URL: mysql://root:kimai@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/kimai?serverVersion=5.7
|
2020-02-09 22:54:04 +00:00
|
|
|
APP_ENV: dev
|
|
|
|
MAILER_URL: null://localhost
|
2021-06-01 17:20:12 +00:00
|
|
|
|
2021-03-08 15:06:22 +00:00
|
|
|
- name: Run migrations on MySQL
|
2020-02-09 22:54:04 +00:00
|
|
|
run: |
|
2021-05-31 12:53:22 +00:00
|
|
|
bin/console doctrine:database:drop --if-exists --force -n
|
2021-03-08 15:06:22 +00:00
|
|
|
bin/console doctrine:database:create --if-not-exists -n
|
2020-02-09 22:54:04 +00:00
|
|
|
bin/console doctrine:migrations:migrate -n
|
|
|
|
bin/console doctrine:migrations:migrate first -n
|
|
|
|
env:
|
2021-03-08 15:06:22 +00:00
|
|
|
DATABASE_URL: mysql://root:kimai@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/kimai?serverVersion=5.7
|
2020-02-09 22:54:04 +00:00
|
|
|
APP_ENV: dev
|
|
|
|
MAILER_URL: null://localhost
|