Added static analysis and generation of code coverage artifacts

This commit is contained in:
Alejandro Celaya 2020-12-13 12:59:06 +01:00
parent 5dc2c1640a
commit ac5a22a3d0

View File

@ -26,6 +26,24 @@ jobs:
- run: composer install --no-interaction --prefer-dist
- run: composer cs
static-analysis:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['7.4']
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer
extensions: swoole-4.5.9
coverage: none
- run: composer install --no-interaction --prefer-dist
- run: composer stan
unit-tests:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.php-version == '8.0' }}
@ -48,7 +66,12 @@ jobs:
- if: ${{ matrix.php-version != '8.0' }}
run: composer install --no-interaction --prefer-dist
- run: composer test:unit:ci
# TODO Upload code coverage on one PHP version only
- uses: actions/upload-artifact@v2
with:
name: coverage-unit
path: |
build/coverage-unit
build/coverage-unit.cov
db-tests-sqlite:
runs-on: ubuntu-latest
@ -71,7 +94,12 @@ jobs:
- if: ${{ matrix.php-version != '8.0' }}
run: composer install --no-interaction --prefer-dist
- run: composer test:db:sqlite:ci
# TODO Upload code coverage on one PHP version only
- uses: actions/upload-artifact@v2
with:
name: coverage-db
path: |
build/coverage-db
build/coverage-db.cov
db-tests-mysql:
runs-on: ubuntu-latest
@ -81,7 +109,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Start database
- name: Start database server
run: docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d shlink_db
- name: Use PHP
uses: shivammathur/setup-php@v2
@ -104,7 +132,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Start database
- name: Start database server
run: docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d shlink_db_maria
- name: Use PHP
uses: shivammathur/setup-php@v2
@ -127,7 +155,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Start database
- name: Start database server
run: docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d shlink_db_postgres
- name: Use PHP
uses: shivammathur/setup-php@v2
@ -152,7 +180,7 @@ jobs:
uses: actions/checkout@v2
- name: Install MSSQL ODBC
run: sudo ./data/infra/ci/install-ms-odbc.sh
- name: Start database
- name: Start database server
run: docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d shlink_db_ms
- name: Use PHP
uses: shivammathur/setup-php@v2
@ -165,7 +193,8 @@ jobs:
run: composer install --no-interaction --prefer-dist --ignore-platform-req=php
- if: ${{ matrix.php-version != '8.0' }}
run: composer install --no-interaction --prefer-dist
- run: docker-compose exec -T shlink_db_ms /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'Passw0rd!' -Q "CREATE DATABASE shlink_test;"
- name: Create test database
run: docker-compose exec -T shlink_db_ms /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'Passw0rd!' -Q "CREATE DATABASE shlink_test;"
- run: composer test:db:ms
api-tests:
@ -177,7 +206,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Start database
- name: Start database server
run: docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d shlink_db
- name: Use PHP
uses: shivammathur/setup-php@v2
@ -192,4 +221,9 @@ jobs:
- if: ${{ matrix.php-version != '8.0' }}
run: composer install --no-interaction --prefer-dist
- run: bin/test/run-api-tests.sh
# TODO Upload code coverage on one PHP version only
- uses: actions/upload-artifact@v2
with:
name: coverage-api
path: |
build/coverage-api
build/coverage-api.cov