Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 21 additions & 89 deletions .github/workflows/acceptance.yaml
Original file line number Diff line number Diff line change
@@ -1,95 +1,27 @@
name: Acceptance

on:
schedule:
- cron: '0 3 * * *' # nightly at 3 am utc
workflow_dispatch:
inputs:
update_snapshots:
description: 'Update snapshots'
required: false
type: boolean
default: false
push:
branches:
- trunk
pull_request:
workflow_dispatch:
inputs:
update_snapshots:
description: Update snapshots
required: false
type: boolean
default: false
push:
branches:
- trunk
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
playwright:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
PLATFORM_BRANCH: ["trunk"]
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: shopware
ports:
- 3306:3306
env:
DATABASE_URL: mysql://root:root@127.0.0.1:3306/shopware

steps:
- uses: shopware/github-actions/setup-extension@main
with:
extensionName: ${{ github.event.repository.name }}
shopwareVersion: ${{ matrix.PLATFORM_BRANCH }}
install: true
install-admin: true
install-storefront: false
mysqlVersion: skip
env: prod
extraRepositories: |
{
"${{ github.event.repository.name }}": {
"type": "path",
"url": "custom/plugins/${{ github.event.repository.name }}",
"symlink": true
}
}

- name: Setup Migration Assistant
run: |
composer run build:js:admin
cd custom/plugins/${{ github.event.repository.name }}/tests
mysql -uroot < _fixtures/database/shopware55corrupted.sql

- name: Cache Playwright browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles('custom/plugins/**/tests/acceptance/package-lock.json') }}

- name: Install playwright
working-directory: custom/plugins/${{ github.event.repository.name }}/tests/acceptance
run: |
npm ci
npx playwright install --with-deps

- name: Run Playwright
working-directory: custom/plugins/${{ github.event.repository.name }}/tests/acceptance
env:
DATABASE_URL: mysql://root:root@127.0.0.1:3306/shopware55
UPDATE_SNAPSHOTS: ${{ github.event.inputs.update_snapshots }}
run: npm run test

- uses: actions/upload-artifact@v4
if: always()
with:
name: e2e-${{ github.event.repository.name }}-${{ github.sha }}-${{ matrix.PLATFORM_BRANCH }}
path: |
custom/plugins/${{ github.event.repository.name }}/tests/acceptance/test-results/
custom/plugins/${{ github.event.repository.name }}/tests/acceptance/playwright-report/
retention-days: 3

- name: Upload updated snapshots
if: github.event.inputs.update_snapshots == 'true'
uses: actions/upload-artifact@v4
playwright:
name: Playwright
uses: ./.github/workflows/action-acceptance.yml
with:
name: visual-snapshots-${{ matrix.PLATFORM_BRANCH }}
path: custom/plugins/${{ github.event.repository.name }}/tests/acceptance/snapshots/
retention-days: 3
extension_name: ${{ github.event.repository.name }}
platform_branch: trunk
update_snapshots: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.update_snapshots == 'true' }}
98 changes: 98 additions & 0 deletions .github/workflows/action-acceptance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Reusable Acceptance

on:
workflow_call:
inputs:
extension_name:
required: true
type: string
platform_branch:
required: true
type: string
update_snapshots:
required: false
type: boolean
default: false

jobs:
playwright:
name: Playwright
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: shopware
ports:
- 3306:3306
env:
DATABASE_URL: mysql://root:root@127.0.0.1:3306/shopware
steps:
- name: Setup extension
uses: shopware/github-actions/setup-extension@main
with:
extensionName: ${{ inputs.extension_name }}
shopwareVersion: ${{ inputs.platform_branch }}
install: true
install-admin: true
install-storefront: false
mysqlVersion: skip
env: prod
extraRepositories: |
{
"${{ inputs.extension_name }}": {
"type": "path",
"url": "custom/plugins/${{ inputs.extension_name }}",
"symlink": true
}
}

- name: Cache npm
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ~/.npm
key: ${{ runner.os }}-acceptance-${{ hashFiles(format('custom/plugins/{0}/tests/acceptance/package-lock.json', inputs.extension_name)) }}

- name: Cache Playwright browsers
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles(format('custom/plugins/{0}/tests/acceptance/package-lock.json', inputs.extension_name)) }}

- name: Setup Migration Assistant
run: |
composer run build:js:admin
cd custom/plugins/${{ inputs.extension_name }}/tests
mysql -uroot < _fixtures/database/shopware55corrupted.sql

- name: Install Playwright
working-directory: custom/plugins/${{ inputs.extension_name }}/tests/acceptance
run: |
npm ci
npx playwright install --with-deps

