2020-12-13 12:44:02 +03:00
|
|
|
name: Continuous integration
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request: null
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
- develop
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
lint:
|
2020-12-13 19:17:16 +03:00
|
|
|
runs-on: ubuntu-20.04
|
2020-12-13 14:31:34 +03:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-05-22 10:49:24 +03:00
|
|
|
php-version: ['8.0']
|
2020-12-13 12:44:02 +03:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Use PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
2020-12-13 14:31:34 +03:00
|
|
|
php-version: ${{ matrix.php-version }}
|
2020-12-13 12:44:02 +03:00
|
|
|
tools: composer
|
2021-02-10 00:55:30 +03:00
|
|
|
extensions: swoole-4.6.3
|
2020-12-13 14:31:34 +03:00
|
|
|
coverage: none
|
2020-12-13 12:44:02 +03:00
|
|
|
- run: composer install --no-interaction --prefer-dist
|
|
|
|
- run: composer cs
|
|
|
|
|
2020-12-13 14:59:06 +03:00
|
|
|
static-analysis:
|
2020-12-13 19:17:16 +03:00
|
|
|
runs-on: ubuntu-20.04
|
2020-12-13 14:59:06 +03:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-05-22 10:49:24 +03:00
|
|
|
php-version: ['8.0']
|
2020-12-13 14:59:06 +03:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Use PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php-version }}
|
|
|
|
tools: composer
|
2021-02-10 00:55:30 +03:00
|
|
|
extensions: swoole-4.6.3
|
2020-12-13 14:59:06 +03:00
|
|
|
coverage: none
|
|
|
|
- run: composer install --no-interaction --prefer-dist
|
|
|
|
- run: composer stan
|
|
|
|
|
2020-12-13 12:44:02 +03:00
|
|
|
unit-tests:
|
2020-12-13 19:17:16 +03:00
|
|
|
runs-on: ubuntu-20.04
|
2020-12-13 12:44:02 +03:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2020-12-13 14:31:34 +03:00
|
|
|
php-version: ['7.4', '8.0']
|
2020-12-13 12:44:02 +03:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Use PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php-version }}
|
|
|
|
tools: composer
|
2021-02-10 00:55:30 +03:00
|
|
|
extensions: swoole-4.6.3
|
2020-12-13 13:37:45 +03:00
|
|
|
coverage: pcov
|
|
|
|
ini-values: pcov.directory=module
|
2021-01-25 00:59:19 +03:00
|
|
|
- run: composer install --no-interaction --prefer-dist
|
2020-12-13 12:44:02 +03:00
|
|
|
- run: composer test:unit:ci
|
2020-12-13 14:59:06 +03:00
|
|
|
- uses: actions/upload-artifact@v2
|
2020-12-13 15:11:41 +03:00
|
|
|
if: ${{ matrix.php-version == '7.4' }}
|
2020-12-13 14:59:06 +03:00
|
|
|
with:
|
|
|
|
name: coverage-unit
|
|
|
|
path: |
|
|
|
|
build/coverage-unit
|
|
|
|
build/coverage-unit.cov
|
2020-12-13 12:44:02 +03:00
|
|
|
|
|
|
|
db-tests-sqlite:
|
2020-12-13 19:17:16 +03:00
|
|
|
runs-on: ubuntu-20.04
|
2020-12-13 12:44:02 +03:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2020-12-13 14:31:34 +03:00
|
|
|
php-version: ['7.4', '8.0']
|
2020-12-13 12:44:02 +03:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Use PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php-version }}
|
|
|
|
tools: composer
|
2021-02-10 00:55:30 +03:00
|
|
|
extensions: swoole-4.6.3
|
2020-12-13 13:37:45 +03:00
|
|
|
coverage: pcov
|
|
|
|
ini-values: pcov.directory=module
|
2021-01-25 00:59:19 +03:00
|
|
|
- run: composer install --no-interaction --prefer-dist
|
2020-12-13 12:44:02 +03:00
|
|
|
- run: composer test:db:sqlite:ci
|
2020-12-13 14:59:06 +03:00
|
|
|
- uses: actions/upload-artifact@v2
|
2020-12-13 15:11:41 +03:00
|
|
|
if: ${{ matrix.php-version == '7.4' }}
|
2020-12-13 14:59:06 +03:00
|
|
|
with:
|
|
|
|
name: coverage-db
|
|
|
|
path: |
|
|
|
|
build/coverage-db
|
|
|
|
build/coverage-db.cov
|
2020-12-13 12:44:02 +03:00
|
|
|
|
|
|
|
db-tests-mysql:
|
2020-12-13 19:17:16 +03:00
|
|
|
runs-on: ubuntu-20.04
|
2020-12-13 12:44:02 +03:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2020-12-13 14:31:34 +03:00
|
|
|
php-version: ['7.4', '8.0']
|
2020-12-13 12:44:02 +03:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
2020-12-13 14:59:06 +03:00
|
|
|
- name: Start database server
|
2020-12-13 12:44:02 +03:00
|
|
|
run: docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d shlink_db
|
|
|
|
- name: Use PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php-version }}
|
|
|
|
tools: composer
|
2021-02-10 00:55:30 +03:00
|
|
|
extensions: swoole-4.6.3
|
2020-12-13 14:31:34 +03:00
|
|
|
coverage: none
|
2021-01-25 00:59:19 +03:00
|
|
|
- run: composer install --no-interaction --prefer-dist
|
2020-12-13 12:44:02 +03:00
|
|
|
- run: composer test:db:mysql
|
|
|
|
|
2020-12-13 14:31:34 +03:00
|
|
|
db-tests-maria:
|
2020-12-13 19:17:16 +03:00
|
|
|
runs-on: ubuntu-20.04
|
2020-12-13 14:31:34 +03:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
php-version: ['7.4', '8.0']
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
2020-12-13 14:59:06 +03:00
|
|
|
- name: Start database server
|
2020-12-13 14:31:34 +03:00
|
|
|
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
|
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php-version }}
|
|
|
|
tools: composer
|
2021-02-10 00:55:30 +03:00
|
|
|
extensions: swoole-4.6.3
|
2020-12-13 14:31:34 +03:00
|
|
|
coverage: none
|
2021-01-25 00:59:19 +03:00
|
|
|
- run: composer install --no-interaction --prefer-dist
|
2020-12-13 14:31:34 +03:00
|
|
|
- run: composer test:db:maria
|
|
|
|
|
|
|
|
db-tests-postgres:
|
2020-12-13 19:17:16 +03:00
|
|
|
runs-on: ubuntu-20.04
|
2020-12-13 14:31:34 +03:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
php-version: ['7.4', '8.0']
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
2020-12-13 14:59:06 +03:00
|
|
|
- name: Start database server
|
2020-12-13 14:31:34 +03:00
|
|
|
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
|
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php-version }}
|
|
|
|
tools: composer
|
2021-02-10 00:55:30 +03:00
|
|
|
extensions: swoole-4.6.3
|
2020-12-13 14:31:34 +03:00
|
|
|
coverage: none
|
2021-01-25 00:59:19 +03:00
|
|
|
- run: composer install --no-interaction --prefer-dist
|
2020-12-13 14:31:34 +03:00
|
|
|
- run: composer test:db:postgres
|
|
|
|
|
|
|
|
db-tests-ms:
|
2020-12-13 19:17:16 +03:00
|
|
|
runs-on: ubuntu-20.04
|
2020-12-13 14:31:34 +03:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
php-version: ['7.4', '8.0']
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Install MSSQL ODBC
|
2020-12-13 14:38:12 +03:00
|
|
|
run: sudo ./data/infra/ci/install-ms-odbc.sh
|
2020-12-13 14:59:06 +03:00
|
|
|
- name: Start database server
|
2020-12-13 14:31:34 +03:00
|
|
|
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
|
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php-version }}
|
|
|
|
tools: composer
|
2021-02-10 00:55:30 +03:00
|
|
|
extensions: swoole-4.6.3, pdo_sqlsrv-5.9.0
|
2020-12-13 14:31:34 +03:00
|
|
|
coverage: none
|
2021-01-25 00:59:19 +03:00
|
|
|
- run: composer install --no-interaction --prefer-dist
|
2020-12-13 14:59:06 +03:00
|
|
|
- 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;"
|
2020-12-13 14:31:34 +03:00
|
|
|
- run: composer test:db:ms
|
|
|
|
|
2020-12-13 12:44:02 +03:00
|
|
|
api-tests:
|
2020-12-13 19:17:16 +03:00
|
|
|
runs-on: ubuntu-20.04
|
2020-12-13 12:44:02 +03:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2020-12-13 14:31:34 +03:00
|
|
|
php-version: ['7.4', '8.0']
|
2020-12-13 12:44:02 +03:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
2020-12-13 14:59:06 +03:00
|
|
|
- name: Start database server
|
2021-02-05 20:33:36 +03:00
|
|
|
run: docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d shlink_db_postgres
|
2020-12-13 12:44:02 +03:00
|
|
|
- name: Use PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php-version }}
|
|
|
|
tools: composer
|
2021-02-10 00:55:30 +03:00
|
|
|
extensions: swoole-4.6.3
|
2020-12-13 13:37:45 +03:00
|
|
|
coverage: pcov
|
|
|
|
ini-values: pcov.directory=module
|
2021-01-25 00:59:19 +03:00
|
|
|
- run: composer install --no-interaction --prefer-dist
|
2020-12-13 12:44:02 +03:00
|
|
|
- run: bin/test/run-api-tests.sh
|
2020-12-13 14:59:06 +03:00
|
|
|
- uses: actions/upload-artifact@v2
|
2020-12-13 15:11:41 +03:00
|
|
|
if: ${{ matrix.php-version == '7.4' }}
|
2020-12-13 14:59:06 +03:00
|
|
|
with:
|
|
|
|
name: coverage-api
|
|
|
|
path: |
|
|
|
|
build/coverage-api
|
|
|
|
build/coverage-api.cov
|
2020-12-13 15:11:41 +03:00
|
|
|
|
|
|
|
mutation-tests:
|
|
|
|
needs:
|
|
|
|
- unit-tests
|
|
|
|
- db-tests-sqlite
|
|
|
|
- api-tests
|
2020-12-13 19:17:16 +03:00
|
|
|
runs-on: ubuntu-20.04
|
2020-12-13 15:11:41 +03:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2020-12-19 12:04:00 +03:00
|
|
|
php-version: ['7.4', '8.0']
|
2021-05-22 22:33:50 +03:00
|
|
|
test-group: ['unit', 'db']
|
2020-12-13 15:11:41 +03:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Use PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php-version }}
|
|
|
|
tools: composer
|
2021-02-10 00:55:30 +03:00
|
|
|
extensions: swoole-4.6.3
|
2020-12-13 15:11:41 +03:00
|
|
|
coverage: pcov
|
|
|
|
ini-values: pcov.directory=module
|
2021-01-25 00:59:19 +03:00
|
|
|
- run: composer install --no-interaction --prefer-dist
|
2020-12-13 15:11:41 +03:00
|
|
|
- uses: actions/download-artifact@v2
|
|
|
|
with:
|
|
|
|
path: build
|
2021-05-22 22:33:50 +03:00
|
|
|
- run: composer infect:ci:${{ matrix.test-group }}
|
2020-12-13 15:34:22 +03:00
|
|
|
|
|
|
|
upload-coverage:
|
2020-12-13 19:17:16 +03:00
|
|
|
needs:
|
|
|
|
- unit-tests
|
|
|
|
- db-tests-sqlite
|
|
|
|
- api-tests
|
|
|
|
runs-on: ubuntu-20.04
|
2020-12-13 15:34:22 +03:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-05-22 10:49:24 +03:00
|
|
|
php-version: ['8.0']
|
2020-12-13 15:34:22 +03:00
|
|
|
steps:
|
2020-12-13 19:31:22 +03:00
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
2020-12-13 15:34:22 +03:00
|
|
|
- name: Use PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php-version }}
|
2020-12-13 19:23:58 +03:00
|
|
|
coverage: pcov
|
|
|
|
ini-values: pcov.directory=module
|
2020-12-13 15:34:22 +03:00
|
|
|
- uses: actions/download-artifact@v2
|
|
|
|
with:
|
|
|
|
path: build
|
|
|
|
- run: mv build/coverage-unit/coverage-unit.cov build/coverage-unit.cov
|
|
|
|
- run: mv build/coverage-db/coverage-db.cov build/coverage-db.cov
|
|
|
|
- run: mv build/coverage-api/coverage-api.cov build/coverage-api.cov
|
2020-12-19 12:25:19 +03:00
|
|
|
- run: wget https://phar.phpunit.de/phpcov-8.2.0.phar
|
|
|
|
- run: php phpcov-8.2.0.phar merge build --clover build/clover.xml
|
|
|
|
- name: Publish coverage
|
|
|
|
uses: codecov/codecov-action@v1
|
|
|
|
with:
|
|
|
|
file: ./build/clover.xml
|
2020-12-13 15:34:22 +03:00
|
|
|
|
|
|
|
delete-artifacts:
|
|
|
|
needs:
|
|
|
|
- mutation-tests
|
|
|
|
- upload-coverage
|
2020-12-13 19:17:16 +03:00
|
|
|
runs-on: ubuntu-20.04
|
2020-12-13 15:34:22 +03:00
|
|
|
steps:
|
|
|
|
- uses: geekyeggo/delete-artifact@v1
|
|
|
|
with:
|
|
|
|
name: |
|
|
|
|
coverage-unit
|
|
|
|
coverage-db
|
|
|
|
coverage-api
|
2020-12-13 19:45:48 +03:00
|
|
|
|
|
|
|
build-docker-image:
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
2021-01-30 11:54:47 +03:00
|
|
|
with:
|
|
|
|
fetch-depth: 100
|
2020-12-13 19:45:48 +03:00
|
|
|
- uses: marceloprado/has-changed-path@v1
|
|
|
|
id: changed-dockerfile
|
|
|
|
with:
|
|
|
|
paths: ./Dockerfile
|
|
|
|
- if: ${{ steps.changed-dockerfile.outputs.changed == 'true' }}
|
|
|
|
run: docker build -t shlink-docker-image:temp .
|
|
|
|
- if: ${{ steps.changed-dockerfile.outputs.changed != 'true' }}
|
|
|
|
run: echo "Dockerfile didn't change. Skipped"
|