diff --git a/.github/workflows/cla.yaml b/.github/workflows/cla.yaml index 42a997f..ec376e9 100644 --- a/.github/workflows/cla.yaml +++ b/.github/workflows/cla.yaml @@ -1,14 +1,14 @@ name: CLA check on: - issue_comment: - types: [created] - pull_request_target: - types: [opened, closed, synchronize] + issue_comment: + types: [created] + pull_request_target: + types: [opened, closed, synchronize] jobs: - cla-workflow: - uses: pimcore/workflows-collection-public/.github/workflows/reusable-cla-check.yaml@v1.3.0 - if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target' - secrets: - CLA_ACTION_ACCESS_TOKEN: ${{ secrets.CLA_ACTION_ACCESS_TOKEN }} \ No newline at end of file + cla-workflow: + uses: pimcore/workflows-collection-public/.github/workflows/reusable-cla-check.yaml@main + if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target' + secrets: + CLA_ACTION_ACCESS_TOKEN: ${{ secrets.CLA_ACTION_ACCESS_TOKEN }} diff --git a/.github/workflows/new-php-cs-fixer.yaml b/.github/workflows/php-cs-fixer.yaml similarity index 91% rename from .github/workflows/new-php-cs-fixer.yaml rename to .github/workflows/php-cs-fixer.yaml index 91256e7..2e0fbbf 100644 --- a/.github/workflows/new-php-cs-fixer.yaml +++ b/.github/workflows/php-cs-fixer.yaml @@ -14,7 +14,7 @@ permissions: jobs: php-style: - uses: pimcore/workflows-collection-public/.github/workflows/reusable-php-cs-fixer.yaml@fix-failed-workflow + uses: pimcore/workflows-collection-public/.github/workflows/reusable-php-cs-fixer.yaml@main with: head_ref: ${{ github.head_ref || github.ref_name }} repository: ${{ github.repository }} diff --git a/.github/workflows/php-cs-fixer.yaml.bak b/.github/workflows/php-cs-fixer.yaml.bak deleted file mode 100644 index 6d19d4f..0000000 --- a/.github/workflows/php-cs-fixer.yaml.bak +++ /dev/null @@ -1,35 +0,0 @@ -name: "PHP-CS-Fixer" - -on: - pull_request_target: - branches: - - "[0-9]+.[0-9]+" - - "[0-9]+.x" - - "feature-*" - push: - branches: - - "[0-9]+.[0-9]+" - - "[0-9]+.x" - - "*_actions" - - "feature-*" - -permissions: - contents: read - -jobs: - php-cs-fixer: - permissions: - contents: write # for stefanzweifel/git-auto-commit-action to push code in repo - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - - - name: PHP-CS-Fixer - uses: docker://oskarstark/php-cs-fixer-ga:latest - - - uses: stefanzweifel/git-auto-commit-action@v5 - with: - commit_message: Apply php-cs-fixer changes diff --git a/.github/workflows/new-static-analysis.yaml b/.github/workflows/static-analysis.yaml similarity index 89% rename from .github/workflows/new-static-analysis.yaml rename to .github/workflows/static-analysis.yaml index 6e0327d..9c595ec 100644 --- a/.github/workflows/new-static-analysis.yaml +++ b/.github/workflows/static-analysis.yaml @@ -12,6 +12,7 @@ on: - 'doc/**' - 'install/**' - 'src/Resources/public/**' + - '**.md' push: paths-ignore: - 'assets/**' @@ -19,6 +20,7 @@ on: - 'doc/**' - 'install/**' - 'src/Resources/public/**' + - '**.md' branches: - "[0-9]+.[0-9]+" - "[0-9]+.x" @@ -28,12 +30,13 @@ env: PRIVATE_REPO: ${{ github.event.repository.private }} concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: setup-matrix: runs-on: ubuntu-latest + timeout-minutes: 10 outputs: php_versions: ${{ steps.parse-php-versions.outputs.php_versions }} phpstan_matrix: ${{ steps.set-matrix.outputs.phpstan_matrix }} @@ -69,6 +72,10 @@ jobs: php_versions="${{ steps.parse-php-versions.outputs.php_versions }}" MATRIX_JSON=$(cat reusable-workflows/phpstan-configuration/matrix-config.json) FILTERED_MATRIX_JSON=$(echo "$MATRIX_JSON" | jq --arg php_versions "$php_versions" '{ include: [ .configs[] | select(.php_version == $php_versions) | .matrix[] ] }') + if [ "$(echo "$FILTERED_MATRIX_JSON" | jq '.include | length')" = "0" ]; then + echo "::error::No matrix configuration found for PHP versions '$php_versions'" + exit 1 + fi ENCODED_MATRIX_JSON=$(echo "$FILTERED_MATRIX_JSON" | jq -c .) echo "phpstan_matrix=$ENCODED_MATRIX_JSON" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/static-analysis.yml.bak b/.github/workflows/static-analysis.yml.bak deleted file mode 100644 index cc70aac..0000000 --- a/.github/workflows/static-analysis.yml.bak +++ /dev/null @@ -1,95 +0,0 @@ -name: "Static analysis centralised" - -on: - 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: - 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@v4 - - - name: Checkout reusable workflow repo - uses: actions/checkout@v4 - with: - repository: pimcore/workflows-collection-public - ref: main - path: reusable-workflows - - - name: Parse PHP versions from composer.json - id: parse-php-versions - run: | - 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: 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 - - 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 }} \ No newline at end of file