- name: Run Playwright
working-directory: custom/plugins/${{ inputs.extension_name }}/tests/acceptance
env:
DATABASE_URL: mysql://root:root@127.0.0.1:3306/shopware55
UPDATE_SNAPSHOTS: ${{ inputs.update_snapshots }}
run: npm run test

- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: e2e-${{ inputs.extension_name }}-${{ github.sha }}-${{ inputs.platform_branch }}
path: |
custom/plugins/${{ inputs.extension_name }}/tests/acceptance/test-results/
custom/plugins/${{ inputs.extension_name }}/tests/acceptance/playwright-report/
retention-days: 3

- name: Upload updated snapshots
if: inputs.update_snapshots
uses: actions/upload-artifact@v4
with:
name: visual-snapshots-${{ inputs.platform_branch }}
path: custom/plugins/${{ inputs.extension_name }}/tests/acceptance/snapshots/
retention-days: 3
45 changes: 45 additions & 0 deletions .github/workflows/action-jest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Reusable Jest

on:
workflow_call:
inputs:
extension_name:
required: true
type: string

jobs:
jest:
name: Jest
runs-on: ubuntu-latest
env:
ARTIFACTS_PATH: ${{ github.workspace }}/development
steps:
- name: Setup extension
uses: shopware/github-actions/setup-extension@main
with:
extensionName: ${{ inputs.extension_name }}
install: true
install-admin: true
install-storefront: false
extraRepositories: |
{
"${{ inputs.extension_name }}": {
"type": "path",
"url": "custom/plugins/${{ inputs.extension_name }}",
"symlink": true
}
}

- name: Cache npm
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ~/.npm
key: ${{ runner.os }}-jest-${{ hashFiles(format('custom/plugins/{0}/tests/Jest/package-lock.json', inputs.extension_name)) }}

- name: Install Jest dependencies
working-directory: custom/plugins/${{ inputs.extension_name }}/tests/Jest
run: npm ci

- name: Run Jest
working-directory: custom/plugins/${{ inputs.extension_name }}/tests/Jest
run: npm run unit
52 changes: 52 additions & 0 deletions .github/workflows/action-phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Reusable PHPStan

on:
workflow_call:
inputs:
extension_name:
required: true
type: string

jobs:
phpstan:
name: PHPStan
runs-on: ubuntu-latest
steps:
- name: Setup extension
uses: shopware/github-actions/setup-extension@main
env:
DATABASE_URL: mysql://root@127.0.0.1/shopware
with:
extensionName: ${{ inputs.extension_name }}
install: true
install-admin: true
install-storefront: true
extraRepositories: |
{
"${{ inputs.extension_name }}": {
"type": "path",
"url": "custom/plugins/${{ inputs.extension_name }}",
"symlink": true
}
}

- name: Create phpstan.neon
working-directory: custom/plugins/${{ inputs.extension_name }}
run: |
printf "parameters:\n tmpDir: ${GITHUB_WORKSPACE}/var/phpstan\nincludes:\n - phpstan.neon.dist" > phpstan.neon

- name: PHPStan cache
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ${{ github.workspace }}/var/phpstan
key: ${{ runner.os }}-${{ github.repository }}-phpstan-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ github.repository }}-phpstan-

- name: Build PHPStan bootstrap
run: php ${GITHUB_WORKSPACE}/src/Core/DevOps/StaticAnalyze/phpstan-bootstrap.php

- name: Run PHPStan
run: |
composer -d custom/plugins/${{ inputs.extension_name }} dump-autoload --dev
composer -d custom/plugins/${{ inputs.extension_name }} run phpstan
38 changes: 38 additions & 0 deletions .github/workflows/action-phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Reusable PHPUnit

on:
workflow_call:
inputs:
extension_name:
required: true
type: string
platform_branch:
required: true
type: string

jobs:
phpunit:
name: PHPUnit
runs-on: ubuntu-latest
steps:
- name: Setup extension
uses: shopware/github-actions/setup-extension@main
with:
extensionName: ${{ inputs.extension_name }}
install: true
shopwareVersion: ${{ inputs.platform_branch }}
extraRepositories: |
{
"${{ inputs.extension_name }}": {
"type": "path",
"url": "custom/plugins/${{ inputs.extension_name }}",
"symlink": true
}
}

- name: Import SW5 test data DB
working-directory: custom/plugins/${{ inputs.extension_name }}/tests
run: mysql -uroot < _fixtures/database/shopware55.sql

- name: Run PHPUnit
run: composer -d custom/plugins/${{ inputs.extension_name }} run phpunit
Loading
Loading