11name : " Static analysis centralised"
22
33on :
4- schedule :
5- - cron : ' 0 3 * * 1,3,5'
6- workflow_dispatch :
7- push :
8- branches :
9- - " [0-9]+.[0-9]+"
10- - " [0-9]+.x"
11- - " feature-*"
12- pull_request :
13- types : [ opened, synchronize, reopened ]
14-
4+ schedule :
5+ - cron : ' 0 3 * * 1,3,5'
6+ workflow_dispatch :
7+ pull_request :
8+ types : [ opened, synchronize, reopened ]
9+ paths-ignore :
10+ - ' doc/**'
11+ - ' public/**'
12+ - ' **.md'
13+ push :
14+ paths-ignore :
15+ - ' doc/**'
16+ - ' public/**'
17+ - ' **.md'
18+ branches :
19+ - " [0-9]+.[0-9]+"
20+ - " [0-9]+.x"
1521
1622env :
17- PIMCORE_PROJECT_ROOT : ${{ github.workspace }}
18- PRIVATE_REPO : ${{ github.event.repository.private }}
23+ PIMCORE_PROJECT_ROOT : ${{ github.workspace }}
24+ PRIVATE_REPO : ${{ github.event.repository.private }}
25+
26+ concurrency :
27+ group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
28+ cancel-in-progress : true
1929
2030jobs :
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 }}
27- steps :
28- - name : Checkout code
29- uses : actions/checkout@v4
31+ setup-matrix :
32+ runs-on : ubuntu-latest
33+ timeout-minutes : 10
34+ outputs :
35+ php_versions : ${{ steps.parse-php-versions.outputs.php_versions }}
36+ phpstan_matrix : ${{ steps.set-matrix.outputs.phpstan_matrix }}
37+ private_repo : ${{ env.PRIVATE_REPO }}
38+ steps :
39+ - name : Checkout code
40+ uses : actions/checkout@v4
3041
31- - name : Checkout reusable workflow repo
32- uses : actions/checkout@v4
33- with :
34- repository : pimcore/workflows-collection-public
35- ref : main
36- path : reusable-workflows
42+ - name : Checkout reusable workflow repo
43+ uses : actions/checkout@v4
44+ with :
45+ repository : pimcore/workflows-collection-public
46+ ref : main
47+ path : reusable-workflows
3748
38- - name : Parse PHP versions from composer.json
39- id : parse-php-versions
40- run : |
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
49+ - name : Parse PHP versions from composer.json
50+ id : parse-php-versions
51+ run : |
52+ if [ -f composer.json ]; then
53+ php_versions=$(jq -r '.require.php' composer.json | grep -oP '\d+\.\d+' | tr '\n' ',' | sed 's/,$//')
54+ if [ -z "$php_versions" ]; then
55+ echo "php_versions=default" >> "$GITHUB_OUTPUT"
56+ else
57+ echo "php_versions=$php_versions" >> "$GITHUB_OUTPUT"
58+ fi
59+ else
60+ exit 1
61+ fi
5562
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
63+ - name : Set up matrix JSON
64+ id : set-matrix
65+ run : |
66+ php_versions="${{ steps.parse-php-versions.outputs.php_versions }}"
67+ MATRIX_JSON=$(cat reusable-workflows/phpstan-configuration/matrix-config.json)
68+ FILTERED_MATRIX_JSON=$(echo "$MATRIX_JSON" | jq --arg php_versions "$php_versions" '{ include: [ .configs[] | select(.php_version == $php_versions) | .matrix[] ] }')
69+ ENCODED_MATRIX_JSON=$(echo "$FILTERED_MATRIX_JSON" | jq -c .)
70+ echo "phpstan_matrix=$ENCODED_MATRIX_JSON" >> "$GITHUB_OUTPUT"
7771
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 }}
72+ static-analysis :
73+ needs : setup-matrix
74+ uses : pimcore/workflows-collection-public/.github/workflows/reusable-static-analysis-unified.yaml@main
75+ with :
76+ phpstan_matrix : ${{ needs.setup-matrix.outputs.phpstan_matrix }}
77+ private_repo : ${{ needs.setup-matrix.outputs.private_repo }}
78+ APP_ENV : test
79+ PIMCORE_TEST : 1
80+ REQUIRE_ADMIN_BUNDLE : " false"
81+ COVERAGE : " none"
82+ secrets :
83+ SSH_PRIVATE_KEY_PIMCORE_DEPLOYMENTS_USER : ${{ secrets.SSH_PRIVATE_KEY_PIMCORE_DEPLOYMENTS_USER }}
84+ COMPOSER_PIMCORE_REPO_PACKAGIST_TOKEN : ${{ secrets.COMPOSER_PIMCORE_REPO_PACKAGIST_TOKEN }}
85+ PIMCORE_CI_INSTANCE_IDENTIFIER : ${{ secrets.PIMCORE_CI_INSTANCE_IDENTIFIER }}
86+ PIMCORE_CI_ENCRYPTION_SECRET : ${{ secrets.PIMCORE_CI_ENCRYPTION_SECRET }}
87+ PIMCORE_CI_PRODUCT_KEY : ${{ secrets.PIMCORE_CI_PRODUCT_KEY }}
0 commit comments