mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-25 02:10:18 -06:00
45 lines
1.5 KiB
YAML
45 lines
1.5 KiB
YAML
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', '8.2']
|
|
env:
|
|
LC_ALL: C
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- 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 }}
|
|
- uses: './.github/actions/ci-setup'
|
|
with:
|
|
php-version: ${{ matrix.php-version }}
|
|
php-extensions: openswoole-22.0.0, pdo_sqlsrv-5.10.1
|
|
extensions-cache-key: db-tests-extensions-${{ matrix.php-version }}-${{ inputs.platform }}
|
|
- 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@v3
|
|
if: ${{ matrix.php-version == '8.1' && inputs.platform == 'sqlite:ci' }}
|
|
with:
|
|
name: coverage-db
|
|
path: |
|
|
build/coverage-db
|
|
build/coverage-db.cov
|