ci: plugin-agnostic PR checks and package-then-release pipeline
- plugin-checks workflow: shopware-cli validate, package + built-JS assertion, phpunit - release: validate, package from the merge commit, validate the zip, create the release via the Gitea API, publish the same zip to the Composer registry - scripts/protect-main.sh sets required status checks via tea api - bump to 0.1.0 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8efaef2042
commit
a551034442
7 files changed
+212
-66
No files matched your search
@@ -0,0 +1,100 @@
|
||||
name: plugin-checks
|
||||
|
||||
# Plugin-agnostic: nothing below names this plugin. Name, version and paths come from composer.json.
|
||||
# shopware-cli is intentionally unpinned (latest); a red build after a CLI release means fix the config.
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.3'
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
- name: Install shopware-cli
|
||||
run: |
|
||||
curl -sL https://github.com/shopware/shopware-cli/releases/latest/download/shopware-cli_Linux_x86_64.tar.gz | tar -xz -C /tmp shopware-cli
|
||||
sudo install /tmp/shopware-cli /usr/local/bin/shopware-cli || install /tmp/shopware-cli /usr/local/bin/shopware-cli
|
||||
- name: Validate extension
|
||||
run: shopware-cli extension validate .
|
||||
|
||||
package:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
- name: Install shopware-cli
|
||||
run: |
|
||||
curl -sL https://github.com/shopware/shopware-cli/releases/latest/download/shopware-cli_Linux_x86_64.tar.gz | tar -xz -C /tmp shopware-cli
|
||||
sudo install /tmp/shopware-cli /usr/local/bin/shopware-cli || install /tmp/shopware-cli /usr/local/bin/shopware-cli
|
||||
- name: Package extension
|
||||
run: shopware-cli extension package . --output-directory .build --filename package.zip --git-commit "$GITHUB_SHA"
|
||||
- name: Validate packaged zip
|
||||
run: shopware-cli extension validate .build/package.zip
|
||||
- name: Assert built JS is in the zip
|
||||
run: |
|
||||
set -e
|
||||
LIST=$(unzip -Z1 .build/package.zip)
|
||||
if [ -f src/Resources/app/administration/src/main.js ] || [ -f src/Resources/app/administration/src/main.ts ]; then
|
||||
echo "$LIST" | grep -q 'Resources/public/administration/js/' || { echo "::error::admin entry exists but the zip has no built admin JS"; exit 1; }
|
||||
fi
|
||||
if [ -f src/Resources/app/storefront/src/main.js ] || [ -f src/Resources/app/storefront/src/main.ts ]; then
|
||||
echo "$LIST" | grep -q 'Resources/app/storefront/dist/' || { echo "::error::storefront entry exists but the zip has no built storefront JS"; exit 1; }
|
||||
fi
|
||||
|
||||
phpunit:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
database:
|
||||
image: mariadb:11.4
|
||||
env:
|
||||
MARIADB_ROOT_PASSWORD: root
|
||||
options: >-
|
||||
--health-cmd="healthcheck.sh --connect --innodb_initialized"
|
||||
--health-interval=5s --health-timeout=5s --health-retries=20
|
||||
env:
|
||||
DATABASE_URL: mysql://root:root@database:3306/shopware
|
||||
APP_ENV: test
|
||||
APP_URL: http://localhost
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
path: plugin-src
|
||||
- uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.3'
|
||||
extensions: gd, intl, pdo_mysql, zip, curl, mbstring, dom, xml, fileinfo, sodium, bcmath
|
||||
tools: composer
|
||||
- name: Resolve plugin name
|
||||
run: |
|
||||
# plugin directory name = short class name of extra.shopware-plugin-class
|
||||
CLASS=$(jq -r '.extra["shopware-plugin-class"]' plugin-src/composer.json)
|
||||
echo "PLUGIN_NAME=${CLASS##*\\}" >> "$GITHUB_ENV"
|
||||
- name: Create Shopware 6.6 project
|
||||
run: composer create-project shopware/production:6.6.* shopware --no-interaction --no-scripts
|
||||
- name: Install Shopware and the plugin
|
||||
working-directory: shopware
|
||||
run: |
|
||||
set -e
|
||||
composer require --dev phpunit/phpunit:^10 --no-interaction
|
||||
bin/console system:install --basic-setup --create-database --force --no-interaction
|
||||
cp -r ../plugin-src "custom/plugins/${PLUGIN_NAME}"
|
||||
bin/console plugin:refresh
|
||||
bin/console plugin:install --activate "${PLUGIN_NAME}"
|
||||
- name: Run phpunit
|
||||
working-directory: shopware
|
||||
run: vendor/bin/phpunit -c "custom/plugins/${PLUGIN_NAME}/phpunit.xml"
|
||||
Reference in new issue
Block a user