-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
56 changed files
with
1,422 additions
and
433 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
name: Backend Coding Standard (PR) | ||
on: | ||
pull_request_target: | ||
types: [labeled] | ||
jobs: | ||
mcs-backend-lint: | ||
runs-on: ubuntu-latest | ||
if: contains(github.event.pull_request.labels.*.name, 'safe to test') | ||
name: MCS Check | ||
container: | ||
image: docker.io/davidalger/php:7.4 | ||
|
||
steps: | ||
- name: Remove labels | ||
uses: andymckay/labeler@master | ||
with: | ||
remove-labels: "need is safe review" | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- name: Add composer repositories | ||
env: | ||
USERNAME: ${{ secrets.COMPOSER_MAGENTO_USERNAME }} | ||
PASSWORD: ${{ secrets.COMPOSER_MAGENTO_PASSWORD }} | ||
run: composer config repositories.magento composer https://$USERNAME:[email protected]/ | ||
|
||
- name: Initialize config | ||
id: config | ||
run: | | ||
echo "::set-output name=working-directory::${PWD/$GITHUB_WORKSPACE/}" | ||
echo "::set-output name=composer-cache-dir::$(composer config cache-files-dir)" | ||
- name: Retrieve composer cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.config.outputs.composer-cache-dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- run: composer global require hirak/prestissimo | ||
- run: composer install --no-interaction --dev | ||
|
||
- uses: mediotype/phpcs-action@v2 | ||
with: | ||
enable_warnings: true # This is required for magento-coding-standards to function | ||
only_changed_files: false # Required to run checks on push events too | ||
phpcs_bin_path: vendor/bin/phpcs -s --colors --report-full --standard=Magento2 --exclude=Magento2.Security.XssTemplate --ignore=vendor --extensions=php,phtml * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,9 @@ | ||
--- | ||
name: Backend Coding Standard | ||
on: [ push, pull_request_target ] | ||
on: | ||
push: | ||
jobs: | ||
backend-lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '7.3' | ||
|
||
- name: Add composer repositories | ||
env: | ||
USERNAME: ${{ secrets.COMPOSER_MAGENTO_USERNAME }} | ||
PASSWORD: ${{ secrets.COMPOSER_MAGENTO_PASSWORD }} | ||
run: composer config repositories.magento composer https://$USERNAME:[email protected]/ | ||
|
||
- name: Install dependencies | ||
run: composer install --prefer-dist --no-progress --no-suggest | ||
|
||
- name: Run tests | ||
run: composer run-script test | ||
|
||
new-backend-lint: | ||
mcs-backend-lint: | ||
runs-on: ubuntu-latest | ||
name: MCS Check | ||
container: | ||
|
@@ -34,7 +13,7 @@ jobs: | |
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
fetch-depth: 1 | ||
|
||
- name: Add composer repositories | ||
env: | ||
|
@@ -62,4 +41,4 @@ jobs: | |
with: | ||
enable_warnings: true # This is required for magento-coding-standards to function | ||
only_changed_files: false # Required to run checks on push events too | ||
phpcs_bin_path: vendor/bin/phpcs --standard=Magento2 --exclude=Magento2.Security.XssTemplate --ignore=vendor --extensions=php,phtml * | ||
phpcs_bin_path: vendor/bin/phpcs -s --colors --report-full --standard=Magento2 --exclude=Magento2.Security.XssTemplate --ignore=vendor --extensions=php,phtml * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Frontend (PR) | ||
on: | ||
pull_request_target: | ||
types: [labeled] | ||
jobs: | ||
frontend-lint: | ||
runs-on: ubuntu-latest | ||
if: contains(github.event.pull_request.labels.*.name, 'safe to test') | ||
steps: | ||
- name: Remove labels | ||
uses: andymckay/labeler@master | ||
with: | ||
remove-labels: "need is safe review" | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: Use Node.js 12.x | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
- run: yarn | ||
- run: yarn test |
3 changes: 2 additions & 1 deletion
3
.github/workflows/frontend.yml → .github/workflows/frontend_push.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
name: Frontend | ||
on: [push, pull_request] | ||
on: | ||
push: | ||
jobs: | ||
frontend-lint: | ||
runs-on: ubuntu-latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Label bot PR | ||
on: | ||
pull_request_target: | ||
jobs: | ||
label_bot_pr: | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.head.repo.full_name != github.repository && github.actor != 'dependabot[bot]' | ||
steps: | ||
- name: Label bot PR | ||
uses: andymckay/labeler@master | ||
with: | ||
remove-labels: "safe to test" | ||
add-labels: "need is safe review" | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Snowdog\Menu\Block\Adminhtml\Button; | ||
|
||
use Magento\Backend\Block\Widget\Context; | ||
|
||
class AbstractButton | ||
{ | ||
/** @var Context */ | ||
protected $context; | ||
|
||
public function __construct(Context $context) | ||
{ | ||
$this->context = $context; | ||
} | ||
|
||
protected function getUrl(string $route, array $params = []): string | ||
{ | ||
return $this->context->getUrlBuilder()->getUrl($route, $params); | ||
} | ||
|
||
protected function getMenuId() | ||
{ | ||
return $this->context->getRequest()->getParam('menu_id'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Snowdog\Menu\Block\Adminhtml\Button; | ||
|
||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; | ||
|
||
class Back extends AbstractButton implements ButtonProviderInterface | ||
{ | ||
public function getButtonData(): array | ||
{ | ||
return [ | ||
'label' => __('Back'), | ||
'on_click' => sprintf("location.href = '%s';", $this->getUrl('*/*/')), | ||
'class' => 'back', | ||
'sort_order' => 10 | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Snowdog\Menu\Block\Adminhtml\Button; | ||
|
||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; | ||
|
||
class Delete extends AbstractButton implements ButtonProviderInterface | ||
{ | ||
public function getButtonData(): array | ||
{ | ||
return [ | ||
'label' => __('Delete'), | ||
'on_click' => sprintf( | ||
"location.href = '%s';", | ||
$this->getUrl( | ||
'*/*/delete', | ||
['menu_id' => $this->getMenuId()] | ||
) | ||
), | ||
'class' => 'delete', | ||
'sort_order' => 20 | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Snowdog\Menu\Block\Adminhtml\Button; | ||
|
||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; | ||
|
||
class Reset extends AbstractButton implements ButtonProviderInterface | ||
{ | ||
public function getButtonData(): array | ||
{ | ||
return [ | ||
'label' => __('Reset'), | ||
'on_click' => 'window.location.reload();', | ||
'class' => 'reset', | ||
'sort_order' => 30 | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace Snowdog\Menu\Block\Adminhtml\Button; | ||
|
||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; | ||
|
||
class Save extends AbstractButton implements ButtonProviderInterface | ||
{ | ||
public function getButtonData(): array | ||
{ | ||
return [ | ||
'label' => __('Save'), | ||
'class' => 'save primary', | ||
'data+attribute' => [ | ||
'mage-init' => ['button' => ['event' => 'save']], | ||
'form-role' => 'save' | ||
], | ||
'sort_order' => 50 | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Snowdog\Menu\Block\Adminhtml\Button; | ||
|
||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; | ||
|
||
class SaveAndContinue extends AbstractButton implements ButtonProviderInterface | ||
{ | ||
public function getButtonData(): array | ||
{ | ||
return [ | ||
'label' => __('Save and Continue Edit'), | ||
'class' => 'save', | ||
'data_attribute' => [ | ||
'mage-init' => [ | ||
'button' => ['event' => 'saveAndContinueEdit'] | ||
] | ||
], | ||
'sort_order' => 40 | ||
]; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.