|
| 1 | +name: CI Joomla Framework |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + schedule: |
| 7 | + - cron: 15 2 * * 1 |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + composer: |
| 15 | + name: Install PHP dependencies |
| 16 | + runs-on: ubuntu-latest |
| 17 | + container: joomlaprojects/docker-images:php8.1 |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + - uses: actions/cache@v4 |
| 21 | + id: cache-php |
| 22 | + with: |
| 23 | + path: vendor |
| 24 | + key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }} |
| 25 | + - name: Install PHP dependencies |
| 26 | + if: steps.cache-php.outputs.cache-hit != 'true' |
| 27 | + run: | |
| 28 | + git config --global --add safe.directory $GITHUB_WORKSPACE |
| 29 | + composer config --global home |
| 30 | + composer install --no-progress --ignore-platform-reqs |
| 31 | +
|
| 32 | + code-style-php: |
| 33 | + name: Check PHP code style |
| 34 | + runs-on: ubuntu-latest |
| 35 | + container: joomlaprojects/docker-images:php8.1 |
| 36 | + needs: [composer] |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v4 |
| 39 | + - uses: actions/cache/restore@v4 |
| 40 | + with: |
| 41 | + path: vendor |
| 42 | + key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }} |
| 43 | + - name: Check PHP code style |
| 44 | + env: |
| 45 | + PHP_CS_FIXER_IGNORE_ENV: true |
| 46 | + run: ./vendor/bin/phpcs --standard=ruleset.xml src/ |
| 47 | + |
| 48 | + phpstan: |
| 49 | + name: Run PHPstan |
| 50 | + runs-on: ubuntu-latest |
| 51 | + container: joomlaprojects/docker-images:php8.4 |
| 52 | + needs: [code-style-php] |
| 53 | + continue-on-error: true |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@v4 |
| 56 | + - uses: actions/cache/restore@v4 |
| 57 | + with: |
| 58 | + path: vendor |
| 59 | + key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }} |
| 60 | + - name: Run PHPstan |
| 61 | + run: | |
| 62 | + ./vendor/bin/phpstan --error-format=github |
| 63 | +
|
| 64 | + tests-unit-sqlite: |
| 65 | + name: Run Unit tests on SQLite |
| 66 | + runs-on: ubuntu-latest |
| 67 | + container: joomlaprojects/docker-images:php${{ matrix.php_version }} |
| 68 | + needs: [code-style-php] |
| 69 | + strategy: |
| 70 | + matrix: |
| 71 | + php_version: ['8.1', '8.2', '8.3'] |
| 72 | + steps: |
| 73 | + - uses: actions/checkout@v4 |
| 74 | + - name: Run Unit tests |
| 75 | + run: | |
| 76 | + git config --global --add safe.directory $GITHUB_WORKSPACE |
| 77 | + composer update |
| 78 | + ./vendor/bin/phpunit --configuration phpunit.sqlite.xml.dist |
| 79 | +
|
| 80 | + tests-unit-mysql: |
| 81 | + name: Run Unit tests on MySQL |
| 82 | + runs-on: ubuntu-latest |
| 83 | + container: joomlaprojects/docker-images:php${{ matrix.php_version }} |
| 84 | + needs: [code-style-php] |
| 85 | + strategy: |
| 86 | + matrix: |
| 87 | + php_version: ['8.1', '8.2', '8.3'] |
| 88 | + db_engine: ['mysql', 'mysqli'] |
| 89 | + db_version: ['5.7', '8.0'] |
| 90 | + steps: |
| 91 | + - uses: actions/checkout@v4 |
| 92 | + - name: Run Unit tests |
| 93 | + run: | |
| 94 | + git config --global --add safe.directory $GITHUB_WORKSPACE |
| 95 | + composer update |
| 96 | + ./vendor/bin/phpunit --configuration phpunit.${{ matrix.db_engine }}.xml.dist |
| 97 | + services: |
| 98 | + mysql: |
| 99 | + image: mysql:${{ matrix.db_version }} |
| 100 | + env: |
| 101 | + MYSQL_USER: joomla_ut |
| 102 | + MYSQL_PASSWORD: joomla_ut |
| 103 | + MYSQL_ROOT_PASSWORD: joomla_ut |
| 104 | + MYSQL_DATABASE: joomla_ut |
| 105 | + |
| 106 | + tests-unit-mariadb: |
| 107 | + name: Run Unit tests on MariaDB |
| 108 | + runs-on: ubuntu-latest |
| 109 | + container: joomlaprojects/docker-images:php${{ matrix.php_version }} |
| 110 | + needs: [code-style-php] |
| 111 | + strategy: |
| 112 | + matrix: |
| 113 | + php_version: ['8.1', '8.2', '8.3'] |
| 114 | + steps: |
| 115 | + - uses: actions/checkout@v4 |
| 116 | + - name: Run Unit tests |
| 117 | + run: | |
| 118 | + git config --global --add safe.directory $GITHUB_WORKSPACE |
| 119 | + composer update |
| 120 | + ./vendor/bin/phpunit --configuration phpunit.mariadb.xml.dist |
| 121 | + services: |
| 122 | + mariadb: |
| 123 | + image: mariadb:10.2 |
| 124 | + env: |
| 125 | + MARIADB_USER: joomla_ut |
| 126 | + MARIADB_PASSWORD: joomla_ut |
| 127 | + MARIADB_ROOT_PASSWORD: joomla_ut |
| 128 | + MARIADB_DATABASE: joomla_ut |
| 129 | + |
| 130 | + tests-unit-postgres: |
| 131 | + name: Run Unit tests on PostgreSQL |
| 132 | + runs-on: ubuntu-latest |
| 133 | + container: joomlaprojects/docker-images:php${{ matrix.php_version }} |
| 134 | + needs: [code-style-php] |
| 135 | + strategy: |
| 136 | + matrix: |
| 137 | + php_version: ['8.1', '8.2', '8.3'] |
| 138 | + db_version: ['10', '11'] |
| 139 | + steps: |
| 140 | + - uses: actions/checkout@v4 |
| 141 | + - name: Run Unit tests |
| 142 | + run: | |
| 143 | + git config --global --add safe.directory $GITHUB_WORKSPACE |
| 144 | + composer update |
| 145 | + ./vendor/bin/phpunit --configuration phpunit.pgsql.xml.dist |
| 146 | + services: |
| 147 | + postgres: |
| 148 | + image: postgres:${{ matrix.db_version }}-alpine |
| 149 | + env: |
| 150 | + POSTGRES_USER: root |
| 151 | + POSTGRES_PASSWORD: joomla_ut |
| 152 | + POSTGRES_DB: test_joomla |
| 153 | + |
| 154 | + tests-unit-sqlsrv: |
| 155 | + name: Run Unit tests on SQLsrv |
| 156 | + runs-on: ubuntu-latest |
| 157 | + container: joomlaprojects/docker-images:php${{ matrix.php_version }} |
| 158 | + needs: [code-style-php] |
| 159 | + strategy: |
| 160 | + matrix: |
| 161 | + php_version: ['8.1', '8.2', '8.3'] |
| 162 | + steps: |
| 163 | + - uses: actions/checkout@v4 |
| 164 | + - name: Run Unit tests |
| 165 | + run: | |
| 166 | + git config --global --add safe.directory $GITHUB_WORKSPACE |
| 167 | + apt-get update |
| 168 | + apt-get install -y software-properties-common lsb-release gnupg |
| 169 | + curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - |
| 170 | + echo "deb [arch=amd64,armhf,arm64] https://packages.microsoft.com/ubuntu/22.04/prod jammy main" >> /etc/apt/sources.list |
| 171 | + apt-get update |
| 172 | + ACCEPT_EULA=Y apt-get install -y msodbcsql18 unixodbc-dev |
| 173 | + pecl install sqlsrv && docker-php-ext-enable sqlsrv |
| 174 | + pecl install pdo_sqlsrv && docker-php-ext-enable pdo_sqlsrv |
| 175 | + php --ri sqlsrv |
| 176 | + php --ri pdo_sqlsrv |
| 177 | + composer update |
| 178 | + ./vendor/bin/phpunit --configuration phpunit.sqlsrv.xml.dist |
| 179 | + services: |
| 180 | + sqlsrv: |
| 181 | + image: mcr.microsoft.com/mssql/server:2017-latest |
| 182 | + env: |
| 183 | + SA_PASSWORD: Password12! |
| 184 | + ACCEPT_EULA: Y |
| 185 | + MSSQL_PID: Developer |
| 186 | + |
| 187 | + tests-unit-windows: |
| 188 | + name: Run Unit tests on MSSQL (Windows) |
| 189 | + runs-on: windows-latest |
| 190 | + needs: [code-style-php] |
| 191 | + strategy: |
| 192 | + matrix: |
| 193 | + php_version: ['8.1', '8.2', '8.3'] |
| 194 | + steps: |
| 195 | + - uses: actions/checkout@v4 |
| 196 | + - name: Setup PHP |
| 197 | + uses: shivammathur/setup-php@v2 |
| 198 | + with: |
| 199 | + php-version: ${{ matrix.php_version }} |
| 200 | + extensions: openssl, mbstring, fileinfo, ftp, sqlsrv |
| 201 | + - name: Install MSSQL |
| 202 | + uses: potatoqualitee/mssqlsuite@v1.8 |
| 203 | + with: |
| 204 | + install: sqlengine, sqlclient |
| 205 | + version: 2019 |
| 206 | + sa-password: 'Password12!' |
| 207 | + show-log: true |
| 208 | + - name: Install Composer dependencies |
| 209 | + run: | |
| 210 | + git config --global --add safe.directory $GITHUB_WORKSPACE |
| 211 | + composer install --no-progress --ignore-platform-reqs |
| 212 | + - name: Run Unit tests |
| 213 | + run: php vendor/bin/phpunit -c phpunit.appveyor_sql2019.xml.dist |
0 commit comments