2022-08-12 02:30:52 -05:00
|
|
|
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:
|
2023-11-04 06:42:31 -05:00
|
|
|
php-version: ['8.2', '8.3']
|
2022-08-12 02:30:52 -05:00
|
|
|
env:
|
|
|
|
LC_ALL: C
|
|
|
|
steps:
|
2023-11-04 06:42:31 -05:00
|
|
|
- uses: actions/checkout@v4
|
2022-08-12 02:30:52 -05:00
|
|
|
- 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 }}
|
2022-08-13 04:56:46 -05:00
|
|
|
- uses: './.github/actions/ci-setup'
|
2022-08-12 13:32:16 -05:00
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php-version }}
|
2024-02-11 04:22:48 -06:00
|
|
|
php-extensions: openswoole-22.1.2, pdo_sqlsrv-5.12.0
|
2022-08-13 04:56:46 -05:00
|
|
|
extensions-cache-key: db-tests-extensions-${{ matrix.php-version }}-${{ inputs.platform }}
|
2022-08-12 02:30:52 -05:00
|
|
|
- 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
|
2023-12-19 04:13:13 -06:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-05-29 02:43:12 -05:00
|
|
|
if: ${{ matrix.php-version == '8.2' && inputs.platform == 'sqlite:ci' }}
|
2022-08-12 02:30:52 -05:00
|
|
|
with:
|
|
|
|
name: coverage-db
|
|
|
|
path: |
|
|
|
|
build/coverage-db
|
|
|
|
build/coverage-db.cov
|