|
| 1 | +--- |
| 2 | + |
| 3 | +name: 🧪 Tests |
| 4 | + |
| 5 | +on: # yamllint disable-line rule:truthy |
| 6 | + pull_request: |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - 1.x |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} |
| 13 | + cancel-in-progress: ${{ github.event_name == 'pull_request' }} |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: read |
| 17 | + |
| 18 | +env: |
| 19 | + COMPOSER_ROOT_VERSION: 1.x-dev |
| 20 | + # An unreachable database fails the run instead of skipping its tests. |
| 21 | + DB_REQUIRED: 1 |
| 22 | + |
| 23 | +jobs: |
| 24 | + unit: |
| 25 | + name: Unit · PHP ${{ matrix.php-version }} · ${{ matrix.dependencies }} |
| 26 | + timeout-minutes: 6 |
| 27 | + runs-on: ubuntu-latest |
| 28 | + strategy: |
| 29 | + fail-fast: false |
| 30 | + matrix: |
| 31 | + php-version: |
| 32 | + - '8.2' |
| 33 | + - '8.3' |
| 34 | + - '8.4' |
| 35 | + - '8.5' |
| 36 | + dependencies: |
| 37 | + - lowest |
| 38 | + - highest |
| 39 | + steps: |
| 40 | + - name: 📦 Check out the codebase |
| 41 | + uses: actions/checkout@v6 |
| 42 | + with: |
| 43 | + persist-credentials: false |
| 44 | + |
| 45 | + - name: 🛠️ Setup PHP |
| 46 | + uses: shivammathur/setup-php@v2 |
| 47 | + with: |
| 48 | + php-version: ${{ matrix.php-version }} |
| 49 | + extensions: pdo, pdo_sqlite |
| 50 | + ini-values: error_reporting=E_ALL |
| 51 | + coverage: none |
| 52 | + |
| 53 | + - name: 🤖 Validate composer.json |
| 54 | + run: composer validate --ansi --strict |
| 55 | + |
| 56 | + - name: 📥 Install dependencies with composer |
| 57 | + uses: ramsey/composer-install@v3 |
| 58 | + with: |
| 59 | + dependency-versions: ${{ matrix.dependencies }} |
| 60 | + |
| 61 | + - name: 🧪 Run unit tests |
| 62 | + run: composer test:unit |
| 63 | + |
| 64 | + database: |
| 65 | + name: ${{ matrix.driver }} · PHP ${{ matrix.php-version }} · ${{ matrix.dependencies }} |
| 66 | + timeout-minutes: 12 |
| 67 | + runs-on: ubuntu-latest |
| 68 | + strategy: |
| 69 | + fail-fast: false |
| 70 | + matrix: |
| 71 | + driver: |
| 72 | + - sqlite |
| 73 | + - mysql |
| 74 | + - postgres |
| 75 | + - sqlserver |
| 76 | + php-version: |
| 77 | + - '8.2' |
| 78 | + - '8.3' |
| 79 | + - '8.4' |
| 80 | + - '8.5' |
| 81 | + dependencies: |
| 82 | + - highest |
| 83 | + include: |
| 84 | + - {driver: sqlite, php-version: '8.2', dependencies: lowest} |
| 85 | + - {driver: mysql, php-version: '8.2', dependencies: lowest} |
| 86 | + - {driver: postgres, php-version: '8.2', dependencies: lowest} |
| 87 | + - {driver: sqlserver, php-version: '8.2', dependencies: lowest} |
| 88 | + steps: |
| 89 | + - name: 📦 Check out the codebase |
| 90 | + uses: actions/checkout@v6 |
| 91 | + with: |
| 92 | + persist-credentials: false |
| 93 | + |
| 94 | + - name: 🛢️ Start ${{ matrix.driver }} |
| 95 | + if: matrix.driver != 'sqlite' |
| 96 | + run: docker compose -f resources/docker/compose.yaml up -d --wait ${{ matrix.driver }} |
| 97 | + |
| 98 | + - name: 🛠️ Install the Microsoft ODBC driver |
| 99 | + if: matrix.driver == 'sqlserver' |
| 100 | + run: | |
| 101 | + curl -fsSL https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list |
| 102 | + sudo apt-get update |
| 103 | + sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18 |
| 104 | +
|
| 105 | + - name: 🛠️ Setup PHP |
| 106 | + uses: shivammathur/setup-php@v2 |
| 107 | + with: |
| 108 | + php-version: ${{ matrix.php-version }} |
| 109 | + extensions: pdo, pdo_sqlite, pdo_mysql, pdo_pgsql, pdo_sqlsrv |
| 110 | + ini-values: error_reporting=E_ALL |
| 111 | + coverage: none |
| 112 | + |
| 113 | + - name: 📥 Install dependencies with composer |
| 114 | + uses: ramsey/composer-install@v3 |
| 115 | + with: |
| 116 | + dependency-versions: ${{ matrix.dependencies }} |
| 117 | + |
| 118 | + - name: 🧪 Run Feature, Acceptance and Regression suites |
| 119 | + run: composer test:${{ matrix.driver }} |
| 120 | + |
| 121 | + coverage: |
| 122 | + name: Code coverage |
| 123 | + timeout-minutes: 6 |
| 124 | + runs-on: ubuntu-latest |
| 125 | + steps: |
| 126 | + - name: 📦 Check out the codebase |
| 127 | + uses: actions/checkout@v6 |
| 128 | + with: |
| 129 | + persist-credentials: false |
| 130 | + |
| 131 | + - name: 🛠️ Setup PHP |
| 132 | + uses: shivammathur/setup-php@v2 |
| 133 | + with: |
| 134 | + php-version: '8.4' |
| 135 | + extensions: pdo, pdo_sqlite |
| 136 | + ini-values: error_reporting=E_ALL |
| 137 | + coverage: xdebug |
| 138 | + |
| 139 | + - name: 📥 Install dependencies with composer |
| 140 | + uses: ramsey/composer-install@v3 |
| 141 | + with: |
| 142 | + dependency-versions: highest |
| 143 | + |
| 144 | + - name: 🧪 Collect code coverage (Unit and SQLite suites) |
| 145 | + run: composer test:cc |
| 146 | + |
| 147 | + - name: 📤 Upload code coverage report to Codecov |
| 148 | + uses: codecov/codecov-action@v5 |
| 149 | + continue-on-error: true |
| 150 | + with: |
| 151 | + files: runtime/clover.xml |
| 152 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 153 | + verbose: true |
0 commit comments