CI Joomla Framework #179
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 Joomla Framework | |
| on: | |
| push: | |
| pull_request: | |
| schedule: | |
| - cron: 15 2 * * 1 | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| composer: | |
| name: Install PHP dependencies | |
| runs-on: ubuntu-latest | |
| container: joomlaprojects/docker-images:php8.3 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/cache@v5 | |
| id: cache-php | |
| with: | |
| path: vendor | |
| key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }} | |
| - name: Install PHP dependencies | |
| if: steps.cache-php.outputs.cache-hit != 'true' | |
| run: | | |
| git config --global --add safe.directory $GITHUB_WORKSPACE | |
| composer config --global home | |
| composer install --no-progress --ignore-platform-reqs | |
| code-style-php: | |
| name: Check PHP code style | |
| runs-on: ubuntu-latest | |
| container: joomlaprojects/docker-images:php8.3 | |
| needs: [composer] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/cache/restore@v5 | |
| with: | |
| path: vendor | |
| key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }} | |
| - name: Check PHP code style | |
| env: | |
| PHP_CS_FIXER_IGNORE_ENV: true | |
| run: ./vendor/bin/phpcs --standard=ruleset.xml src/ | |
| phpstan: | |
| name: Run PHPstan | |
| runs-on: ubuntu-latest | |
| container: joomlaprojects/docker-images:php8.4 | |
| needs: [code-style-php] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/cache/restore@v5 | |
| with: | |
| path: vendor | |
| key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }} | |
| - name: Run PHPstan | |
| run: | | |
| ./vendor/bin/phpstan --error-format=github | |
| tests-unit: | |
| name: Run Unit tests | |
| runs-on: ubuntu-latest | |
| container: joomlaprojects/docker-images:php${{ matrix.php_version }} | |
| needs: [code-style-php] | |
| strategy: | |
| matrix: | |
| php_version: ['8.3', '8.4', '8.5'] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Run Unit tests | |
| run: | | |
| git config --global --add safe.directory $GITHUB_WORKSPACE | |
| composer update | |
| ./vendor/bin/phpunit | |
| tests-unit-sqlite: | |
| name: Run Unit tests on SQLite | |
| runs-on: ubuntu-latest | |
| container: joomlaprojects/docker-images:php${{ matrix.php_version }} | |
| needs: [code-style-php] | |
| strategy: | |
| matrix: | |
| php_version: ['8.3', '8.4', '8.5'] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Run Unit tests | |
| run: | | |
| git config --global --add safe.directory $GITHUB_WORKSPACE | |
| composer update | |
| ./vendor/bin/phpunit --configuration phpunit.sqlite.xml.dist | |
| tests-unit-mysql: | |
| name: Run Unit tests on MySQL | |
| runs-on: ubuntu-latest | |
| container: joomlaprojects/docker-images:php${{ matrix.php_version }} | |
| needs: [code-style-php] | |
| strategy: | |
| matrix: | |
| php_version: ['8.3', '8.4', '8.5'] | |
| db_engine: ['mysql', 'mysqli'] | |
| db_version: ['5.7', '8.0', '9'] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Run Unit tests | |
| run: | | |
| git config --global --add safe.directory $GITHUB_WORKSPACE | |
| composer update | |
| ./vendor/bin/phpunit --configuration phpunit.${{ matrix.db_engine }}.xml.dist | |
| services: | |
| mysql: | |
| image: mysql:${{ matrix.db_version }} | |
| env: | |
| MYSQL_USER: joomla_ut | |
| MYSQL_PASSWORD: joomla_ut | |
| MYSQL_ROOT_PASSWORD: joomla_ut | |
| MYSQL_DATABASE: joomla_ut | |
| options: >- | |
| --health-cmd="mysqladmin ping -h localhost -u joomla_ut -pjoomla_ut" | |
| tests-unit-mariadb: | |
| name: Run Unit tests on MariaDB | |
| runs-on: ubuntu-latest | |
| container: joomlaprojects/docker-images:php${{ matrix.php_version }} | |
| needs: [code-style-php] | |
| strategy: | |
| matrix: | |
| php_version: ['8.3', '8.4', '8.5'] | |
| db_version: ['10.4', '10.6', '10.11', '11.4', '11.8', '12.3'] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Run Unit tests | |
| run: | | |
| git config --global --add safe.directory $GITHUB_WORKSPACE | |
| composer update | |
| ./vendor/bin/phpunit --configuration phpunit.mariadb.xml.dist | |
| services: | |
| mariadb: | |
| image: mariadb:${{ matrix.db_version }} | |
| env: | |
| MARIADB_USER: joomla_ut | |
| MARIADB_PASSWORD: joomla_ut | |
| MARIADB_ROOT_PASSWORD: joomla_ut | |
| MARIADB_DATABASE: joomla_ut | |
| options: >- | |
| --health-cmd="healthcheck.sh --connect --innodb_initialized" | |
| tests-unit-postgres: | |
| name: Run Unit tests on PostgreSQL | |
| runs-on: ubuntu-latest | |
| container: joomlaprojects/docker-images:php${{ matrix.php_version }} | |
| needs: [code-style-php] | |
| strategy: | |
| matrix: | |
| php_version: ['8.3', '8.4', '8.5'] | |
| db_version: ['10', '12', '18'] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Run Unit tests | |
| run: | | |
| git config --global --add safe.directory $GITHUB_WORKSPACE | |
| composer update | |
| ./vendor/bin/phpunit --configuration phpunit.pgsql.xml.dist | |
| services: | |
| postgres: | |
| image: postgres:${{ matrix.db_version }}-alpine | |
| env: | |
| POSTGRES_USER: joomla_ut | |
| POSTGRES_PASSWORD: joomla_ut | |
| POSTGRES_DB: joomla_ut | |
| options: >- | |
| --health-cmd="pg_isready -d joomla_ut" | |
| tests-unit-sqlsrv: | |
| name: Run Unit tests on SQLsrv | |
| runs-on: ubuntu-latest | |
| container: joomlaprojects/docker-images:php${{ matrix.php_version }} | |
| needs: [code-style-php] | |
| strategy: | |
| matrix: | |
| php_version: ['8.3', '8.4', '8.5'] | |
| db_version: ['2017', '2025'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Prepare SQLSRV environment | |
| run: | | |
| curl -sSL -O https://packages.microsoft.com/config/debian/$(grep VERSION_ID /etc/os-release | cut -d '"' -f 2 | cut -d '.' -f 1)/packages-microsoft-prod.deb | |
| dpkg -i packages-microsoft-prod.deb | |
| rm packages-microsoft-prod.deb | |
| apt-get update | |
| ACCEPT_EULA=Y apt-get install -y msodbcsql18 unixodbc-dev | |
| pecl install sqlsrv && docker-php-ext-enable sqlsrv | |
| php --ri sqlsrv | |
| - name: Run Unit tests | |
| run: | | |
| git config --global --add safe.directory $GITHUB_WORKSPACE | |
| composer update | |
| ./vendor/bin/phpunit --configuration phpunit.sqlsrv.xml.dist | |
| services: | |
| sqlsrv: | |
| image: mcr.microsoft.com/mssql/server:${{ matrix.db_version }}-latest | |
| env: | |
| ACCEPT_EULA: Y | |
| MSSQL_SA_PASSWORD: Password12! | |
| MSSQL_PID: Developer | |
| options: >- | |
| --health-cmd="bash -c 'SQLCMD=$(command -v /opt/mssql-tools/bin/sqlcmd || command -v /opt/mssql-tools18/bin/sqlcmd); [ -z \"$SQLCMD\" ] && exit 1; $SQLCMD -S localhost -U sa -P Password12! -C -Q SELECT\ 1'" | |
| tests-unit-windows: | |
| name: Run Unit tests on MSSQL (Windows) | |
| runs-on: windows-latest | |
| needs: [code-style-php] | |
| strategy: | |
| matrix: | |
| php_version: ['8.3', '8.4', '8.5'] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2.37.2 | |
| with: | |
| php-version: ${{ matrix.php_version }} | |
| extensions: openssl, mbstring, fileinfo, ftp, sqlsrv | |
| - name: Install MSSQL | |
| uses: potatoqualitee/mssqlsuite@2291d923e83859edd871679c05b379037376761f # v1.12 | |
| with: | |
| install: sqlengine, sqlclient | |
| version: 2019 | |
| sa-password: 'Password12!' | |
| show-log: true | |
| - name: Install Composer dependencies | |
| run: | | |
| git config --global --add safe.directory ${env:GITHUB_WORKSPACE} | |
| composer update | |
| - name: Run Unit tests | |
| run: php vendor/bin/phpunit -c phpunit.windows.xml.dist |