-
-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1506 from acelaya-forks/feature/local-reusable-wo…
…rkflows Extracted definition of unit tests job to local reusable workflow
- Loading branch information
Showing
4 changed files
with
203 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Database tests | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
platform: | ||
type: string | ||
required: true | ||
description: One of sqlite:ci, mysql, maria, postgres or ms | ||
|
||
jobs: | ||
db-tests: | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
php-version: [ '8.1' ] | ||
env: | ||
LC_ALL: C | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Install MSSQL ODBC | ||
if: ${{ inputs.platform == 'ms' }} | ||
run: sudo ./data/infra/ci/install-ms-odbc.sh | ||
- name: Start database server | ||
if: ${{ inputs.platform != 'sqlite:ci' }} | ||
run: docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d shlink_db_${{ inputs.platform }} | ||
- name: Use PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
tools: composer | ||
extensions: openswoole-4.11.1, pdo_sqlsrv-5.10.1 | ||
coverage: pcov | ||
ini-values: pcov.directory=module | ||
- name: Install dependencies | ||
run: composer install --no-interaction --prefer-dist | ||
- name: Create test database | ||
if: ${{ inputs.platform == 'ms' }} | ||
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: Run tests | ||
run: composer test:db:${{ inputs.platform }} | ||
- name: Upload code coverage | ||
uses: actions/upload-artifact@v2 | ||
if: ${{ matrix.php-version == '8.1' && inputs.platform == 'sqlite:ci' }} | ||
with: | ||
name: coverage-db | ||
path: | | ||
build/coverage-db | ||
build/coverage-db.cov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Mutation tests | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
test-group: | ||
type: string | ||
required: true | ||
description: One of unit, db, api or cli | ||
|
||
jobs: | ||
mutation-tests: | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
php-version: [ '8.1' ] | ||
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: openswoole-4.11.1 | ||
coverage: pcov | ||
ini-values: pcov.directory=module | ||
- name: Install dependencies | ||
run: composer install --no-interaction --prefer-dist | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
path: build | ||
- if: ${{ inputs.test-group == 'unit' }} | ||
run: composer infect:ci:unit | ||
env: | ||
INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }} | ||
- if: ${{ inputs.test-group != 'unit' }} | ||
run: composer infect:ci:${{ inputs.test-group }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters