Skip to content

Commit

Permalink
update php and pimcore, fix deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
alexz707 committed Jan 21, 2025
1 parent 917681d commit a63f6da
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 45 deletions.
4 changes: 0 additions & 4 deletions .github/ci/scripts/setup-pimcore-environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,3 @@
set -eu -o xtrace

cp .github/ci/files/.env .

if [ ${REQUIRE_ADMIN_BUNDLE} = true ]; then
composer require -n --no-update pimcore/admin-ui-classic-bundle
fi
116 changes: 79 additions & 37 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,95 @@
name: "Static Analysis"
name: "Static analysis centralised"

on:
pull_request:
branches:
- "[0-9]+.[0-9]+"
- "[0-9]+.x"
schedule:
- cron: '0 3 * * 1,3,5'
workflow_dispatch:
push:
branches:
- "[0-9]+.[0-9]+"
- "[0-9]+.x"
- "feature-*"
pull_request:
types: [ opened, synchronize, reopened ]


env:
PIMCORE_PROJECT_ROOT: ${{ github.workspace }}
PRIVATE_REPO: ${{ github.event.repository.private }}

jobs:
static-analysis-phpstan:
name: "Static Analysis with PHPStan"
runs-on: "ubuntu-20.04"
strategy:
matrix:
include:
- { php-version: "8.1", dependencies: "lowest", require_admin_bundle: false }
- { php-version: "8.2", dependencies: "highest", require_admin_bundle: true }
- { php-version: "8.3", dependencies: "highest", pimcore_version: "11.x-dev", require_admin_bundle: true }
setup-matrix:
runs-on: ubuntu-latest
outputs:
php_versions: ${{ steps.parse-php-versions.outputs.php_versions }}
matrix: ${{ steps.set-matrix.outputs.matrix }}
private_repo: ${{ env.PRIVATE_REPO }}
steps:
- name: "Checkout code"
uses: "actions/checkout@v2"
- name: Checkout code
uses: actions/checkout@v4

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
- name: Checkout reusable workflow repo
uses: actions/checkout@v4
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"

- name: "Setup Pimcore environment"
env:
REQUIRE_ADMIN_BUNDLE: "${{ matrix.require_admin_bundle }}"
run: |
.github/ci/scripts/setup-pimcore-environment.sh
repository: pimcore/workflows-collection-public
ref: main
path: reusable-workflows

- name: "Update Pimcore version"
env:
PIMCORE_VERSION: "${{ matrix.pimcore_version }}"
- name: Parse PHP versions from composer.json
id: parse-php-versions
run: |
if [ ! -z "$PIMCORE_VERSION" ]; then
composer require --no-update pimcore/pimcore:"${PIMCORE_VERSION}"
if [ -f composer.json ]; then
php_versions=$(jq -r '.require.php' composer.json | grep -oP '\d+\.\d+' | tr '\n' ',' | sed 's/,$//')
if [ -z "$php_versions" ]; then
echo "No PHP versions found in composer.json"
echo "Setting default PHP value"
echo "php_versions=default" >> $GITHUB_OUTPUT
else
echo "php_versions=$php_versions" >> $GITHUB_OUTPUT
echo "#### php versions #### : $php_versions"
fi
else
echo "composer.json not found"
exit 1
fi
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
dependency-versions: "${{ matrix.dependencies }}"
- name: Set up matrix
id: set-matrix
run: |
php_versions="${{ steps.parse-php-versions.outputs.php_versions }}"
MATRIX_JSON=$(cat reusable-workflows/phpstan-configuration/matrix-config.json)
IFS=',' read -ra VERSIONS_ARRAY <<< "$php_versions"
FILTERED_MATRIX_JSON=$(echo $MATRIX_JSON | jq --arg php_versions "$php_versions" '
{
matrix: [
.configs[] |
select(.php_version == $php_versions) |
.matrix[]
]
}')
ENCODED_MATRIX_JSON=$(echo $FILTERED_MATRIX_JSON | jq -c .)
echo "matrix=${ENCODED_MATRIX_JSON}" >> $GITHUB_OUTPUT
- name: "Run a static analysis with phpstan/phpstan"
run: "vendor/bin/phpstan analyse --memory-limit=-1"
static-analysis:
needs: setup-matrix
strategy:
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
uses: pimcore/workflows-collection-public/.github/workflows/reusable-static-analysis-centralized.yaml@main
with:
APP_ENV: test
PIMCORE_TEST: 1
PRIVATE_REPO: ${{ needs.setup-matrix.outputs.private_repo}}
PHP_VERSION: ${{ matrix.matrix.php-version }}
SYMFONY: ${{ matrix.matrix.symfony }}
DEPENDENCIES: ${{ matrix.matrix.dependencies }}
EXPERIMENTAL: ${{ matrix.matrix.experimental }}
PIMCORE_VERSION: ${{ matrix.matrix.pimcore_version }}
COMPOSER_OPTIONS: ${{ matrix.matrix.composer_options }}
secrets:
SSH_PRIVATE_KEY_PIMCORE_DEPLOYMENTS_USER: ${{ secrets.SSH_PRIVATE_KEY_PIMCORE_DEPLOYMENTS_USER }}
COMPOSER_PIMCORE_REPO_PACKAGIST_TOKEN: ${{ secrets.COMPOSER_PIMCORE_REPO_PACKAGIST_TOKEN }}
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
"prefer-stable": true,
"minimum-stability": "dev",
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"pimcore/admin-ui-classic-bundle": "^1.0",
"pimcore/pimcore": "^11.2",
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
"pimcore/admin-ui-classic-bundle": "^1.0 || ^2.0",
"pimcore/pimcore": "^11.2 || ^12.0",
"pimcore/output-data-config-toolkit-bundle": "^4.1 || ^5.0",
"symfony/http-foundation": "^6.3"
},
"require-dev": {
"phpstan/phpstan": "^1.9"
"phpstan/phpstan": "^1.12.15"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit a63f6da

Please sign in to comment.