Skip to content

Commit 52d1b71

Browse files
authored
update php and pimcore, fix deprecations (#90)
1 parent 917681d commit 52d1b71

File tree

3 files changed

+83
-45
lines changed

3 files changed

+83
-45
lines changed

.github/ci/scripts/setup-pimcore-environment.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,3 @@
33
set -eu -o xtrace
44

55
cp .github/ci/files/.env .
6-
7-
if [ ${REQUIRE_ADMIN_BUNDLE} = true ]; then
8-
composer require -n --no-update pimcore/admin-ui-classic-bundle
9-
fi

.github/workflows/static-analysis.yml

Lines changed: 79 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,95 @@
1-
name: "Static Analysis"
1+
name: "Static analysis centralised"
22

33
on:
4-
pull_request:
5-
branches:
6-
- "[0-9]+.[0-9]+"
7-
- "[0-9]+.x"
4+
schedule:
5+
- cron: '0 3 * * 1,3,5'
6+
workflow_dispatch:
87
push:
98
branches:
109
- "[0-9]+.[0-9]+"
1110
- "[0-9]+.x"
11+
- "feature-*"
12+
pull_request:
13+
types: [ opened, synchronize, reopened ]
14+
15+
16+
env:
17+
PIMCORE_PROJECT_ROOT: ${{ github.workspace }}
18+
PRIVATE_REPO: ${{ github.event.repository.private }}
1219

1320
jobs:
14-
static-analysis-phpstan:
15-
name: "Static Analysis with PHPStan"
16-
runs-on: "ubuntu-20.04"
17-
strategy:
18-
matrix:
19-
include:
20-
- { php-version: "8.1", dependencies: "lowest", require_admin_bundle: false }
21-
- { php-version: "8.2", dependencies: "highest", require_admin_bundle: true }
22-
- { php-version: "8.3", dependencies: "highest", pimcore_version: "11.x-dev", require_admin_bundle: true }
21+
setup-matrix:
22+
runs-on: ubuntu-latest
23+
outputs:
24+
php_versions: ${{ steps.parse-php-versions.outputs.php_versions }}
25+
matrix: ${{ steps.set-matrix.outputs.matrix }}
26+
private_repo: ${{ env.PRIVATE_REPO }}
2327
steps:
24-
- name: "Checkout code"
25-
uses: "actions/checkout@v2"
28+
- name: Checkout code
29+
uses: actions/checkout@v4
2630

27-
- name: "Install PHP"
28-
uses: "shivammathur/setup-php@v2"
31+
- name: Checkout reusable workflow repo
32+
uses: actions/checkout@v4
2933
with:
30-
coverage: "none"
31-
php-version: "${{ matrix.php-version }}"
32-
33-
- name: "Setup Pimcore environment"
34-
env:
35-
REQUIRE_ADMIN_BUNDLE: "${{ matrix.require_admin_bundle }}"
36-
run: |
37-
.github/ci/scripts/setup-pimcore-environment.sh
34+
repository: pimcore/workflows-collection-public
35+
ref: main
36+
path: reusable-workflows
3837

39-
- name: "Update Pimcore version"
40-
env:
41-
PIMCORE_VERSION: "${{ matrix.pimcore_version }}"
38+
- name: Parse PHP versions from composer.json
39+
id: parse-php-versions
4240
run: |
43-
if [ ! -z "$PIMCORE_VERSION" ]; then
44-
composer require --no-update pimcore/pimcore:"${PIMCORE_VERSION}"
41+
if [ -f composer.json ]; then
42+
php_versions=$(jq -r '.require.php' composer.json | grep -oP '\d+\.\d+' | tr '\n' ',' | sed 's/,$//')
43+
if [ -z "$php_versions" ]; then
44+
echo "No PHP versions found in composer.json"
45+
echo "Setting default PHP value"
46+
echo "php_versions=default" >> $GITHUB_OUTPUT
47+
else
48+
echo "php_versions=$php_versions" >> $GITHUB_OUTPUT
49+
echo "#### php versions #### : $php_versions"
50+
fi
51+
else
52+
echo "composer.json not found"
53+
exit 1
4554
fi
4655
47-
- name: "Install dependencies with Composer"
48-
uses: "ramsey/composer-install@v2"
49-
with:
50-
dependency-versions: "${{ matrix.dependencies }}"
56+
- name: Set up matrix
57+
id: set-matrix
58+
run: |
59+
php_versions="${{ steps.parse-php-versions.outputs.php_versions }}"
60+
61+
MATRIX_JSON=$(cat reusable-workflows/phpstan-configuration/matrix-config.json)
62+
63+
IFS=',' read -ra VERSIONS_ARRAY <<< "$php_versions"
64+
65+
FILTERED_MATRIX_JSON=$(echo $MATRIX_JSON | jq --arg php_versions "$php_versions" '
66+
{
67+
matrix: [
68+
.configs[] |
69+
select(.php_version == $php_versions) |
70+
.matrix[]
71+
]
72+
}')
73+
74+
ENCODED_MATRIX_JSON=$(echo $FILTERED_MATRIX_JSON | jq -c .)
75+
76+
echo "matrix=${ENCODED_MATRIX_JSON}" >> $GITHUB_OUTPUT
5177
52-
- name: "Run a static analysis with phpstan/phpstan"
53-
run: "vendor/bin/phpstan analyse --memory-limit=-1"
78+
static-analysis:
79+
needs: setup-matrix
80+
strategy:
81+
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
82+
uses: pimcore/workflows-collection-public/.github/workflows/reusable-static-analysis-centralized.yaml@main
83+
with:
84+
APP_ENV: test
85+
PIMCORE_TEST: 1
86+
PRIVATE_REPO: ${{ needs.setup-matrix.outputs.private_repo}}
87+
PHP_VERSION: ${{ matrix.matrix.php-version }}
88+
SYMFONY: ${{ matrix.matrix.symfony }}
89+
DEPENDENCIES: ${{ matrix.matrix.dependencies }}
90+
EXPERIMENTAL: ${{ matrix.matrix.experimental }}
91+
PIMCORE_VERSION: ${{ matrix.matrix.pimcore_version }}
92+
COMPOSER_OPTIONS: ${{ matrix.matrix.composer_options }}
93+
secrets:
94+
SSH_PRIVATE_KEY_PIMCORE_DEPLOYMENTS_USER: ${{ secrets.SSH_PRIVATE_KEY_PIMCORE_DEPLOYMENTS_USER }}
95+
COMPOSER_PIMCORE_REPO_PACKAGIST_TOKEN: ${{ secrets.COMPOSER_PIMCORE_REPO_PACKAGIST_TOKEN }}

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
"prefer-stable": true,
99
"minimum-stability": "dev",
1010
"require": {
11-
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
12-
"pimcore/admin-ui-classic-bundle": "^1.0",
13-
"pimcore/pimcore": "^11.2",
11+
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
12+
"pimcore/admin-ui-classic-bundle": "^1.0 || ^2.0",
13+
"pimcore/pimcore": "^11.2 || ^12.0",
1414
"pimcore/output-data-config-toolkit-bundle": "^4.1 || ^5.0",
1515
"symfony/http-foundation": "^6.3"
1616
},
1717
"require-dev": {
18-
"phpstan/phpstan": "^1.9"
18+
"phpstan/phpstan": "^1.12.15"
1919
},
2020
"autoload": {
2121
"psr-4": {

0 commit comments

Comments
 (0)