replace travis with github actions (#1452)

This commit is contained in:
Kevin Papst
2020-02-09 23:54:04 +01:00
committed by GitHub
parent 986d922855
commit e06314e802
11 changed files with 131 additions and 129 deletions

35
.github/workflows/coverage.yaml vendored Normal file
View File

@@ -0,0 +1,35 @@
name: Code coverage
on:
pull_request: null
push:
branches:
- master
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.4']
name: PHP ${{ matrix.php }}
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v1
with:
php-version: ${{ matrix.php }}
coverage: pcov
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite
- run: |
composer install --no-progress
composer require zendframework/zend-ldap
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Run tests
run: vendor/bin/phpunit tests/ --coverage-clover=coverage.xml
env:
TEST_WITH_BUNDLES: 1
- name: Upload code coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml

28
.github/workflows/linting.yaml vendored Normal file
View File

@@ -0,0 +1,28 @@
name: Code Styles
on:
pull_request: null
push:
branches:
- master
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.4']
name: PHP ${{ matrix.php }}
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v1
with:
php-version: ${{ matrix.php }}
coverage: none
extensions: intl
tools: cs2pr:1.0.1
- run: composer install --no-progress
- run: composer validate --no-check-all --strict
- run: vendor/bin/php-cs-fixer fix --dry-run --verbose --config=.php_cs.dist --using-cache=no --show-progress=none --format=checkstyle | cs2pr
- run: vendor/bin/phpstan analyse src -c phpstan.neon --level=3 --no-progress --error-format=checkstyle | cs2pr
- run: vendor/bin/phpstan analyse tests -c tests/phpstan.neon --level=4 --no-progress --error-format=checkstyle | cs2pr
- run: composer kimai:code-lint

58
.github/workflows/testing.yaml vendored Normal file
View File

@@ -0,0 +1,58 @@
name: Tests & Migrations
on:
pull_request: null
push:
branches:
- master
jobs:
tests:
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:
php: ['7.2', '7.3', '7.4']
name: PHP ${{ matrix.php }}
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v1
with:
php-version: ${{ matrix.php }}
coverage: none
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql
- run: |
composer install --no-progress
composer require zendframework/zend-ldap
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Run unit tests
run: composer kimai:tests-unit
- name: Run migrations on MySQL
run: |
bin/console doctrine:database:create --if-not-exists -n
bin/console doctrine:migrations:migrate -n
bin/console doctrine:migrations:migrate first -n
env:
DATABASE_URL: mysql://root:kimai@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/kimai
APP_ENV: dev
MAILER_URL: null://localhost
- name: Run migrations on SQLite
run: |
bin/console doctrine:database:create -n
bin/console doctrine:migrations:migrate -n
bin/console doctrine:migrations:migrate first -n
env:
DATABASE_URL: sqlite:///%kernel.project_dir%/var/data/kimai_migrations.sqlite
APP_ENV: dev
MAILER_URL: null://localhost
- name: Run integration tests
run: composer kimai:tests-integration