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