added Docker Compose setup for database testing #873
This file contains hidden or 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
| name: Tests | |
| on: [push, pull_request] | |
| env: | |
| php-extensions: mbstring, intl, pdo_sqlsrv-5.12.0 | |
| php-tools: "composer:v2, pecl" | |
| jobs: | |
| tests: | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| matrix: | |
| php: ['8.1', '8.2', '8.3', '8.4', '8.5'] | |
| fail-fast: false | |
| name: PHP ${{ matrix.php }} tests | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Start database containers | |
| run: docker compose up -d --wait --quiet-pull | |
| - name: Create MS SQL Database | |
| run: | | |
| docker compose exec -T mssql /opt/mssql-tools18/bin/sqlcmd \ | |
| -S localhost -U SA -P 'YourStrong!Passw0rd' \ | |
| -Q 'CREATE DATABASE nette_test' -N -C | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: ${{ env.php-extensions }} | |
| tools: ${{ env.php-tools }} | |
| coverage: none | |
| - name: Create databases.ini | |
| run: cp ./tests/databases.docker.ini ./tests/Database/databases.ini | |
| - run: composer install --no-progress --prefer-dist | |
| - run: composer tester | |
| - if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: output-${{ matrix.php }} | |
| path: tests/**/output | |
| lowest_dependencies: | |
| name: Lowest Dependencies | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 8.1 | |
| coverage: none | |
| - name: Create databases.ini | |
| run: cp ./tests/databases.sqlite.ini ./tests/Database/databases.ini | |
| - run: composer update --no-progress --prefer-dist --prefer-lowest --prefer-stable | |
| - run: composer tester |