Skip to content

Commit 175bbbb

Browse files
authored
update php and pimcore, fix deprecations (#128)
* update php and pimcore, fix deprecations * update php and pimcore, fix deprecations * update php and pimcore, fix deprecations
1 parent fa8570d commit 175bbbb

File tree

3 files changed

+85
-49
lines changed

3 files changed

+85
-49
lines changed
Lines changed: 80 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +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", pimcore_version: "", phpstan_args: "", experimental: false }
21-
- { php-version: "8.2", dependencies: "highest", pimcore_version: "", phpstan_args: "", experimental: false }
22-
- { php-version: "8.2", dependencies: "highest", pimcore_version: "11.x-dev as 11.99.9", phpstan_args: "", experimental: 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@v4"
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 }}"
34+
repository: pimcore/workflows-collection-public
35+
ref: main
36+
path: reusable-workflows
3237

33-
- name: "Setup Pimcore environment"
34-
env:
35-
DEPENDENCIES: "${{ matrix.dependencies }}"
36-
run: |
37-
.github/ci/scripts/setup-environment.sh
38-
- name: "Update Pimcore version"
39-
env:
40-
PIMCORE_VERSION: "${{ matrix.pimcore_version }}"
38+
- name: Parse PHP versions from composer.json
39+
id: parse-php-versions
4140
run: |
42-
if [ ! -z "$PIMCORE_VERSION" ]; then
43-
composer require --no-update pimcore/pimcore:"${PIMCORE_VERSION}"
44-
fi
45-
- name: "Install dependencies with Composer"
46-
uses: "ramsey/composer-install@v2"
47-
with:
48-
dependency-versions: "${{ matrix.dependencies }}"
49-
50-
- name: "Run a static analysis with phpstan/phpstan"
51-
run: "vendor/bin/phpstan analyse --memory-limit=-1"
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
54+
fi
5255
53-
- name: "Generate baseline file"
54-
if: ${{ failure() }}
55-
run: "vendor/bin/phpstan analyse --memory-limit=-1 --generate-baseline"
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
5677
57-
- name: "Upload baseline file"
58-
if: ${{ failure() }}
59-
uses: actions/upload-artifact@v4
60-
with:
61-
name: phpstan-baseline.neon
62-
path: phpstan-baseline.neon
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: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
"name": "pimcore/output-data-config-toolkit-bundle",
33
"license": "GPL-3.0+",
44
"type": "pimcore-bundle",
5+
"prefer-stable": true,
6+
"minimum-stability": "dev",
57
"require": {
6-
"pimcore/pimcore": "^11.2",
8+
"php": "~8.2.0 || ~8.3.0 || ~8.4.0",
9+
"pimcore/pimcore": "^11.2 || ^12.0",
710
"symfony/config": "^6.2",
811
"symfony/dependency-injection": "^6.2",
912
"symfony/event-dispatcher": "^6.2",
@@ -14,7 +17,7 @@
1417
"symfony/templating": "^6.2"
1518
},
1619
"require-dev": {
17-
"phpstan/phpstan": "^1.10.5",
20+
"phpstan/phpstan": "^1.12.15",
1821
"phpstan/phpstan-symfony": "^1.2.20"
1922
},
2023
"autoload": {

0 commit comments

Comments
 (0)