Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEXT-00000 - Add GitHub actions #27

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Draft
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
48 changes: 48 additions & 0 deletions .github/actions/setup-magento-plugin/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Setup SwagMigrationMagento
description: "Setup steps for SwagMigrationMagento"
author: "shopware AG"
branding:
color: "blue"
icon: "download"

inputs:
php-version:
default: "8.2"
required: false
description: "Which PHP version should be used"
mysql-version:
default: "builtin"
required: false
description: "Which MySQL version should be used"

runs:
using: composite
steps:
- name: Setup SwagMigrationMagento
uses: shopware/github-actions/setup-extension@main
with:
extensionName: SwagMigrationMagento
install: true
install-admin: true
phpVersion: ${{ inputs.php-version }}
mysqlVersion: ${{ inputs.mysql-version }}
extraRepositories: |
{
"SwagMigrationAssistant": {
"type": "path",
"url": "custom/plugins/SwagMigrationAssistant",
"symlink": true
},
"${{ github.event.repository.name }}": {
"type": "path",
"url": "custom/plugins/${{ github.event.repository.name }}",
"symlink": true
}
}
dependencies: |
[
{
"name": "SwagMigrationAssistant",
"repo": "https://github.com/shopware/SwagMigrationAssistant.git"
}
]
44 changes: 44 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Integration
on:
workflow_dispatch:
push:
branches:
- trunk
pull_request:

jobs:
danger:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker://ghcr.io/shyim/danger-php:latest
with:
args: ci
env:
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_PULL_REQUEST_ID: ${{ github.event.pull_request.number }}
if: ${{ env.ACT != 'true' }} # Don't execute on local runs, this can only fail

phpunit:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
MYSQL_IMAGE: ["mysql:8.0", "mariadb:10.11"]
PHP_VERSION: ["8.2", "8.3"]
steps:
- name: Checkout SwagMigrationMagento
uses: actions/checkout@v4
with:
path: custom/plugins/${{ github.event.repository.name }}
- name: Setup SwagMigrationMagento
uses: ./custom/plugins/SwagMigrationMagento/.github/actions/setup-magento-plugin
with:
php-version: ${{ matrix.PHP_VERSION }}
mysql-version: ${{ matrix.MYSQL_IMAGE }}
- 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
34 changes: 34 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: PHP Checks
on:
workflow_dispatch:
push:
branches:
- trunk
pull_request:
paths:
- composer.json
- src/**/*.php
- tests/**/*.php

jobs:
codestyle_php:
name: Codestyle PHP
runs-on: ubuntu-latest
steps:
- uses: shopware/github-actions/cs-fixer@main
with:
rules: ""

phpstan:
runs-on: ubuntu-latest
steps:
- name: Checkout SwagMigrationMagento
uses: actions/checkout@v4
with:
path: custom/plugins/${{ github.event.repository.name }}
- name: Setup SwagMigrationMagento
uses: ./custom/plugins/SwagMigrationMagento/.github/actions/setup-magento-plugin
- name: Run PHPStan
run: |
symfony composer -d custom/plugins/${{ github.event.repository.name }} dump-autoload --dev
symfony composer -d custom/plugins/${{ github.event.repository.name }} run phpstan
5 changes: 2 additions & 3 deletions bin/phpstan-config-generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* file that was distributed with this source code.
*/

use Shopware\Core\DevOps\StaticAnalyze\StaticAnalyzeKernel;
use Shopware\Core\Framework\Adapter\Kernel\KernelFactory;
use Shopware\Core\Framework\Plugin\KernelPluginLoader\StaticKernelPluginLoader;
use Shopware\Core\DevOps\StaticAnalyze\StaticAnalyzeKernel;
use Swag\MigrationMagento\SwagMigrationMagento;
use SwagMigrationAssistant\SwagMigrationAssistant;
use Symfony\Component\Dotenv\Dotenv;
Expand All @@ -21,7 +21,6 @@
(new Dotenv())->usePutEnv()->load($projectRoot . '/.env');
}


$magentoPluginRootPath = dirname(__DIR__);
$magentoComposerJson = json_decode((string) file_get_contents($magentoPluginRootPath . '/composer.json'), true);
$assistantPluginRootPath = $magentoPluginRootPath . '/../SwagMigrationAssistant';
Expand Down Expand Up @@ -77,7 +76,7 @@
[
str_replace($kernel->getProjectDir(), '', $kernel->getCacheDir()),
$projectRoot . (is_dir($projectRoot . '/platform') ? '/platform' : ''),
str_replace('\\', '_', get_class($kernel)),
str_replace('\\', '_', $kernel::class),
],
$phpStanConfigDist
);
Expand Down
Loading