mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 11:49:05 +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 install --no-interaction --prefer-dist
|
||||||
- run: composer ${{ matrix.command }}
|
- run: composer ${{ matrix.command }}
|
||||||
|
|
||||||
tests:
|
unit-tests:
|
||||||
runs-on: ubuntu-22.04
|
uses: './.github/workflows/ci/tests.yml'
|
||||||
strategy:
|
with:
|
||||||
matrix:
|
test-group: unit
|
||||||
php-version: ['8.1']
|
|
||||||
test-group: ['unit', 'api', 'cli']
|
api-tests:
|
||||||
steps:
|
uses: './.github/workflows/ci/tests.yml'
|
||||||
- name: Checkout code
|
with:
|
||||||
uses: actions/checkout@v2
|
test-group: api
|
||||||
- name: Start postgres database server
|
|
||||||
if: ${{ matrix.test-group == 'api' }}
|
cli-tests:
|
||||||
run: docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d shlink_db_postgres
|
uses: './.github/workflows/ci/tests.yml'
|
||||||
- name: Start maria database server
|
with:
|
||||||
if: ${{ matrix.test-group == 'cli' }}
|
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
|
|
||||||
|
|
||||||
db-tests:
|
db-tests:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
@ -106,7 +87,9 @@ jobs:
|
||||||
|
|
||||||
mutation-tests:
|
mutation-tests:
|
||||||
needs:
|
needs:
|
||||||
- tests
|
- unit-tests
|
||||||
|
- api-tests
|
||||||
|
- cli-tests
|
||||||
- db-tests
|
- db-tests
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -138,7 +121,9 @@ jobs:
|
||||||
|
|
||||||
upload-coverage:
|
upload-coverage:
|
||||||
needs:
|
needs:
|
||||||
- tests
|
- unit-tests
|
||||||
|
- api-tests
|
||||||
|
- cli-tests
|
||||||
- db-tests
|
- db-tests
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
strategy:
|
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…
Add table
Reference in a new issue