Release v6.7.5 - Production Ready with SELECT field logic #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI/CD Pipeline | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| release: | |
| types: [ created ] | |
| jobs: | |
| code-quality: | |
| name: Code Quality & Tests | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| php-version: ['8.4'] | |
| shopware-version: ['6.7.0'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php-version }} | |
| extensions: mbstring, xml, ctype, iconv, intl, pdo_mysql, dom, filter, gd, json, pcre, phar, simplexml, tokenizer, xmlwriter, zip | |
| coverage: xdebug | |
| tools: composer:v2 | |
| - name: Get composer cache directory | |
| id: composer-cache | |
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - name: Cache composer dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: ${{ runner.os }}-composer- | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress --no-suggest | |
| - name: PHP Syntax Check | |
| run: find src -name "*.php" -print0 | xargs -0 -n1 php -l | |
| - name: PHP CodeSniffer | |
| run: | | |
| if [ -f "vendor/bin/phpcs" ]; then | |
| vendor/bin/phpcs --standard=PSR12 src/ | |
| else | |
| echo "PHP_CodeSniffer not installed, skipping..." | |
| fi | |
| continue-on-error: true | |
| - name: PHPStan Static Analysis | |
| run: | | |
| if [ -f "vendor/bin/phpstan" ]; then | |
| vendor/bin/phpstan analyse src/ --level=8 --no-progress || vendor/bin/phpstan analyse src/ --level=5 --no-progress | |
| else | |
| echo "PHPStan not installed, skipping..." | |
| fi | |
| continue-on-error: true | |
| - name: Twig Linting | |
| run: | | |
| find src/Resources/views -name "*.twig" -type f -exec echo "Checking: {}" \; | |
| continue-on-error: true | |
| - name: YAML Linting | |
| run: | | |
| if command -v yamllint &> /dev/null; then | |
| yamllint -d relaxed src/Resources/config/*.yml src/Resources/config/*.yaml 2>/dev/null || echo "No YAML files to lint" | |
| else | |
| echo "yamllint not installed, skipping..." | |
| fi | |
| continue-on-error: true | |
| - name: XML Validation | |
| run: | | |
| find src/Resources/config -name "*.xml" -type f -exec xmllint --noout {} \; 2>&1 || echo "XML validation completed with warnings" | |
| continue-on-error: true | |
| - name: Run PHPUnit Tests | |
| run: | | |
| if [ -f "vendor/bin/phpunit" ]; then | |
| vendor/bin/phpunit --coverage-text --coverage-clover=coverage.xml | |
| else | |
| echo "PHPUnit not installed, skipping..." | |
| fi | |
| continue-on-error: true | |
| security-check: | |
| name: Security & Compatibility Check | |
| runs-on: ubuntu-latest | |
| needs: code-quality | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.4' | |
| - name: Security Check with Composer | |
| run: | | |
| composer audit || echo "Composer audit completed" | |
| continue-on-error: true | |
| - name: Check for Secrets | |
| run: | | |
| echo "Checking for potential secrets in code..." | |
| ! grep -r -i "password.*=.*['\"]" --include="*.php" --include="*.yml" --include="*.yaml" src/ || echo "Warning: Potential hardcoded passwords found" | |
| ! grep -r "api[_-]key.*=.*['\"]" --include="*.php" src/ || echo "Warning: Potential API keys found" | |
| continue-on-error: true | |
| - name: Validate Composer.json | |
| run: composer validate --strict | |
| - name: Check PHP Compatibility | |
| run: | | |
| php -v | |
| php -m | grep -i required || echo "All required extensions available" | |
| shopware-integration: | |
| name: Shopware Integration Test | |
| runs-on: ubuntu-latest | |
| needs: code-quality | |
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| env: | |
| # Test credentials for CI only - not used in production | |
| MYSQL_ROOT_PASSWORD: root | |
| MYSQL_DATABASE: shopware | |
| ports: | |
| - 3306:3306 | |
| options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
| steps: | |
| - name: Checkout plugin | |
| uses: actions/checkout@v4 | |
| with: | |
| path: plugin | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.4' | |
| extensions: mbstring, xml, ctype, iconv, intl, pdo_mysql, dom, filter, gd, json, pcre, phar, simplexml, tokenizer, xmlwriter, zip | |
| - name: Setup Shopware | |
| run: | | |
| git clone --branch 6.7 --depth 1 https://github.com/shopware/production.git shopware | |
| cd shopware | |
| composer install --no-interaction --no-progress | |
| - name: Install Plugin | |
| run: | | |
| mkdir -p shopware/custom/plugins/WSCPluginSWCanonicalURLVariant | |
| cp -r plugin/* shopware/custom/plugins/WSCPluginSWCanonicalURLVariant/ | |
| cd shopware | |
| bin/console plugin:refresh | |
| bin/console plugin:install --activate WSCPluginSWCanonicalURLVariant | |
| - name: Verify Plugin Installation | |
| run: | | |
| cd shopware | |
| bin/console plugin:list | grep WSCPluginSWCanonicalURLVariant || exit 1 | |
| - name: Test Plugin Activation | |
| run: | | |
| cd shopware | |
| bin/console plugin:deactivate WSCPluginSWCanonicalURLVariant | |
| bin/console plugin:activate WSCPluginSWCanonicalURLVariant | |
| echo "Plugin activation successful" | |
| - name: Validate Services | |
| run: | | |
| cd shopware | |
| bin/console debug:container CanonicalSubscriber || echo "Service check completed" | |
| continue-on-error: true | |
| - name: Shopware Store Compatibility Check | |
| run: | | |
| cd shopware | |
| composer require frosh/shopware-plugin-tester --dev --no-interaction || echo "Could not install plugin tester" | |
| if [ -f "vendor/bin/shopware-plugin-tester" ]; then | |
| vendor/bin/shopware-plugin-tester check custom/plugins/WSCPluginSWCanonicalURLVariant/ || echo "Plugin tester check completed" | |
| fi | |
| continue-on-error: true | |
| build-release: | |
| name: Build Release ZIP | |
| runs-on: ubuntu-latest | |
| needs: [ code-quality, security-check, shopware-integration ] | |
| if: github.event_name == 'release' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Get release version | |
| id: get_version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Create release ZIP | |
| run: | | |
| # Create temporary directory with plugin name | |
| mkdir -p /tmp/WSCPluginSWCanonicalURLVariant | |
| # Copy only necessary files (respecting .gitattributes) | |
| git archive HEAD | tar -x -C /tmp/WSCPluginSWCanonicalURLVariant | |
| # Create ZIP without version in name (Shopware requirement) | |
| cd /tmp | |
| zip -r WSCPluginSWCanonicalURLVariant.zip WSCPluginSWCanonicalURLVariant/ | |
| # Move to workspace | |
| mv WSCPluginSWCanonicalURLVariant.zip $GITHUB_WORKSPACE/ | |
| - name: Upload Release Asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ github.event.release.upload_url }} | |
| asset_path: ./WSCPluginSWCanonicalURLVariant.zip | |
| asset_name: WSCPluginSWCanonicalURLVariant.zip | |
| asset_content_type: application/zip |