|
| 1 | +name: build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - 'main' |
| 7 | + pull_request: ~ |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + name: "Test (PHP ${{ matrix.php-versions }}, Neos ${{ matrix.neos-versions }})" |
| 12 | + |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + php-versions: ['8.1'] |
| 17 | + neos-versions: ['7.3', '8.3'] |
| 18 | + include: |
| 19 | + - php-versions: '8.2' |
| 20 | + neos-versions: '8.3' |
| 21 | + - php-versions: '8.3' |
| 22 | + neos-versions: '8.3' |
| 23 | + runs-on: ubuntu-latest |
| 24 | + |
| 25 | + env: |
| 26 | + FLOW_CONTEXT: Testing |
| 27 | + NEOS_FOLDER: neos/ |
| 28 | + DIST_FOLDER: DistributionPackages/CodeQ.AssetHelpers |
| 29 | + |
| 30 | + steps: |
| 31 | + - name: Setup PHP |
| 32 | + uses: shivammathur/setup-php@v2 |
| 33 | + with: |
| 34 | + php-version: ${{ matrix.php-versions }} |
| 35 | + extensions: mbstring, xml, json, zlib, iconv, intl, pdo_sqlite, mysql, pgsql, redis, memcached, memcache, apcu |
| 36 | + ini-values: date.timezone="Africa/Tunis", opcache.fast_shutdown=0, apc.enable_cli=on |
| 37 | + |
| 38 | + - name: Install Neos Project and other dependencies |
| 39 | + run: | |
| 40 | + composer create --no-scripts --no-install neos/neos-base-distribution "${{ env.NEOS_FOLDER }}" "^${{ matrix.neos-versions }}" |
| 41 | + cd "${{ env.NEOS_FOLDER }}" |
| 42 | + composer require phpstan/phpstan "^1.10.0" --no-install --dev |
| 43 | + composer require squizlabs/php_codesniffer "^3.7" --no-install --dev |
| 44 | + composer config --no-plugins allow-plugins.neos/composer-plugin true |
| 45 | +
|
| 46 | + - name: Checkout |
| 47 | + uses: actions/checkout@v2 |
| 48 | + with: |
| 49 | + path: ${{ env.NEOS_FOLDER }}${{ env.DIST_FOLDER }} |
| 50 | + |
| 51 | + - name: Finish composer setup |
| 52 | + run: | |
| 53 | + cd "${{ env.NEOS_FOLDER }}" |
| 54 | + composer config repositories.assethelpers '{ "type": "path", "url": "./${{ env.DIST_FOLDER }}", "options": { "symlink": false } }' |
| 55 | + composer require codeq/assethelpers "@dev" --no-install |
| 56 | +
|
| 57 | + - name: Cache Composer packages |
| 58 | + id: composer-cache |
| 59 | + uses: actions/cache@v4 |
| 60 | + with: |
| 61 | + path: | |
| 62 | + ~/.cache/composer |
| 63 | + ~/${{ env.NEOS_FOLDER }}Packages |
| 64 | + key: php-${{ matrix.php-versions }}-${{ matrix.dependencies }}${{ hashFiles('**/composer.json') }} |
| 65 | + restore-keys: php-${{ matrix.php-versions }}-${{ matrix.dependencies }} |
| 66 | + |
| 67 | + - name: Install dependencies |
| 68 | + run: | |
| 69 | + cd ${{ env.NEOS_FOLDER }} |
| 70 | + composer ${{ matrix.dependencies == 'locked' && 'install' || 'update' }} --no-progress --no-interaction ${{ matrix.dependencies == 'lowest' && '--prefer-lowest' || '' }} ${{ matrix.composer-arguments }} |
| 71 | +
|
| 72 | + - name: Set Flow Context |
| 73 | + run: echo "FLOW_CONTEXT=${{ env.FLOW_CONTEXT }}" >> $GITHUB_ENV |
| 74 | + |
| 75 | + - name: Run style tests |
| 76 | + run: | |
| 77 | + cd "${{ env.NEOS_FOLDER }}" |
| 78 | + bin/phpcs --colors -n --standard=PSR12 ${{ env.DIST_FOLDER }}/Classes |
| 79 | +
|
| 80 | + - name: Run stan tests |
| 81 | + run: | |
| 82 | + cd "${{ env.NEOS_FOLDER }}" |
| 83 | + bin/phpstan analyse ${{ env.DIST_FOLDER }}/Classes |
0 commit comments