fix(release): repack zip root-level for the Composer registry #14

Merged
haylan merged 10 commits from fix/release-registry-zip into main 2026-10-03 23:21:08 +00:00
2 changed files with 66 additions and 26 deletions
Showing only changes of commit 18844718d2 - Show all commits

No files matched your search

+61 -23
View File
@@ -98,28 +98,41 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
path: plugin-src path: plugin-src
- name: Month stamp (refreshes the cached project monthly) # The cache key follows the Shopware version: a new 6.6.x release changes the key, so the old
id: stamp # project + database are never reused. Bump -v1 to force a refresh by hand.
run: echo "month=$(date +%Y-%m)" >> "$GITHUB_OUTPUT" - name: Resolve the latest Shopware 6.6 version
# The project (incl. vendor/ and phpunit) does not depend on the plugin, so it is cached on its own. id: sw
- name: Restore prepared Shopware project run: |
id: project VERSION=$(php -r '
$all = json_decode(file_get_contents("https://repo.packagist.org/p2/shopware/production.json"), true)["packages"]["shopware/production"];
$v = [];
foreach ($all as $p) { if (preg_match("/^6\.6\.\d+(\.\d+)*$/", $p["version"])) { $v[] = $p["version"]; } }
usort($v, "version_compare");
echo end($v);')
test -n "$VERSION" || { echo "::error::could not resolve the Shopware 6.6 version"; exit 1; }
echo "Shopware ${VERSION}"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
# Project (vendor/, phpunit, config) and the installed database as a SQL dump. Neither depends on the plugin.
- name: Restore Shopware project and database
id: shopware
uses: actions/cache/restore@v4 uses: actions/cache/restore@v4
with: with:
path: shopware path: |
key: shopware-6.6-prepared-${{ steps.stamp.outputs.month }} shopware
- name: Create Shopware 6.6 project !shopware/var/cache
if: steps.project.outputs.cache-hit != 'true' !shopware/var/log
shopware-db.sql.gz
key: shopware-${{ steps.sw.outputs.version }}-installed-v1
- name: Create Shopware project
if: steps.shopware.outputs.cache-hit != 'true'
run: | run: |
set -e set -e
composer create-project shopware/production:6.6.* shopware --no-interaction --no-scripts composer create-project "shopware/production:${{ steps.sw.outputs.version }}" shopware --no-interaction --no-scripts
composer require --dev phpunit/phpunit:^10 --no-interaction --no-scripts -d shopware composer require --dev phpunit/phpunit:^10 --no-interaction --no-scripts -d shopware
- name: Save prepared Shopware project - name: Ensure the MariaDB client
if: steps.project.outputs.cache-hit != 'true' run: |
uses: actions/cache/save@v4 command -v mariadb-dump >/dev/null || command -v mysqldump >/dev/null && exit 0
with: (apt-get update -q && apt-get install -y -q --no-install-recommends mariadb-client) || apk add --no-cache mariadb-client
path: shopware
key: shopware-6.6-prepared-${{ steps.stamp.outputs.month }}
- name: Wait for the database - name: Wait for the database
run: | run: |
for i in $(seq 60); do for i in $(seq 60); do
@@ -127,9 +140,39 @@ jobs:
sleep 2 sleep 2
done done
echo "::error::database service did not come up"; exit 1 echo "::error::database service did not come up"; exit 1
- name: Relax database durability (throwaway CI database, speeds up the migrations) - name: Relax database durability (throwaway CI database, speeds up the install and the restore)
run: | run: |
php -r '$p = new PDO("mysql:host=database;port=3306", "root", "root"); $p->exec("SET GLOBAL innodb_flush_log_at_trx_commit=0"); $p->exec("SET GLOBAL sync_binlog=0");' php -r '$p = new PDO("mysql:host=database;port=3306", "root", "root"); $p->exec("SET GLOBAL innodb_flush_log_at_trx_commit=0"); $p->exec("SET GLOBAL sync_binlog=0");'
# One install into shopware_test; the bootstrapper then sees an installed DB, skips its own install and
# only activates the plugin (tests/TestBootstrap.php forces plugin installation).
- name: Install Shopware
if: steps.shopware.outputs.cache-hit != 'true'
working-directory: shopware
run: bin/console system:install --basic-setup --create-database --force --no-interaction
- name: Dump the installed database
if: steps.shopware.outputs.cache-hit != 'true'
run: |
set -e
DUMP=$(command -v mariadb-dump || command -v mysqldump)
"$DUMP" -h database -P 3306 -u root -proot --skip-ssl --single-transaction --routines --triggers \
--databases shopware_test | gzip > shopware-db.sql.gz
ls -l shopware-db.sql.gz
- name: Save Shopware project and database
if: steps.shopware.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
shopware
!shopware/var/cache
!shopware/var/log
shopware-db.sql.gz
key: shopware-${{ steps.sw.outputs.version }}-installed-v1
- name: Restore the database from the cache
if: steps.shopware.outputs.cache-hit == 'true'
run: |
set -e
CLIENT=$(command -v mariadb || command -v mysql)
gunzip -c shopware-db.sql.gz | "$CLIENT" -h database -P 3306 -u root -proot --skip-ssl
- name: Resolve plugin name and install the plugin sources - name: Resolve plugin name and install the plugin sources
run: | run: |
# plugin directory name = short class name of extra.shopware-plugin-class # plugin directory name = short class name of extra.shopware-plugin-class
@@ -138,11 +181,6 @@ jobs:
echo "PLUGIN_NAME=${PLUGIN_NAME}" >> "$GITHUB_ENV" echo "PLUGIN_NAME=${PLUGIN_NAME}" >> "$GITHUB_ENV"
rm -rf "shopware/custom/plugins/${PLUGIN_NAME}" rm -rf "shopware/custom/plugins/${PLUGIN_NAME}"
cp -r plugin-src "shopware/custom/plugins/${PLUGIN_NAME}" cp -r plugin-src "shopware/custom/plugins/${PLUGIN_NAME}"
# One install into shopware_test; the bootstrapper sees an installed DB, skips its own install and
# only activates the plugin (tests/TestBootstrap.php forces plugin installation).
- name: Install Shopware (once)
working-directory: shopware
run: bin/console system:install --basic-setup --create-database --force --no-interaction
- name: Run phpunit - name: Run phpunit
working-directory: shopware working-directory: shopware
run: vendor/bin/phpunit -c "custom/plugins/${PLUGIN_NAME}/phpunit.xml" run: vendor/bin/phpunit -c "custom/plugins/${PLUGIN_NAME}/phpunit.xml"
+5 -3
View File
@@ -53,9 +53,11 @@ activates this plugin inside a real Shopware kernel for the test run (`KERNEL_CL
`Shopware\Core\Kernel` in `phpunit.xml`). This means tests require a working Shopware installation/DB `Shopware\Core\Kernel` in `phpunit.xml`). This means tests require a working Shopware installation/DB
to bootstrap against — they are not runnable as an isolated PHP package. to bootstrap against — they are not runnable as an isolated PHP package.
In CI (`phpunit` job) a Shopware 6.6 project is prepared once (`composer create-project` + phpunit, In CI (`phpunit` job) the latest Shopware 6.6 version is resolved from Packagist and the prepared project
cached monthly), the plugin is copied into `custom/plugins`, and `system:install` runs once into (`composer create-project` + phpunit, then `system:install` into `shopware_test` on a MariaDB 10.11 service)
`shopware_test` (MariaDB 10.11 service), so the bootstrapper only activates the plugin. plus a SQL dump of the installed database are cached under a key that contains that version, so a new
Shopware release invalidates the cache. On a hit the dump is restored instead of reinstalling; the plugin
is then copied into `custom/plugins` and the bootstrapper only activates it.
```bash ```bash
vendor/bin/phpunit # full suite vendor/bin/phpunit # full suite