|
| 1 | +--- |
| 2 | + |
| 3 | +name: 🧪 Testing |
| 4 | + |
| 5 | +on: # yamllint disable-line rule:truthy |
| 6 | + pull_request: |
| 7 | + branches: |
| 8 | + - 1.x |
| 9 | + push: |
| 10 | + branches: |
| 11 | + - 1.x |
| 12 | + |
| 13 | +jobs: |
| 14 | + unit: |
| 15 | + name: 🧩 Unit |
| 16 | + timeout-minutes: 4 |
| 17 | + runs-on: ${{ matrix.os }} |
| 18 | + concurrency: |
| 19 | + cancel-in-progress: true |
| 20 | + group: unit-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ matrix.php-version }}-${{ matrix.dependencies }} |
| 21 | + strategy: |
| 22 | + fail-fast: false |
| 23 | + matrix: |
| 24 | + os: |
| 25 | + - ubuntu-latest |
| 26 | + php-version: |
| 27 | + - '8.4' |
| 28 | + - '8.5' |
| 29 | + dependencies: |
| 30 | + # - lowest |
| 31 | + # - locked |
| 32 | + - highest |
| 33 | + steps: |
| 34 | + - name: 📦 Check out the codebase |
| 35 | + uses: actions/checkout@v6 |
| 36 | + |
| 37 | + - name: 🛠️ Setup PHP |
| 38 | + uses: shivammathur/setup-php@v2 |
| 39 | + with: |
| 40 | + php-version: ${{ matrix.php-version }} |
| 41 | + ini-values: error_reporting=E_ALL |
| 42 | + |
| 43 | + - name: 🤖 Validate composer.json and composer.lock |
| 44 | + run: composer validate --ansi --strict |
| 45 | + |
| 46 | + - name: 📥 Install dependencies with composer |
| 47 | + uses: ramsey/composer-install@v3 |
| 48 | + env: |
| 49 | + COMPOSER_ROOT_VERSION: '1.x-dev' |
| 50 | + with: |
| 51 | + dependency-versions: ${{ matrix.dependencies }} |
| 52 | + |
| 53 | + - name: 🧪 Run unit tests |
| 54 | + run: composer test:unit |
| 55 | + |
| 56 | + acceptance: |
| 57 | + name: 🛢️ Acceptance (${{ matrix.driver }}) |
| 58 | + timeout-minutes: 8 |
| 59 | + runs-on: ubuntu-latest |
| 60 | + concurrency: |
| 61 | + cancel-in-progress: true |
| 62 | + group: acceptance-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ matrix.php-version }}-${{ matrix.driver }} |
| 63 | + strategy: |
| 64 | + fail-fast: false |
| 65 | + matrix: |
| 66 | + php-version: |
| 67 | + - '8.4' |
| 68 | + driver: |
| 69 | + - sqlite |
| 70 | + - mysql |
| 71 | + - postgres |
| 72 | + - sqlserver |
| 73 | + |
| 74 | + services: |
| 75 | + mysql: |
| 76 | + image: mysql:8.0 |
| 77 | + env: |
| 78 | + MYSQL_ROOT_PASSWORD: 'YourStrong!Passw0rd' |
| 79 | + MYSQL_DATABASE: spiral |
| 80 | + ports: |
| 81 | + - 13306:3306 |
| 82 | + options: >- |
| 83 | + --health-cmd="mysqladmin ping --silent" |
| 84 | + --health-interval=10s |
| 85 | + --health-timeout=5s |
| 86 | + --health-retries=10 |
| 87 | +
|
| 88 | + postgres: |
| 89 | + image: postgres:15 |
| 90 | + env: |
| 91 | + POSTGRES_PASSWORD: 'YourStrong!Passw0rd' |
| 92 | + POSTGRES_DB: spiral |
| 93 | + ports: |
| 94 | + - 15432:5432 |
| 95 | + options: >- |
| 96 | + --health-cmd="pg_isready" |
| 97 | + --health-interval=10s |
| 98 | + --health-timeout=5s |
| 99 | + --health-retries=10 |
| 100 | +
|
| 101 | + sqlserver: |
| 102 | + image: mcr.microsoft.com/mssql/server:2019-latest |
| 103 | + env: |
| 104 | + ACCEPT_EULA: 'Y' |
| 105 | + SA_PASSWORD: 'YourStrong!Passw0rd' |
| 106 | + ports: |
| 107 | + - 11433:1433 |
| 108 | + options: >- |
| 109 | + --health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'SELECT 1' -b" |
| 110 | + --health-interval=10s |
| 111 | + --health-timeout=5s |
| 112 | + --health-retries=15 |
| 113 | +
|
| 114 | + steps: |
| 115 | + - name: 📦 Check out the codebase |
| 116 | + uses: actions/checkout@v6 |
| 117 | + |
| 118 | + - name: 🛠️ Setup PHP |
| 119 | + uses: shivammathur/setup-php@v2 |
| 120 | + with: |
| 121 | + php-version: ${{ matrix.php-version }} |
| 122 | + extensions: pdo, pdo_sqlite, pdo_mysql, pdo_pgsql, sqlsrv, pdo_sqlsrv |
| 123 | + ini-values: error_reporting=E_ALL |
| 124 | + |
| 125 | + - name: 📥 Install dependencies with composer |
| 126 | + uses: ramsey/composer-install@v3 |
| 127 | + env: |
| 128 | + COMPOSER_ROOT_VERSION: '1.x-dev' |
| 129 | + with: |
| 130 | + dependency-versions: highest |
| 131 | + |
| 132 | + - name: 🧪 Run acceptance tests |
| 133 | + env: |
| 134 | + DB: ${{ matrix.driver }} |
| 135 | + MYSQL_HOST: 127.0.0.1 |
| 136 | + MYSQL_PORT: 13306 |
| 137 | + MYSQL_USER: root |
| 138 | + MYSQL_PASSWORD: 'YourStrong!Passw0rd' |
| 139 | + MYSQL_DATABASE: spiral |
| 140 | + POSTGRES_HOST: 127.0.0.1 |
| 141 | + POSTGRES_PORT: 15432 |
| 142 | + POSTGRES_USER: postgres |
| 143 | + POSTGRES_PASSWORD: 'YourStrong!Passw0rd' |
| 144 | + POSTGRES_DATABASE: spiral |
| 145 | + SQLSERVER_HOST: 127.0.0.1 |
| 146 | + SQLSERVER_PORT: 11433 |
| 147 | + SQLSERVER_USER: SA |
| 148 | + SQLSERVER_PASSWORD: 'YourStrong!Passw0rd' |
| 149 | + SQLSERVER_DATABASE: tempdb |
| 150 | + run: composer test:integration |
0 commit comments