diff --git a/.github/workflows/acceptance.yaml b/.github/workflows/acceptance.yaml index 9fbfadb7e..5be62bc7a 100644 --- a/.github/workflows/acceptance.yaml +++ b/.github/workflows/acceptance.yaml @@ -1,95 +1,27 @@ name: Acceptance on: - schedule: - - cron: '0 3 * * *' # nightly at 3 am utc - workflow_dispatch: - inputs: - update_snapshots: - description: 'Update snapshots' - required: false - type: boolean - default: false - push: - branches: - - trunk - pull_request: + workflow_dispatch: + inputs: + update_snapshots: + description: Update snapshots + required: false + type: boolean + default: false + push: + branches: + - trunk + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true jobs: - playwright: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - PLATFORM_BRANCH: ["trunk"] - services: - mysql: - image: mysql:8.0 - env: - MYSQL_ROOT_PASSWORD: root - MYSQL_DATABASE: shopware - ports: - - 3306:3306 - env: - DATABASE_URL: mysql://root:root@127.0.0.1:3306/shopware - - steps: - - uses: shopware/github-actions/setup-extension@main - with: - extensionName: ${{ github.event.repository.name }} - shopwareVersion: ${{ matrix.PLATFORM_BRANCH }} - install: true - install-admin: true - install-storefront: false - mysqlVersion: skip - env: prod - extraRepositories: | - { - "${{ github.event.repository.name }}": { - "type": "path", - "url": "custom/plugins/${{ github.event.repository.name }}", - "symlink": true - } - } - - - name: Setup Migration Assistant - run: | - composer run build:js:admin - cd custom/plugins/${{ github.event.repository.name }}/tests - mysql -uroot < _fixtures/database/shopware55corrupted.sql - - - name: Cache Playwright browsers - uses: actions/cache@v4 - with: - path: ~/.cache/ms-playwright - key: playwright-${{ runner.os }}-${{ hashFiles('custom/plugins/**/tests/acceptance/package-lock.json') }} - - - name: Install playwright - working-directory: custom/plugins/${{ github.event.repository.name }}/tests/acceptance - run: | - npm ci - npx playwright install --with-deps - - - name: Run Playwright - working-directory: custom/plugins/${{ github.event.repository.name }}/tests/acceptance - env: - DATABASE_URL: mysql://root:root@127.0.0.1:3306/shopware55 - UPDATE_SNAPSHOTS: ${{ github.event.inputs.update_snapshots }} - run: npm run test - - - uses: actions/upload-artifact@v4 - if: always() - with: - name: e2e-${{ github.event.repository.name }}-${{ github.sha }}-${{ matrix.PLATFORM_BRANCH }} - path: | - custom/plugins/${{ github.event.repository.name }}/tests/acceptance/test-results/ - custom/plugins/${{ github.event.repository.name }}/tests/acceptance/playwright-report/ - retention-days: 3 - - - name: Upload updated snapshots - if: github.event.inputs.update_snapshots == 'true' - uses: actions/upload-artifact@v4 + playwright: + name: Playwright + uses: ./.github/workflows/action-acceptance.yml with: - name: visual-snapshots-${{ matrix.PLATFORM_BRANCH }} - path: custom/plugins/${{ github.event.repository.name }}/tests/acceptance/snapshots/ - retention-days: 3 + extension_name: ${{ github.event.repository.name }} + platform_branch: trunk + update_snapshots: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.update_snapshots == 'true' }} diff --git a/.github/workflows/action-acceptance.yml b/.github/workflows/action-acceptance.yml new file mode 100644 index 000000000..15319a9b0 --- /dev/null +++ b/.github/workflows/action-acceptance.yml @@ -0,0 +1,98 @@ +name: Reusable Acceptance + +on: + workflow_call: + inputs: + extension_name: + required: true + type: string + platform_branch: + required: true + type: string + update_snapshots: + required: false + type: boolean + default: false + +jobs: + playwright: + name: Playwright + runs-on: ubuntu-latest + services: + mysql: + image: mysql:8.0 + env: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: shopware + ports: + - 3306:3306 + env: + DATABASE_URL: mysql://root:root@127.0.0.1:3306/shopware + steps: + - name: Setup extension + uses: shopware/github-actions/setup-extension@main + with: + extensionName: ${{ inputs.extension_name }} + shopwareVersion: ${{ inputs.platform_branch }} + install: true + install-admin: true + install-storefront: false + mysqlVersion: skip + env: prod + extraRepositories: | + { + "${{ inputs.extension_name }}": { + "type": "path", + "url": "custom/plugins/${{ inputs.extension_name }}", + "symlink": true + } + } + + - name: Cache npm + uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 + with: + path: ~/.npm + key: ${{ runner.os }}-acceptance-${{ hashFiles(format('custom/plugins/{0}/tests/acceptance/package-lock.json', inputs.extension_name)) }} + + - name: Cache Playwright browsers + uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 + with: + path: ~/.cache/ms-playwright + key: playwright-${{ runner.os }}-${{ hashFiles(format('custom/plugins/{0}/tests/acceptance/package-lock.json', inputs.extension_name)) }} + + - name: Setup Migration Assistant + run: | + composer run build:js:admin + cd custom/plugins/${{ inputs.extension_name }}/tests + mysql -uroot < _fixtures/database/shopware55corrupted.sql + + - name: Install Playwright + working-directory: custom/plugins/${{ inputs.extension_name }}/tests/acceptance + run: | + npm ci + npx playwright install --with-deps + + - name: Run Playwright + working-directory: custom/plugins/${{ inputs.extension_name }}/tests/acceptance + env: + DATABASE_URL: mysql://root:root@127.0.0.1:3306/shopware55 + UPDATE_SNAPSHOTS: ${{ inputs.update_snapshots }} + run: npm run test + + - name: Upload test artifacts + if: always() + uses: actions/upload-artifact@v4 + with: + name: e2e-${{ inputs.extension_name }}-${{ github.sha }}-${{ inputs.platform_branch }} + path: | + custom/plugins/${{ inputs.extension_name }}/tests/acceptance/test-results/ + custom/plugins/${{ inputs.extension_name }}/tests/acceptance/playwright-report/ + retention-days: 3 + + - name: Upload updated snapshots + if: inputs.update_snapshots + uses: actions/upload-artifact@v4 + with: + name: visual-snapshots-${{ inputs.platform_branch }} + path: custom/plugins/${{ inputs.extension_name }}/tests/acceptance/snapshots/ + retention-days: 3 diff --git a/.github/workflows/action-jest.yml b/.github/workflows/action-jest.yml new file mode 100644 index 000000000..db59d032c --- /dev/null +++ b/.github/workflows/action-jest.yml @@ -0,0 +1,45 @@ +name: Reusable Jest + +on: + workflow_call: + inputs: + extension_name: + required: true + type: string + +jobs: + jest: + name: Jest + runs-on: ubuntu-latest + env: + ARTIFACTS_PATH: ${{ github.workspace }}/development + steps: + - name: Setup extension + uses: shopware/github-actions/setup-extension@main + with: + extensionName: ${{ inputs.extension_name }} + install: true + install-admin: true + install-storefront: false + extraRepositories: | + { + "${{ inputs.extension_name }}": { + "type": "path", + "url": "custom/plugins/${{ inputs.extension_name }}", + "symlink": true + } + } + + - name: Cache npm + uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 + with: + path: ~/.npm + key: ${{ runner.os }}-jest-${{ hashFiles(format('custom/plugins/{0}/tests/Jest/package-lock.json', inputs.extension_name)) }} + + - name: Install Jest dependencies + working-directory: custom/plugins/${{ inputs.extension_name }}/tests/Jest + run: npm ci + + - name: Run Jest + working-directory: custom/plugins/${{ inputs.extension_name }}/tests/Jest + run: npm run unit diff --git a/.github/workflows/action-phpstan.yml b/.github/workflows/action-phpstan.yml new file mode 100644 index 000000000..755301071 --- /dev/null +++ b/.github/workflows/action-phpstan.yml @@ -0,0 +1,52 @@ +name: Reusable PHPStan + +on: + workflow_call: + inputs: + extension_name: + required: true + type: string + +jobs: + phpstan: + name: PHPStan + runs-on: ubuntu-latest + steps: + - name: Setup extension + uses: shopware/github-actions/setup-extension@main + env: + DATABASE_URL: mysql://root@127.0.0.1/shopware + with: + extensionName: ${{ inputs.extension_name }} + install: true + install-admin: true + install-storefront: true + extraRepositories: | + { + "${{ inputs.extension_name }}": { + "type": "path", + "url": "custom/plugins/${{ inputs.extension_name }}", + "symlink": true + } + } + + - name: Create phpstan.neon + working-directory: custom/plugins/${{ inputs.extension_name }} + run: | + printf "parameters:\n tmpDir: ${GITHUB_WORKSPACE}/var/phpstan\nincludes:\n - phpstan.neon.dist" > phpstan.neon + + - name: PHPStan cache + uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 + with: + path: ${{ github.workspace }}/var/phpstan + key: ${{ runner.os }}-${{ github.repository }}-phpstan-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-${{ github.repository }}-phpstan- + + - name: Build PHPStan bootstrap + run: php ${GITHUB_WORKSPACE}/src/Core/DevOps/StaticAnalyze/phpstan-bootstrap.php + + - name: Run PHPStan + run: | + composer -d custom/plugins/${{ inputs.extension_name }} dump-autoload --dev + composer -d custom/plugins/${{ inputs.extension_name }} run phpstan diff --git a/.github/workflows/action-phpunit.yml b/.github/workflows/action-phpunit.yml new file mode 100644 index 000000000..13144fd24 --- /dev/null +++ b/.github/workflows/action-phpunit.yml @@ -0,0 +1,38 @@ +name: Reusable PHPUnit + +on: + workflow_call: + inputs: + extension_name: + required: true + type: string + platform_branch: + required: true + type: string + +jobs: + phpunit: + name: PHPUnit + runs-on: ubuntu-latest + steps: + - name: Setup extension + uses: shopware/github-actions/setup-extension@main + with: + extensionName: ${{ inputs.extension_name }} + install: true + shopwareVersion: ${{ inputs.platform_branch }} + extraRepositories: | + { + "${{ inputs.extension_name }}": { + "type": "path", + "url": "custom/plugins/${{ inputs.extension_name }}", + "symlink": true + } + } + + - name: Import SW5 test data DB + working-directory: custom/plugins/${{ inputs.extension_name }}/tests + run: mysql -uroot < _fixtures/database/shopware55.sql + + - name: Run PHPUnit + run: composer -d custom/plugins/${{ inputs.extension_name }} run phpunit diff --git a/.github/workflows/admin.yaml b/.github/workflows/admin.yaml index 00fe4e2a8..56d9dc56e 100644 --- a/.github/workflows/admin.yaml +++ b/.github/workflows/admin.yaml @@ -1,84 +1,61 @@ name: Admin +env: + EXTENSION_NAME: ${{ github.event.repository.name }} + on: - workflow_dispatch: - push: - branches: - - trunk - pull_request: - paths: - - src/Resources/app/administration/** - - tests/Jest/** - - .github/workflows/admin.yml - workflow_call: + workflow_dispatch: + push: + branches: + - trunk + pull_request: + paths: + - src/Resources/app/administration/** + - tests/Jest/** + - .github/workflows/** + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true jobs: - lint: - name: Lint - runs-on: ubuntu-latest - steps: - - uses: shopware/github-actions/setup-extension@main - with: - extensionName: ${{ github.event.repository.name }} - install: true - install-admin: true - install-storefront: false - extraRepositories: | - { - "${{ github.event.repository.name }}": { - "type": "path", - "url": "custom/plugins/${{ github.event.repository.name }}", - "symlink": true - } - } - - run: | - composer -d custom/plugins/${{ github.event.repository.name }} run admin:install - composer -d custom/plugins/${{ github.event.repository.name }} run lint:admin - composer -d custom/plugins/${{ github.event.repository.name }} run format:admin - composer -d custom/plugins/${{ github.event.repository.name }} run format:md + lint: + name: Lint and formatting checks + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 - stylelint: - name: Stylelint - runs-on: ubuntu-latest - steps: - - uses: shopware/github-actions/setup-extension@main - with: - extensionName: ${{ github.event.repository.name }} - install: true - install-admin: true - install-storefront: false - extraRepositories: | - { - "${{ github.event.repository.name }}": { - "type": "path", - "url": "custom/plugins/${{ github.event.repository.name }}", - "symlink": true - } - } - - run: | - composer -d custom/plugins/${{ github.event.repository.name }} run admin:install - composer -d custom/plugins/${{ github.event.repository.name }} run lint:admin:scss + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + cache-dependency-path: | + src/Resources/app/administration/package-lock.json + tests/Jest/package-lock.json + tests/acceptance/package-lock.json + + - name: Install admin dependencies + run: | + npm ci --prefix src/Resources/app/administration + npm ci --prefix tests/Jest + npm ci --prefix tests/acceptance + + - name: Run lint and formatting checks + run: | + npm run lint --prefix tests/Jest + npm run lint --prefix src/Resources/app/administration + npm run lint --prefix tests/acceptance + npm run lint:scss --prefix src/Resources/app/administration + npm run format --prefix tests/Jest + npm run format --prefix src/Resources/app/administration + npm run format --prefix tests/acceptance + npm run format:md --prefix src/Resources/app/administration + npm run format:yml --prefix src/Resources/app/administration - jest: - name: Jest - runs-on: ubuntu-latest - env: - ARTIFACTS_PATH: ${{ github.workspace }}/development - steps: - - uses: shopware/github-actions/setup-extension@main + jest: + name: Jest + uses: ./.github/workflows/action-jest.yml with: - extensionName: ${{ github.event.repository.name }} - install: true - install-admin: true - install-storefront: false - extraRepositories: | - { - "${{ github.event.repository.name }}": { - "type": "path", - "url": "custom/plugins/${{ github.event.repository.name }}", - "symlink": true - } - } - - run: | - composer -d custom/plugins/${{ github.event.repository.name }} run admin:install - composer -d custom/plugins/${{ github.event.repository.name }} run admin:unit -- --ci + extension_name: ${{ github.event.repository.name }} diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml index 6da327569..b1fe77722 100644 --- a/.github/workflows/check-pr-title.yml +++ b/.github/workflows/check-pr-title.yml @@ -1,33 +1,33 @@ name: Check PR title on: - pull_request: - types: - - opened - - reopened - - edited - - synchronize + pull_request: + types: + - opened + - reopened + - edited + - synchronize permissions: - pull-requests: read + pull-requests: read jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # 6.1.1 - with: - types: | - feat - fix - chore - docs - style - refactor - perf - test - build - ci - revert - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + lint: + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # 6.1.1 + with: + types: | + feat + fix + chore + docs + style + refactor + perf + test + build + ci + revert + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index d7e366ea5..5d12bd8cd 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -1,81 +1,73 @@ name: Integration +env: + EXTENSION_NAME: ${{ github.event.repository.name }} + PLATFORM_BRANCH: trunk + on: - workflow_dispatch: - push: - branches: - - trunk - pull_request: + workflow_dispatch: + push: + branches: + - trunk + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true jobs: - danger: - name: Danger Check - runs-on: ubuntu-latest - if: github.event_name == 'pull_request' - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - name: Run Danger PHP - uses: docker://ghcr.io/shyim/danger-php:latest - with: - args: ci - env: - GITHUB_REPOSITORY: ${{ github.repository }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_PULL_REQUEST_ID: ${{ github.event.pull_request.number }} + danger: + name: Danger Check + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + steps: + - name: Checkout repository + uses: actions/checkout@v4 - build_zip: - name: Build and validate zip - runs-on: ubuntu-latest - steps: - - name: Build - uses: shopware/github-actions/build-zip@main - with: - extensionName: ${{ github.event.repository.name }} + - name: Run Danger PHP + uses: docker://ghcr.io/shyim/danger-php:latest + with: + args: ci + env: + GITHUB_REPOSITORY: ${{ github.repository }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_PULL_REQUEST_ID: ${{ github.event.pull_request.number }} - phpunit: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - PLATFORM_BRANCH: ["trunk"] # TODO add min version 6.7.0 here when trunk becomes > 6.7.0 - steps: - - uses: shopware/github-actions/setup-extension@main - with: - extensionName: ${{ github.event.repository.name }} - install: true - shopwareVersion: ${{ matrix.PLATFORM_BRANCH }} - extraRepositories: | - { - "${{ github.event.repository.name }}": { - "type": "path", - "url": "custom/plugins/${{ github.event.repository.name }}", - "symlink": true - } - } - - name: Import SW5 TestData DB - working-directory: custom/plugins/${{ github.event.repository.name }}/tests - run: mysql -uroot < _fixtures/database/shopware55.sql - - name: Run PHPUnit - working-directory: custom/plugins/${{ github.event.repository.name }} - run: php -d pcov.enabled=1 -d pcov.directory=${PWD} -d pcov.exclude='~(vendor|tests|node_modules)~' ${GITHUB_WORKSPACE}/vendor/bin/phpunit --configuration phpunit.xml.dist + build_zip: + name: Build and validate zip + runs-on: ubuntu-latest + steps: + - name: Build + uses: shopware/github-actions/build-zip@main + with: + extensionName: ${{ env.EXTENSION_NAME }} - smoke_test: - runs-on: ubuntu-latest - steps: - - uses: shopware/github-actions/setup-extension@main + phpunit: + name: PHPUnit + uses: ./.github/workflows/action-phpunit.yml with: - extensionName: ${{ github.event.repository.name }} - install: true - install-admin: true - install-storefront: true - extraRepositories: | - { - "${{ github.event.repository.name }}": { - "type": "path", - "url": "custom/plugins/${{ github.event.repository.name }}", - "symlink": true - } - } - - name: Uninstall Plugin - run: php bin/console plugin:uninstall ${{ github.event.repository.name }} + extension_name: ${{ github.event.repository.name }} + platform_branch: trunk + + smoke_test: + name: Smoke test + runs-on: ubuntu-latest + steps: + - name: Setup extension + uses: shopware/github-actions/setup-extension@main + with: + extensionName: ${{ env.EXTENSION_NAME }} + install: true + install-admin: true + install-storefront: true + extraRepositories: | + { + "${{ env.EXTENSION_NAME }}": { + "type": "path", + "url": "custom/plugins/${{ env.EXTENSION_NAME }}", + "symlink": true + } + } + + - name: Uninstall Plugin + run: php bin/console plugin:uninstall ${{ env.EXTENSION_NAME }} diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml new file mode 100644 index 000000000..6e001aff3 --- /dev/null +++ b/.github/workflows/nightly.yaml @@ -0,0 +1,103 @@ +name: Nightly + +on: + schedule: + - cron: '0 1 * * *' + workflow_dispatch: + +concurrency: + group: nightly-${{ github.ref }} + cancel-in-progress: false + +jobs: + phpstan: + name: PHPStan + uses: ./.github/workflows/action-phpstan.yml + with: + extension_name: ${{ github.event.repository.name }} + + phpunit: + name: PHPUnit + uses: ./.github/workflows/action-phpunit.yml + with: + extension_name: ${{ github.event.repository.name }} + platform_branch: trunk + + jest: + name: Jest + uses: ./.github/workflows/action-jest.yml + with: + extension_name: ${{ github.event.repository.name }} + + acceptance: + name: Playwright + uses: ./.github/workflows/action-acceptance.yml + with: + extension_name: ${{ github.event.repository.name }} + platform_branch: trunk + update_snapshots: false + + notify_slack_on_schedule_failure: + name: Slack Notify + runs-on: ubuntu-latest + needs: + - phpstan + - phpunit + - jest + - acceptance + if: >- + ${{ + always() && + github.event_name == 'schedule' && + ( + needs.phpstan.result == 'failure' || + needs.phpunit.result == 'failure' || + needs.jest.result == 'failure' || + needs.acceptance.result == 'failure' + ) + }} + steps: + - name: Notify Slack + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + RUN_ID: ${{ github.run_id }} + REPOSITORY: ${{ github.repository }} + BRANCH: ${{ github.ref_name }} + PHPSTAN_RESULT: ${{ needs.phpstan.result }} + PHPUNIT_RESULT: ${{ needs.phpunit.result }} + JEST_RESULT: ${{ needs.jest.result }} + ACCEPTANCE_RESULT: ${{ needs.acceptance.result }} + run: | + set -euo pipefail + + failed_jobs=() + + [ "$PHPSTAN_RESULT" = "failure" ] && failed_jobs+=("PHPStan") + [ "$PHPUNIT_RESULT" = "failure" ] && failed_jobs+=("PHPUnit") + [ "$JEST_RESULT" = "failure" ] && failed_jobs+=("Jest") + [ "$ACCEPTANCE_RESULT" = "failure" ] && failed_jobs+=("Playwright") + + failed_jobs_list=$(printf -- '- %s\n' "${failed_jobs[@]}") + failed_jobs_list=${failed_jobs_list%$'\n'} + + payload=$( + jq -nc \ + --arg repository "$REPOSITORY" \ + --arg branch "$BRANCH" \ + --arg run_id "$RUN_ID" \ + --arg failed_jobs_list "$failed_jobs_list" \ + --arg run_url "$RUN_URL" \ + '{ + repository: $repository, + branch: $branch, + run_id: $run_id, + failed_jobs_list: $failed_jobs_list, + run_url: $run_url + }' + ) + + curl -fsSL -X POST \ + -H 'Content-type: application/json' \ + --data "$payload" \ + "$SLACK_WEBHOOK_URL" diff --git a/.github/workflows/php.yaml b/.github/workflows/php.yaml index 0d6b20ca2..25e13e53f 100644 --- a/.github/workflows/php.yaml +++ b/.github/workflows/php.yaml @@ -1,62 +1,32 @@ name: PHP Checks on: - workflow_dispatch: - push: - branches: - - trunk - pull_request: - paths: - - composer.json - - src/**/*.php - - tests/**/*.php - - .github/workflows/php.yml + workflow_dispatch: + push: + branches: + - trunk + pull_request: + paths: + - composer.json + - src/**/*.php + - tests/**/*.php + - .github/workflows/** + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true jobs: - codestyle_php: - name: Codestyle PHP - runs-on: ubuntu-latest - steps: - - uses: shopware/github-actions/cs-fixer@main - with: - rules: "" + codestyle_php: + name: Codestyle PHP + runs-on: ubuntu-latest + steps: + - uses: shopware/github-actions/cs-fixer@main + with: + rules: '' - phpstan: - runs-on: ubuntu-latest - steps: - - uses: shopware/github-actions/setup-extension@main - env: - DATABASE_URL: mysql://root@127.0.0.1/shopware - with: - extensionName: ${{ github.event.repository.name }} - install: true - install-admin: true - install-storefront: true - extraRepositories: | - { - "${{ github.event.repository.name }}": { - "type": "path", - "url": "custom/plugins/${{ github.event.repository.name }}", - "symlink": true - } - } - - name: Create phpstan.neon - working-directory: custom/plugins/${{ github.event.repository.name }} - shell: bash - run: | - printf "parameters:\n tmpDir: ${GITHUB_WORKSPACE}/var/phpstan\nincludes:\n - phpstan.neon.dist" > phpstan.neon - - name: PHPStan cache - uses: actions/cache@v4 + phpstan: + name: PHPStan + uses: ./.github/workflows/action-phpstan.yml with: - path: ${{ github.workspace }}/var/phpstan - key: ${{ runner.OS }}-${{ github.repository }}-phpstan-${{ github.sha }} - restore-keys: | - ${{ runner.OS }}-${{ github.repository }}-phpstan- - - name: Build PHPStan Bootstrap - shell: bash - run: php ${GITHUB_WORKSPACE}/src/Core/DevOps/StaticAnalyze/phpstan-bootstrap.php - - name: Run PHPStan - shell: bash - run: | - composer -d custom/plugins/${{ github.event.repository.name }} dump-autoload --dev - composer -d custom/plugins/${{ github.event.repository.name }} run phpstan + extension_name: ${{ github.event.repository.name }} diff --git a/.github/workflows/reactivate-workflows.yml b/.github/workflows/reactivate-workflows.yml new file mode 100644 index 000000000..9f49c8668 --- /dev/null +++ b/.github/workflows/reactivate-workflows.yml @@ -0,0 +1,24 @@ +name: Reactivate Workflows + +on: + schedule: + - cron: '0 0 1 * *' + workflow_dispatch: + +permissions: + actions: write + +jobs: + reactivate_workflow: + name: Reactivate Workflow + runs-on: ubuntu-latest + strategy: + matrix: + WORKFLOW: ['nightly.yaml', 'reactivate-workflows.yml'] + steps: + - name: Reactivate workflow + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + shell: bash + run: gh workflow enable "${{ matrix.WORKFLOW }}" diff --git a/.github/workflows/store-release.yml b/.github/workflows/store-release.yml index e93b261a4..3d532dd38 100644 --- a/.github/workflows/store-release.yml +++ b/.github/workflows/store-release.yml @@ -1,12 +1,12 @@ name: Release to Store on: - workflow_dispatch: + workflow_dispatch: jobs: - build: - uses: shopware/github-actions/.github/workflows/store-release.yml@main - with: - extensionName: ${{ github.event.repository.name }} - secrets: - clientId: ${{ secrets.SHOPWARE_CLI_ACCOUNT_CLIENT_ID }} - clientSecret: ${{ secrets.SHOPWARE_CLI_ACCOUNT_CLIENT_SECRET }} - ghToken: ${{ secrets.GITHUB_TOKEN }} + build: + uses: shopware/github-actions/.github/workflows/store-release.yml@main + with: + extensionName: ${{ github.event.repository.name }} + secrets: + clientId: ${{ secrets.SHOPWARE_CLI_ACCOUNT_CLIENT_ID }} + clientSecret: ${{ secrets.SHOPWARE_CLI_ACCOUNT_CLIENT_SECRET }} + ghToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/composer.json b/composer.json index 0ae6668b5..572def163 100644 --- a/composer.json +++ b/composer.json @@ -87,6 +87,8 @@ ], "format:md": "@npm:admin run format:md", "format:md:fix": "@npm:admin run format:md:fix", + "format:yml": "@npm:admin run format:yml", + "format:yml:fix": "@npm:admin run format:yml:fix", "admin:unit": "@npm:jest run unit", "admin:unit:watch": "@npm:jest run unit-watch", "admin:acceptance": "@npm:acceptance run test", diff --git a/src/Resources/app/administration/package.json b/src/Resources/app/administration/package.json index 59b536ea9..17f2cd6ed 100644 --- a/src/Resources/app/administration/package.json +++ b/src/Resources/app/administration/package.json @@ -11,7 +11,9 @@ "format": "npx prettier --check \"src/**/*.{js,ts}\" --config ../../../../.prettierrc.json --cache", "format:fix": "npx prettier --write \"src/**/*.{js,ts}\" --config ../../../../.prettierrc.json --cache", "format:md": "npx prettier --check \"../../../../*.md\" --config ../../../../.prettierrc.json --cache", - "format:md:fix": "npx prettier --write \"../../../../*.md\" --config ../../../../.prettierrc.json --cache" + "format:md:fix": "npx prettier --write \"../../../../*.md\" --config ../../../../.prettierrc.json --cache", + "format:yml": "npx prettier --check \"../../../../.github/**/*.{yml,yaml}\" --config ../../../../.prettierrc.json --cache", + "format:yml:fix": "npx prettier --write \"../../../../.github/**/*.{yml,yaml}\" --config ../../../../.prettierrc.json --cache" }, "devDependencies": { "@eslint/js": "9.39.3", diff --git a/tests/Jest/package-lock.json b/tests/Jest/package-lock.json index a03e13c2f..d993f38fc 100644 --- a/tests/Jest/package-lock.json +++ b/tests/Jest/package-lock.json @@ -27,6 +27,7 @@ "jest": "30.2.0", "jest-environment-jsdom": "30.2.0", "jest-junit": "15.0.0", + "picomatch": "4.0.4", "prettier": "3.6.2", "prettier-plugin-multiline-arrays": "3.0.6", "typescript": "5.7.3" @@ -3262,6 +3263,19 @@ "node": ">= 10.13.0" } }, + "node_modules/@shopware-ag/jest-preset-sw6-admin/node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/@shopware-ag/jest-preset-sw6-admin/node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", @@ -4134,6 +4148,19 @@ "node": ">= 8" } }, + "node_modules/anymatch/node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -7153,19 +7180,6 @@ "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, - "node_modules/jest-util/node_modules/picomatch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", - "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, "node_modules/jest-validate": { "version": "30.2.0", "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-30.2.0.tgz", @@ -7743,6 +7757,19 @@ "node": ">=8.6" } }, + "node_modules/micromatch/node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -8151,13 +8178,13 @@ "license": "ISC" }, "node_modules/picomatch": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", - "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", + "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", "dev": true, "license": "MIT", "engines": { - "node": ">=8.6" + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/jonschlinkert" @@ -8867,19 +8894,6 @@ "url": "https://github.com/sponsors/SuperchupuDev" } }, - "node_modules/tinyglobby/node_modules/picomatch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", - "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, "node_modules/tldts": { "version": "6.1.86", "resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.86.tgz", diff --git a/tests/Jest/package.json b/tests/Jest/package.json index ba71bdf71..af728745a 100644 --- a/tests/Jest/package.json +++ b/tests/Jest/package.json @@ -29,6 +29,7 @@ "jest": "30.2.0", "jest-environment-jsdom": "30.2.0", "jest-junit": "15.0.0", + "picomatch": "4.0.4", "prettier": "3.6.2", "prettier-plugin-multiline-arrays": "3.0.6", "typescript": "5.7.3",