mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-27 16:26:37 +03:00
Extracted definition of unit tests job to local reusable workflow
This commit is contained in:
parent
4bd3fa74d1
commit
e3b6c061c4
2 changed files with 63 additions and 35 deletions
55
.github/workflows/ci.yml
vendored
55
.github/workflows/ci.yml
vendored
|
@ -29,39 +29,20 @@ jobs:
|
|||
run: composer install --no-interaction --prefer-dist
|
||||
- run: composer ${{ matrix.command }}
|
||||
|
||||
tests:
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
matrix:
|
||||
php-version: ['8.1']
|
||||
test-group: ['unit', 'api', 'cli']
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Start postgres database server
|
||||
if: ${{ matrix.test-group == 'api' }}
|
||||
run: docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d shlink_db_postgres
|
||||
- name: Start maria database server
|
||||
if: ${{ matrix.test-group == 'cli' }}
|
||||
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
|
||||
extensions: openswoole-4.11.1
|
||||
coverage: pcov
|
||||
ini-values: pcov.directory=module
|
||||
- name: Install dependencies
|
||||
run: composer install --no-interaction --prefer-dist
|
||||
- run: composer test:${{ matrix.test-group }}:ci
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: ${{ matrix.php-version == '8.1' }}
|
||||
with:
|
||||
name: coverage-${{ matrix.test-group }}
|
||||
path: |
|
||||
build/coverage-${{ matrix.test-group }}
|
||||
build/coverage-${{ matrix.test-group }}.cov
|
||||
unit-tests:
|
||||
uses: './.github/workflows/ci/tests.yml'
|
||||
with:
|
||||
test-group: unit
|
||||
|
||||
api-tests:
|
||||
uses: './.github/workflows/ci/tests.yml'
|
||||
with:
|
||||
test-group: api
|
||||
|
||||
cli-tests:
|
||||
uses: './.github/workflows/ci/tests.yml'
|
||||
with:
|
||||
test-group: cli
|
||||
|
||||
db-tests:
|
||||
runs-on: ubuntu-22.04
|
||||
|
@ -106,7 +87,9 @@ jobs:
|
|||
|
||||
mutation-tests:
|
||||
needs:
|
||||
- tests
|
||||
- unit-tests
|
||||
- api-tests
|
||||
- cli-tests
|
||||
- db-tests
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
|
@ -138,7 +121,9 @@ jobs:
|
|||
|
||||
upload-coverage:
|
||||
needs:
|
||||
- tests
|
||||
- unit-tests
|
||||
- api-tests
|
||||
- cli-tests
|
||||
- db-tests
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
|
|
43
.github/workflows/ci/tests.yml
vendored
Normal file
43
.github/workflows/ci/tests.yml
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
name: Tests
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
test-group:
|
||||
type: string
|
||||
required: true
|
||||
description: One of unit, api or cli
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
matrix:
|
||||
php-version: ['8.1']
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Start postgres database server
|
||||
if: ${{ inputs.test-group == 'api' }}
|
||||
run: docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d shlink_db_postgres
|
||||
- name: Start maria database server
|
||||
if: ${{ inputs.test-group == 'cli' }}
|
||||
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
|
||||
extensions: openswoole-4.11.1
|
||||
coverage: pcov
|
||||
ini-values: pcov.directory=module
|
||||
- name: Install dependencies
|
||||
run: composer install --no-interaction --prefer-dist
|
||||
- run: composer test:${{ inputs.test-group }}:ci
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: ${{ matrix.php-version == '8.1' }}
|
||||
with:
|
||||
name: coverage-${{ inputs.test-group }}
|
||||
path: |
|
||||
build/coverage-${{ inputs.test-group }}
|
||||
build/coverage-${{ inputs.test-group }}.cov
|
Loading…
Reference in a new issue