|
| 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-lowest: |
| 65 | + name: Run Unit tests |
| 66 | + runs-on: ubuntu-latest |
| 67 | + container: joomlaprojects/docker-images:php8.1 |
| 68 | + needs: [code-style-php] |
| 69 | + steps: |
| 70 | + - uses: actions/checkout@v4 |
| 71 | + - name: Run Unit tests |
| 72 | + run: | |
| 73 | + git config --global --add safe.directory $GITHUB_WORKSPACE |
| 74 | + composer update --prefer-stable --prefer-lowest |
| 75 | + ./vendor/bin/phpunit |
| 76 | +
|
| 77 | + tests-unit: |
| 78 | + name: Run Unit tests |
| 79 | + runs-on: ubuntu-latest |
| 80 | + container: joomlaprojects/docker-images:php${{ matrix.php_version }} |
| 81 | + needs: [code-style-php] |
| 82 | + strategy: |
| 83 | + matrix: |
| 84 | + php_version: ['8.1', '8.2', '8.3'] |
| 85 | + steps: |
| 86 | + - uses: actions/checkout@v4 |
| 87 | + - name: Run Unit tests |
| 88 | + run: | |
| 89 | + git config --global --add safe.directory $GITHUB_WORKSPACE |
| 90 | + composer update |
| 91 | + ./vendor/bin/phpunit |
| 92 | +
|
| 93 | + tests-unit-windows: |
| 94 | + name: Run Unit tests (Windows) |
| 95 | + runs-on: windows-latest |
| 96 | + needs: [code-style-php] |
| 97 | + strategy: |
| 98 | + matrix: |
| 99 | + php_version: ['8.1', '8.2', '8.3'] |
| 100 | + steps: |
| 101 | + - uses: actions/checkout@v4 |
| 102 | + - name: Setup PHP |
| 103 | + uses: shivammathur/setup-php@v2 |
| 104 | + with: |
| 105 | + php-version: ${{ matrix.php_version }} |
| 106 | + extensions: openssl, mbstring, fileinfo, ftp |
| 107 | + - name: Install Composer dependencies |
| 108 | + run: | |
| 109 | + git config --global --add safe.directory $GITHUB_WORKSPACE |
| 110 | + composer install --no-progress --ignore-platform-reqs |
| 111 | + - name: Run Unit tests |
| 112 | + run: php vendor/bin/phpunit |
0 commit comments