changed ci config for mysql, postgres and mssql #132
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: CI | |
| on: | |
| push: | |
| branches: [ feature-*, develop, dev-*, master ] | |
| tags: | |
| - '*' | |
| pull_request: | |
| branches: [ feature-*, develop, dev-*, master ] | |
| jobs: | |
| test-mysql: | |
| name: Laravel ${{ matrix.laravel }} / PHP ${{ matrix.php }} / MySQL ${{ matrix.mysql }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| strategy: | |
| matrix: | |
| laravel: [10, 11, 12] | |
| php: [8.2, 8.3, 8.4] | |
| mysql: [5.7, 8.0] | |
| exclude: | |
| - laravel: 10 | |
| php: 8.4 | |
| mysql: 5.7 | |
| - laravel: 10 | |
| php: 8.4 | |
| mysql: 8.0 | |
| services: | |
| mysql: | |
| image: mysql:${{ matrix.mysql }} | |
| ports: | |
| - 3306:3306 | |
| env: | |
| MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' | |
| MYSQL_DATABASE: testing | |
| options: >- | |
| --health-cmd="mysqladmin ping --silent" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=3 | |
| env: | |
| DB_HOST: 127.0.0.1 | |
| DB_PORT: 3306 | |
| DB_USERNAME: root | |
| DB_PASSWORD: '' | |
| DB_DATABASE: testing | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: mbstring, pdo_mysql, zip, exif, intl, gd, bcmath, curl, dom, xdebug | |
| coverage: xdebug | |
| - name: Debug info | |
| run: | | |
| php -v | |
| composer --version | |
| mysql --version || true | |
| - name: Wait for MySQL | |
| run: | | |
| for i in {30..0}; do | |
| if mysqladmin ping -h 127.0.0.1 --silent; then | |
| echo "MySQL is ready" | |
| break | |
| fi | |
| echo "Waiting for MySQL ($i)..." | |
| sleep 1 | |
| done | |
| - name: Adjust Laravel/Testbench version per matrix | |
| run: | | |
| composer remove laravel/framework orchestra/testbench --no-update || true | |
| composer require laravel/framework:^${{ matrix.laravel }} --no-update | |
| if [[ "${{ matrix.laravel }}" == "10" ]]; then | |
| composer require orchestra/testbench:^8.0 --dev --no-update | |
| elif [[ "${{ matrix.laravel }}" == "11" ]]; then | |
| composer require orchestra/testbench:^9.0 --dev --no-update | |
| elif [[ "${{ matrix.laravel }}" == "12" ]]; then | |
| composer require orchestra/testbench:^10.0 --dev --no-update | |
| fi | |
| composer update --no-interaction --prefer-dist --no-progress | |
| - name: Ensure coverage directory exists | |
| run: mkdir -p coverage | |
| - name: Run Tests | |
| run: vendor/bin/phpunit --coverage-clover=coverage/clover.xml --path-coverage | |
| - uses: qltysh/qlty-action/coverage@v1 | |
| with: | |
| token: ${{ secrets.QLTY_COVERAGE_TOKEN }} | |
| files: coverage/clover.xml | |
| test-pgsql: | |
| name: Laravel ${{ matrix.laravel }} / PHP ${{ matrix.php }} / PostgreSQL 15 | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| strategy: | |
| matrix: | |
| laravel: [10, 11, 12] | |
| php: [8.2, 8.3, 8.4] | |
| exclude: | |
| - laravel: 10 | |
| php: 8.4 | |
| services: | |
| postgres: | |
| image: postgres:15 | |
| ports: | |
| - 5432:5432 | |
| env: | |
| POSTGRES_DB: testing | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: '' | |
| POSTGRES_HOST_AUTH_METHOD: trust | |
| options: >- | |
| --health-cmd="pg_isready -U postgres" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=3 | |
| env: | |
| POSTGRES_DB: testing | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: '' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: mbstring, pdo_pgsql, zip, exif, intl, gd, bcmath, curl, dom, xdebug | |
| coverage: xdebug | |
| - name: Debug info | |
| run: | | |
| php -v | |
| composer --version | |
| psql --version || true | |
| - name: Wait for Postgres | |
| run: | | |
| for i in {30..0}; do | |
| if pg_isready -h 127.0.0.1 -U postgres; then | |
| echo "Postgres is ready" | |
| break | |
| fi | |
| echo "Waiting for Postgres ($i)..." | |
| sleep 1 | |
| done | |
| - name: Adjust Laravel/Testbench version per matrix | |
| run: | | |
| composer remove laravel/framework orchestra/testbench --no-update || true | |
| composer require laravel/framework:^${{ matrix.laravel }} --no-update | |
| if [[ "${{ matrix.laravel }}" == "10" ]]; then | |
| composer require orchestra/testbench:^8.0 --dev --no-update | |
| elif [[ "${{ matrix.laravel }}" == "11" ]]; then | |
| composer require orchestra/testbench:^9.0 --dev --no-update | |
| elif [[ "${{ matrix.laravel }}" == "12" ]]; then | |
| composer require orchestra/testbench:^10.0 --dev --no-update | |
| fi | |
| composer update --no-interaction --prefer-dist --no-progress | |
| - name: Ensure coverage directory exists | |
| run: mkdir -p coverage | |
| - name: Run Tests | |
| run: vendor/bin/phpunit --coverage-clover=coverage/clover.xml --path-coverage | |
| - uses: qltysh/qlty-action/coverage@v1 | |
| with: | |
| token: ${{ secrets.QLTY_COVERAGE_TOKEN }} | |
| files: coverage/clover.xml | |
| test-sqlsrv: | |
| name: Laravel ${{ matrix.laravel }} / PHP ${{ matrix.php }} / MSSQL 2022-latest | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| strategy: | |
| matrix: | |
| laravel: [10, 11, 12] | |
| php: [8.2, 8.3, 8.4] | |
| exclude: | |
| - laravel: 10 | |
| - laravel: 11 | |
| services: | |
| mssql: | |
| image: mcr.microsoft.com/mssql/server:2022-latest | |
| ports: | |
| - 1433:1433 | |
| env: | |
| ACCEPT_EULA: Y | |
| SA_PASSWORD: Passw0rd1234! | |
| MSSQL_PID: Express | |
| options: >- | |
| --health-cmd="exit 0" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=3 | |
| env: | |
| DB_HOST: 127.0.0.1 | |
| DB_PORT: 1433 | |
| DB_USERNAME: SA | |
| DB_PASSWORD: Passw0rd1234! | |
| DB_DATABASE: testing | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: mbstring, pdo_sqlsrv, zip, exif, intl, gd, bcmath, curl, dom, xdebug | |
| coverage: xdebug | |
| - name: Debug info | |
| run: | | |
| php -v | |
| composer --version | |
| /opt/mssql-tools/bin/sqlcmd -? || true | |
| - name: Wait for MSSQL | |
| run: | | |
| echo "Waiting 30 seconds for MSSQL to start..." | |
| sleep 30 | |
| - name: Adjust Laravel/Testbench version per matrix | |
| run: | | |
| composer remove laravel/framework orchestra/testbench --no-update || true | |
| composer require laravel/framework:^${{ matrix.laravel }} --no-update | |
| if [[ "${{ matrix.laravel }}" == "10" ]]; then | |
| composer require orchestra/testbench:^8.0 --dev --no-update | |
| elif [[ "${{ matrix.laravel }}" == "11" ]]; then | |
| composer require orchestra/testbench:^9.0 --dev --no-update | |
| elif [[ "${{ matrix.laravel }}" == "12" ]]; then | |
| composer require orchestra/testbench:^10.0 --dev --no-update | |
| fi | |
| composer update --no-interaction --prefer-dist --no-progress | |
| - name: Ensure coverage directory exists | |
| run: mkdir -p coverage | |
| - name: Run Tests | |
| run: vendor/bin/phpunit --coverage-clover=coverage/clover.xml --path-coverage | |
| - uses: qltysh/qlty-action/coverage@v1 | |
| with: | |
| token: ${{ secrets.QLTY_COVERAGE_TOKEN }} | |
| files: coverage/clover.xml |