diff --git a/.github/workflows/admin.yml b/.github/workflows/admin.yml new file mode 100644 index 000000000..f6327faab --- /dev/null +++ b/.github/workflows/admin.yml @@ -0,0 +1,64 @@ +name: Admin +on: + pull_request: + +permissions: + contents: read + id-token: write + +jobs: + eslint: + runs-on: ubuntu-latest + steps: + - uses: octo-sts/action@main + id: octo-sts + with: + scope: shopware + identity: ${{ github.event.repository.name }} + - uses: shopware/github-actions/setup-extension@main + with: + extensionName: ${{ github.event.repository.name }} + install: true + installAdmin: true + dependencies: | + [ + { + "name":"SwagCommercial", + "repo": "https://github.com/shopware/SwagCommercial.git", + "token": "${{ steps.octo-sts.outputs.token }}" + }, + { + "name":"SwagCmsExtensions", + "repo": "https://github.com/shopware/SwagCmsExtensions.git", + "token": "${{ steps.octo-sts.outputs.token }}" + } + ] + extraRepositories: | + { + "${{ github.event.repository.name }}": { + "type": "path", + "url": "custom/plugins/${{ github.event.repository.name }}", + "symlink": true + }, + "SwagCommercial": { + "type": "path", + "url": "custom/plugins/SwagCommercial", + "symlink": true + }, + "SwagCmsExtensions": { + "type": "path", + "url": "custom/plugins/SwagCmsExtensions", + "symlink": true + } + } + - name: Prepare ESLint + run: | + bin/console bundle:dump + composer admin:generate-entity-schema-types + - name: Run ESLint + env: + ADMIN_PATH: ${{ github.workspace }}/src/Administration/Resources/app/administration + working-directory: custom/plugins/${{ github.event.repository.name }}/src/Resources/app/administration + run: | + npm run lint-fix + npm run lint diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 000000000..afb44d233 --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,176 @@ +name: PHP checks + +on: + push: + branches: + - trunk + pull_request: + workflow_dispatch: + workflow_call: + +permissions: + contents: read + id-token: write + +jobs: + phpstan: + runs-on: ubuntu-latest + strategy: + matrix: + PLATFORM_BRANCH: ["6.6.0.0", "trunk"] + fail-fast: false + steps: + - uses: octo-sts/action@main + id: octo-sts + with: + scope: shopware + identity: ${{ github.event.repository.name }} + - uses: shopware/github-actions/setup-extension@main + with: + extensionName: ${{ github.event.repository.name }} + install: true + installAdmin: true + installStorefront: true + dependencies: | + [ + { + "name":"SwagCommercial", + "repo": "https://github.com/shopware/SwagCommercial.git", + "token": "${{ steps.octo-sts.outputs.token }}" + }, + { + "name":"SwagCmsExtensions", + "repo": "https://github.com/shopware/SwagCmsExtensions.git", + "token": "${{ steps.octo-sts.outputs.token }}" + } + ] + extraRepositories: | + { + "${{ github.event.repository.name }}": { + "type": "path", + "url": "custom/plugins/${{ github.event.repository.name }}", + "symlink": true + }, + "SwagCommercial": { + "type": "path", + "url": "custom/plugins/SwagCommercial", + "symlink": true + }, + "SwagCmsExtensions": { + "type": "path", + "url": "custom/plugins/SwagCmsExtensions", + "symlink": true + } + } + + - name: Prepare phpstan + working-directory: custom/plugins/${{ github.event.repository.name }} + run: | + composer dump-autoload --dev -d "${GITHUB_WORKSPACE}/custom/plugins/SwagCmsExtensions" + composer dump-autoload --dev -d "${GITHUB_WORKSPACE}/custom/plugins/SwagCommercial" + sed -i 's|reportUnmatchedIgnoredErrors: true|reportUnmatchedIgnoredErrors: false|' ./phpstan.neon.dist + if [[ "${{ matrix.PLATFORM_BRANCH }}" == "6.6.0.0" ]]; then + sed -i '/type_perfect/d' ./phpstan.neon.dist + sed -i '/narrow_return: true/d' ./phpstan.neon.dist + sed -i '/no_mixed: true/d' ./phpstan.neon.dist + sed -i '/null_over_false: true/d' ./phpstan.neon.dist + fi + - run: | + symfony composer -d custom/plugins/${{ github.event.repository.name }} run phpstan + + validate-openapi-typescript: + runs-on: ubuntu-latest + steps: + - name: Setup Extension + uses: shopware/github-actions/setup-extension@main + env: + runner: ${{ runner.environment }} + with: + extensionName: ${{ github.event.repository.name }} + install: true + installAdmin: true + installStorefront: true + extraRepositories: | + { + "${{ github.event.repository.name }}": { + "type": "path", + "url": "custom/plugins/${{ github.event.repository.name }}", + "symlink": true + } + } + - working-directory: custom/plugins/${{ github.event.repository.name }} + run: | + ${GITHUB_WORKSPACE}/bin/console bundle:dump + composer init:admin + composer openapi:generate + git update-index --refresh || printf '' + git diff-index "${{ github.sha }}" --quiet -- src/Resources/app/administration/src/types/openapi.d.ts || (echo "Please run 'composer openapi:generate' to update openapi.d.ts" && exit 1) + + phpunit: + runs-on: ubuntu-latest + strategy: + matrix: + MYSQL_IMAGE: ["mysql:8.0", "mariadb:10.11"] + PLATFORM_BRANCH: ["v6.6.0.0", "trunk"] + env: + REDIS_URL: redis://localhost:6379 + services: + redis: + image: redis:alpine + ports: + - "6379:6379" + steps: + - uses: octo-sts/action@main + id: octo-sts + with: + scope: shopware + identity: ${{ github.event.repository.name }} + - uses: shopware/github-actions/setup-extension@main + with: + extensionName: ${{ github.event.repository.name }} + mysqlVersion: ${{ matrix.MYSQL_IMAGE }} + shopwareVersion: ${{ matrix.PLATFORM_BRANCH }} + install: true + installAdmin: true + installStorefront: true + dependencies: | + [ + { + "name":"SwagCommercial", + "repo": "https://github.com/shopware/SwagCommercial.git", + "token": "${{ steps.octo-sts.outputs.token }}" + }, + { + "name":"SwagCmsExtensions", + "repo": "https://github.com/shopware/SwagCmsExtensions.git", + "token": "${{ steps.octo-sts.outputs.token }}" + } + ] + extraRepositories: | + { + "${{ github.event.repository.name }}": { + "type": "path", + "url": "custom/plugins/${{ github.event.repository.name }}", + "symlink": true + }, + "SwagCommercial": { + "type": "path", + "url": "custom/plugins/SwagCommercial", + "symlink": true + }, + "SwagCmsExtensions": { + "type": "path", + "url": "custom/plugins/SwagCmsExtensions", + "symlink": true + } + } + - name: Run PHPUnit + working-directory: custom/plugins/${{ github.event.repository.name }} + run: | + composer dump-autoload --dev + php -d pcov.enabled=1 -d pcov.directory=$PWD/src -d pcov.exclude='~(vendor|tests|node_modules)~' \ + ${GITHUB_WORKSPACE}/vendor/bin/phpunit \ + --configuration phpunit.xml.dist \ + --log-junit ${GITHUB_WORKSPACE}/phpunit.junit.xml \ + --coverage-cobertura ${GITHUB_WORKSPACE}/cobertura.xml \ + --coverage-text diff --git a/.github/workflows/storefront.yml b/.github/workflows/storefront.yml new file mode 100644 index 000000000..75e27bd4b --- /dev/null +++ b/.github/workflows/storefront.yml @@ -0,0 +1,60 @@ +name: Storefront +on: + pull_request: + +permissions: + contents: read + id-token: write + +jobs: + eslint: + runs-on: ubuntu-latest + steps: + - uses: octo-sts/action@main + id: octo-sts + with: + scope: shopware + identity: ${{ github.event.repository.name }} + - uses: shopware/github-actions/setup-extension@main + with: + extensionName: ${{ github.event.repository.name }} + install: true + installStorefront: true + dependencies: | + [ + { + "name":"SwagCommercial", + "repo": "https://github.com/shopware/SwagCommercial.git", + "token": "${{ steps.octo-sts.outputs.token }}" + }, + { + "name":"SwagCmsExtensions", + "repo": "https://github.com/shopware/SwagCmsExtensions.git", + "token": "${{ steps.octo-sts.outputs.token }}" + } + ] + extraRepositories: | + { + "${{ github.event.repository.name }}": { + "type": "path", + "url": "custom/plugins/${{ github.event.repository.name }}", + "symlink": true + }, + "SwagCommercial": { + "type": "path", + "url": "custom/plugins/SwagCommercial", + "symlink": true + }, + "SwagCmsExtensions": { + "type": "path", + "url": "custom/plugins/SwagCmsExtensions", + "symlink": true + } + } + - name: Run ESLint + env: + STOREFRONT_PATH: ${{ github.workspace }}/src/Storefront/Resources/app/storefront + working-directory: custom/plugins/${{ github.event.repository.name }} + run: | + composer init:storefront + composer lint:storefront:ci