Automating your Shopware development workflow is no longer a luxury—it’s an operational necessity. With Shopware 6.7 introducing stricter PHP requirements, enhanced CLI tooling, and optimized asset compilation pipelines, configuring a reliable continuous integration and delivery (CI/CD) pipeline has become both more critical and more straightforward. GitLab offers a robust, native CI/CD engine that integrates seamlessly with modern e-commerce architectures. In this guide, we’ll walk through how to configure a production-ready GitLab CI/CD pipeline tailored specifically for Shopware 6.7 and beyond.

Why GitLab for Shopware?

GitLab CI/CD provides built-in runners, environment management, secret handling, and deployment triggers—all without external tools. For Shopware 6.7, which relies heavily on Composer, PHP 8.2/8.3 compatibility, and optimized front-end asset pipelines, GitLab’s caching system and parallel execution capabilities significantly reduce build times while maintaining code quality.

Prerequisites

Before diving into the configuration, ensure you have:

  • A GitLab project with your Shopware 6.7 repository
  • PHP 8.2 or 8.3 installed on your CI runner (or use official images)
  • Composer 2.x configured globally or within the pipeline
  • Required environment variables stored in GitLab CI/CD Variables (DB_URL, APP_SECRET, DEPLOY_HOST, etc.)
  • SSH keys or deploy tokens for production access

The Core Pipeline Structure

A well-structured Shopware CI/CD pipeline typically follows five stages: linting, dependency resolution, testing, asset compilation, and deployment. Let’s examine a complete .gitlab-ci.yml configuration designed for Shopware 6.7+.

image: composer:2.8-php8.3

variables:
  COMPOSER_HOME: /composer
  COMPOSER_CACHE_DIR: /composer/cache
  SHOPWARE_ENV: "prod"

stages:
  - lint
  - composer-install
  - test
  - build
  - deploy

# 1. Static Analysis & Linting
php-lint:
  stage: lint
  script:
    - composer install --prefer-dist --no-scripts
    - bin/php-cs-fixer fix --dry-run --diff
    - bin/adminer-lint

# 2. Composer Dependency Resolution with Caching
composer-install:
  stage: composer-install
  cache:
    key: ${CI_COMMIT_REF_SLUG}
    paths:
      - vendor/
      - /composer/cache/
  script:
    - composer install --optimize-autoloader --no-dev

# 3. PHPUnit & Functional Testing
test:
  stage: test
  image: php:8.3-alpine
  cache:
    key: ${CI_COMMIT_REF_SLUG}
    paths:
      - vendor/
  services:
    - mysql:8.0
  variables:
    MYSQL_ROOT_PASSWORD: root
    MYSQL_DATABASE: shopware_test
  script:
    - apk add --no-cache git bash
    - composer require --dev phpunit/phpunit symfony/dom-crawler symfony/css-browser
    - bin/prepare
    - bin/phpunit --configuration phpunit.xml.dist
    - bin/mink --configuration mink.yml

# 4. Asset Compilation (Shopware 6.7+ Optimized)
build:
  stage: build
  needs: [composer-install]
  script:
    - bin/build-js.sh
    - bin/download-and-minify.sh
    - bin/build-administration.sh
    - composer dump-env prod
    - find var/cache -type d -empty -delete

# 5. Deployment (Staging to Production)
deploy-production:
  stage: deploy
  needs: [build]
  rules:
    - if: '$CI_COMMIT_BRANCH == "main"'
      when: manual
  variables:
    SSH_KNOWN_HOSTS: ""
  script:
    - echo "$DEPLOY_KEY" | base64 -d > deploy_key
    - chmod 600 deploy_key
    - rsync -avz --delete -e "ssh -i deploy_key -o StrictHostKeyChecking=no" ./ $DEPLOY_HOST:/var/www/shopware/
    - ssh -i deploy_key -o StrictHostKeyChecking=no $DEPLOY_HOST "cd /var/www/shopware && bin/console cache:warmup && bin/console database:migrate --all && bin/console theme:compile --all"

Understanding the Pipeline Breakdown

Caching Strategy: Shopware 6.7’s dependency tree can be large. By caching vendor/ and /composer/cache/ based on ${CI_COMMIT_REF_SLUG}, you avoid redundant downloads while ensuring dependencies stay in sync across pipeline runs. The COMPOSER_HOME variable prevents permission conflicts on shared runners.

Linting & Code Quality: Shopware 6.7 enforces stricter PHP standards. Running php-cs-fixer in dry-run mode catches formatting violations early, preventing broken deployments. The pipeline also checks for deprecated syntax that might fail under PHP 8.3’s stricter type enforcement and attribute resolution.

Testing Stage: Modern Shopware projects require both unit and functional testing. By spinning up a temporary MySQL service and running bin/phpunit alongside bin/mink, you validate business logic, checkout flows, and plugin compatibility before code reaches production. Note that Shopware 6.7 shifts toward Symfony 7 compatibility, so test configurations may need minor tweaks regarding mock handling and container dumping.

Asset Compilation: The frontend build pipeline in Shopware 6.7 has been streamlined around modern CLI workflows. Scripts like bin/build-js.sh and bin/download-and-minify.sh handle Babel compilation, asset optimization, and theme regeneration. The pipeline explicitly clears temporary cache directories to prevent stale JavaScript bundles from serving in production.

Deployment Logic: Using GitLab’s rules keyword for manual triggers on the main branch prevents accidental deployments. The script securely injects a deploy key via base64-encoded CI variables, syncs files via rsync, and executes Shopware CLI commands for cache warming, database migrations, and theme compilation. For larger setups, consider replacing rsync with deployment tools like Deployer or GitLab’s native Docker runners.

Best Practices for Shopware 6.7 + GitLab

  • Environment Isolation: Never store credentials in your repository. Use GitLab CI/CD Variables with masking and protection flags.
  • PHP Version Alignment: Ensure your runner matches your composer.json PHP requirement. Mismatches cause silent failures during autoloading or plugin installation.
  • Cache Invalidation: Clear caches strategically. Shopware 6.7’s dependency injection container is highly optimized; improper cache clearing can break service definitions.
  • Pipeline Parallelization: Use GitLab’s parallel keyword for plugin-specific tests to speed up large storefront configurations.
  • Security Updates: Automate dependency checks with tools like composer audit and schedule weekly pipeline runs for maintenance branches.

Final Thoughts

Setting up a Shopware 6.7 CI/CD pipeline with GitLab transforms how you manage updates, rollbacks, and feature releases. By leveraging native caching, environment isolation, and Shopware’s modern CLI ecosystem, you reduce deployment friction while maintaining storefront stability. Start with this baseline configuration, adapt it to your plugin architecture, and gradually automate staging approvals before enabling full production triggers.

For deeper customization, explore GitLab’s runner registration guides, Shopware 6.7’s deployment documentation, and Symfony’s PHP testing best practices. Happy automating!