Skip to content

PHP checks

PHP checks #41

Workflow file for this run

name: PHP checks
on:
pull_request:
workflow_dispatch:
workflow_call:
env:
COMPOSER_ROOT_VERSION: 6.6.9999999.9999999
jobs:
# lint:
# runs-on: ubuntu-24.04
# name: "PHP lint"
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Setup PHP
# uses: shivammathur/setup-php@v2
# with:
# php-version: 8.2
# extensions: ""
# tools: symfony-cli
# - name: Debug
# run: |
# cat composer.json
# composer validate --no-check-publish --no-check-lock
# - uses: "ramsey/composer-install@v3"
# with:
# custom-cache-key: ${{ runner.os }}-setup-shopware-composer-8.2-${{ hashFiles('composer.json', 'custom/plugins/**/composer.json') }}
# working-directory: ""
# - name: Setup Shopware
# uses: shopware/setup-shopware@main
# with:
# shopware-version: ${{ github.ref }}
# shopware-repository: ${{ github.repository }}
# - name: Cache CS Fixer
# uses: actions/cache@v4
# with:
# path: ./var/cache/cs_fixer
# key: ${{ runner.os }}-cs-fixer-${{ hashFiles('composer.json') }}
# restore-keys: |
# ${{ runner.os }}-cs-fixer-
# - name: Code Style
# run: composer run ecs
# - name: Lint Changelogs
# run: composer run lint:changelog
# - name: Lint Snippets
# run: composer run lint:snippets
# phpstan:
# runs-on: ubuntu-24.04
# name: "PHPStan"
# steps:
# - name: Setup Shopware
# uses: shopware/setup-shopware@main
# with:
# shopware-version: ${{ github.ref }}
# shopware-repository: ${{ github.repository }}
# - name: Generate Schema
# run: composer run framework:schema:dump
# - name: "Restore result cache"
# uses: actions/cache/restore@v4
# with:
# path: var/cache/phpstan
# key: "phpstan-result-cache-${{ github.run_id }}"
# restore-keys: |
# phpstan-result-cache-
# - name: PHPStan
# run: composer run phpstan -- --error-format=github --no-progress
# - name: "Save result cache"
# uses: actions/cache/save@v4
# if: always()
# with:
# path: var/cache/phpstan
# key: "phpstan-result-cache-${{ github.run_id }}"
# bc-checker:
# runs-on: ubuntu-24.04
# name: "BC check"
# steps:
# - name: Clone shopware
# uses: actions/checkout@v4
# with:
# fetch-depth: "0"
# fetch-tags: "1"
# - name: Setup PHP
# uses: shivammathur/setup-php@v2
# with:
# php-version: "8.2"
# - name: Install Dependencies
# run: |
# composer install
# - name: Prepare repo
# run: |
# set -e
# git remote add bc-checker-upstream https://github.com/shopware/platform.git
# git fetch bc-checker-upstream
# - name: BC Checker lastest tag
# if: github.event_name != 'pull_request'
# run: composer run bc-check
# - name: BC Checker PR
# if: github.event_name == 'pull_request' && !contains(github.base_ref, '/feature/')
# run: composer run bc-check -- --from="origin/${{ github.base_ref }}"
# openapi-lint:
# runs-on: ubuntu-24.04
# env:
# APP_ENV: test
# APP_URL: http://localhost:8000
# APP_SECRET: def00000bb5acb32b54ff8ee130270586eec0e878f7337dc7a837acc31d3ff00f93a56b595448b4b29664847dd51991b3314ff65aeeeb761a133b0ec0e070433bff08e48
# DATABASE_HOST: "127.0.0.1"
# steps:
# - name: Setup Shopware
# uses: shopware/setup-shopware@main
# with:
# install: true
# shopware-version: ${{ github.ref }}
# shopware-repository: ${{ github.repository }}
# - name: Prepare schema lint
# env:
# NPM_CONFIG_PREFIX: ${{ github.workspace }}/var/cache/npm
# run: |
# echo "PATH=${{ env.NPM_CONFIG_PREFIX }}/bin:$PATH" >> $GITHUB_ENV
# curl localhost:8000/
# npm i -g @redocly/cli@latest @shopware/api-gen
# export STOREFRONT_ID=$(bin/console sales-channel:list --output json | jq -r '.[] | select(.name == "Storefront") | .id')
# export OPENAPI_ACCESS_KEY=$(mysql -u root -h 127.0.0.1 shopware -se "SELECT access_key FROM sales_channel WHERE id = UNHEX(\"${STOREFRONT_ID}\")";)
# echo -e "OPENAPI_JSON_URL=http://localhost:8000\nSHOPWARE_ADMIN_USERNAME=admin\nSHOPWARE_ADMIN_PASSWORD=shopware\nOPENAPI_ACCESS_KEY=${OPENAPI_ACCESS_KEY}" > .env
# cat .env
# - name: Generate & Lint OpenApi StoreAPI schema
# run: |
# api-gen generate --apiType=store && api-gen loadSchema --apiType=store
# redocly lint --skip-rule operation-4xx-response --skip-rule no-server-example.com --skip-rule no-unused-components ./api-types/storeApiSchema.json
# - name: Generate & Lint OpenApi API schema
# run: |
# api-gen generate --apiType=admin && api-gen loadSchema --apiType=admin
# redocly lint --skip-rule operation-4xx-response --skip-rule no-server-example.com --skip-rule no-unused-components ./api-types/adminApiSchema.json
# phpunit:
# name: "PHPUnit for ${{ matrix.suite }}"
# runs-on: ubuntu-24.04
# strategy:
# fail-fast: false
# matrix:
# suite:
# - unit
# - migration
# env:
# APP_ENV: test
# DATABASE_URL: mysql://[email protected]:3306/root
# APP_URL: http://localhost:8000
# APP_SECRET: def00000bb5acb32b54ff8ee130270586eec0e878f7337dc7a837acc31d3ff00f93a56b595448b4b29664847dd51991b3314ff65aeeeb761a133b0ec0e070433bff08e48
# OPENSEARCH_URL: 127.0.0.1:9200
# BLUE_GREEN_DEPLOYMENT: 1
# PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true"
# services:
# elasticsearch:
# image: ${{ matrix.suite == 'integration' && 'opensearchproject/opensearch:1' || 'alpine' }}
# env:
# discovery.type: single-node
# plugins.security.disabled: "true"
# ports:
# - "9200:9200"
# steps:
# - name: Setup Shopware
# uses: shopware/setup-shopware@main
# with:
# php-version: 8.4
# shopware-version: ${{ github.ref }}
# shopware-repository: ${{ github.repository }}
# - name: Start Webserver
# run: symfony server:start -d
# - name: Migration test suite setup
# if: ${{ matrix.suite == 'migration' }}
# run: |
# sed -i -e 's|<directory suffix=".php">src</directory>|<directory suffix=".php">src/Core/Migration</directory>|' phpunit.xml.dist
# echo "FEATURE_ALL=major" >> $GITHUB_ENV
# - name: Install Shopware
# run: php src/Core/TestBootstrap.php
# - name: Run PHPUnit with coverage
# run: php -d memory_limit=-1 vendor/bin/phpunit --testsuite "${{ matrix.suite }}" --coverage-cobertura coverage.xml
# - name: Upload coverage
# uses: codecov/codecov-action@v5
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# with:
# files: coverage.xml
# flags: phpunit-${{ matrix.suite }}
# license-check:
# runs-on: ubuntu-24.04
# name: "PHP license check"
# steps:
# - name: Setup Shopware
# uses: shopware/setup-shopware@main
# with:
# shopware-version: ${{ github.ref }}
# shopware-repository: ${{ github.repository }}
# - name: composer.json changed
# id: changed-composer-json
# uses: tj-actions/changed-files@v45
# with:
# files: composer.json
# - name: Check license
# if: steps.changed-composer-json.outputs.any_changed == 'true'
# run: vendor/bin/composer-license-checker check $(xargs -n1 echo -a < .allowed-licenses)
composer-audit:
runs-on: ubuntu-24.04
name: "composer audit"
steps:
- name: Clone shopware
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.2"
- name: Install Dependencies
run: |
composer install
- name: Composer audit
run: |
composer audit
php-check:
if: always()
needs:
# - lint
# - phpstan
# - openapi-lint
# - phpunit
# - license-check
- composer-audit
runs-on: Ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
# allowed-failures: docs, linters
# allowed-skips: non-voting-flaky-job
jobs: ${{ toJSON(needs) }}