From d9d8e94fdaf00950c748da2bb92671fb1cb8d74f Mon Sep 17 00:00:00 2001 From: David Lambauer Date: Mon, 7 Nov 2022 22:49:19 +0100 Subject: [PATCH 1/9] Added Static Tests Switched to bin/magento execution WIP - Working on Github Actions WIP - Working on Github Actions WIP - Working on Github Actions WIP - Working on Github Actions WIP - Working on Github Actions WIP - Working on Github Actions WIP - Working on Github Actions Replaced tests:run with native phpmd Changed Output Format to GitHub Fixed scope WIP - Working on Github Actions WIP - Working on Github Actions run only for changed files and PRs WIP - Working on Github Actions WIP - Working on Github Actions WIP - Working on Github Actions WIP - Working on Github Actions WIP - Working on Github Actions WIP - Working on Github Actions WIP - Working on Github Actions WIP - Working on Github Actions WIP - Working on Github Actions wip Changed matrix to latest Back to currently-supported as latest doesnt work Used a custom step to get changed files fixed my mess syntax changed action for changed files WIP - Working on Github Actions WIP - Working on Github Actions WIP - Working on Github Actions WIP - Working on Github Actions WIP - Working on Github Actions WIP - Working on Github Actions WIP - Working on Github Actions WIP - Working on Github Actions --- .github/workflows/static-tests.yml | 65 +++++++++++++++++++ .../App/Action/Plugin/Authentication.php | 6 ++ 2 files changed, 71 insertions(+) create mode 100644 .github/workflows/static-tests.yml diff --git a/.github/workflows/static-tests.yml b/.github/workflows/static-tests.yml new file mode 100644 index 000000000000..a9bae65e0a21 --- /dev/null +++ b/.github/workflows/static-tests.yml @@ -0,0 +1,65 @@ +name: Static Magento Tests + +on: + push: + branches: [2.4-develop] + pull_request: + branches: [2.4-develop] + +jobs: + compute_matrix: + name: '🧮 Compute the Matrix' + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.supported-version.outputs.matrix }} + steps: + - uses: graycoreio/github-actions-magento2/supported-version@main + id: supported-version + with: + kind: latest + - run: echo ${{ steps.supported-version.outputs.matrix }} + + qa: + name: '🤖 - Quality Assurance' + runs-on: ubuntu-latest + needs: compute_matrix + strategy: + fail-fast: false + matrix: ${{ fromJSON(needs.compute_matrix.outputs.matrix) }} + steps: + - uses: actions/checkout@v3 + name: '⬇️ Checkout Code' + + - uses: graycoreio/github-actions-magento2/setup-magento@main + name: '🛠 Setup Magento' + id: setup-magento + with: + php-version: ${{ matrix.php }} + magento_version: ${{ matrix.magento }} + mode: store + coverage: xDebug + + - name: '🚛 Install Dependencies' + run: composer install + working-directory: ${{ steps.setup-magento.outputs.path }} + shell: bash + env: + COMPOSER_CACHE_DIR: ${{ steps.composer-cache.outputs.dir }} + + - name: '👀 Get Changed Files' + uses: jitterbit/get-changed-files@v1 + id: changed-files + with: + format: space-delimited + + - name: '🧠 PHP Mess Detector' + shell: bash + working-directory: ${{ steps.setup-magento.outputs.path }} + run: | + for changed_file in ${{ steps.changed-files.outputs.added_modified }}; do + if [[ $file == *.php ]] + php vendor/bin/phpmd ${changed_file} github dev/tests/static/testsuite/Magento/Test/Php/_files/phpmd/ruleset.xml + else + echo "Skip for file: ${changed_file}" + fi + done diff --git a/app/code/Magento/AdminAdobeIms/App/Action/Plugin/Authentication.php b/app/code/Magento/AdminAdobeIms/App/Action/Plugin/Authentication.php index 845b908d7524..e4b8bb851def 100644 --- a/app/code/Magento/AdminAdobeIms/App/Action/Plugin/Authentication.php +++ b/app/code/Magento/AdminAdobeIms/App/Action/Plugin/Authentication.php @@ -56,4 +56,10 @@ public function __construct( $this->_openActions[] = ImsCallback::ACTION_NAME; } + + private function unusedMethod() + { + + return 'unused'; + } } From 0e04f39afa1ee80ac627945c2560e068de920621 Mon Sep 17 00:00:00 2001 From: David Lambauer Date: Sun, 4 Dec 2022 16:04:20 +0100 Subject: [PATCH 2/9] WIP - Working on Github Actions --- .github/workflows/static-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/static-tests.yml b/.github/workflows/static-tests.yml index a9bae65e0a21..7fb314f6fc8d 100644 --- a/.github/workflows/static-tests.yml +++ b/.github/workflows/static-tests.yml @@ -48,6 +48,7 @@ jobs: - name: '👀 Get Changed Files' uses: jitterbit/get-changed-files@v1 + continue-on-error: true id: changed-files with: format: space-delimited From 4cdbd5bc647c3e09485ffa97a5b07faf6bc3a2ed Mon Sep 17 00:00:00 2001 From: David Lambauer Date: Sun, 4 Dec 2022 16:05:49 +0100 Subject: [PATCH 3/9] WIP - Working on Github Actions --- .github/workflows/static-tests.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/static-tests.yml b/.github/workflows/static-tests.yml index 7fb314f6fc8d..04609af4f5c7 100644 --- a/.github/workflows/static-tests.yml +++ b/.github/workflows/static-tests.yml @@ -60,7 +60,5 @@ jobs: for changed_file in ${{ steps.changed-files.outputs.added_modified }}; do if [[ $file == *.php ]] php vendor/bin/phpmd ${changed_file} github dev/tests/static/testsuite/Magento/Test/Php/_files/phpmd/ruleset.xml - else - echo "Skip for file: ${changed_file}" fi done From 228ea07a7dd690ca0a0b901382239cb7c97488d4 Mon Sep 17 00:00:00 2001 From: David Lambauer Date: Sun, 4 Dec 2022 16:07:43 +0100 Subject: [PATCH 4/9] WIP - Working on Github Actions --- .github/workflows/static-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/static-tests.yml b/.github/workflows/static-tests.yml index 04609af4f5c7..202c056c8d9d 100644 --- a/.github/workflows/static-tests.yml +++ b/.github/workflows/static-tests.yml @@ -59,6 +59,7 @@ jobs: run: | for changed_file in ${{ steps.changed-files.outputs.added_modified }}; do if [[ $file == *.php ]] + then php vendor/bin/phpmd ${changed_file} github dev/tests/static/testsuite/Magento/Test/Php/_files/phpmd/ruleset.xml fi done From 137b89b99c34260db5036081edd7e29249c2c2e0 Mon Sep 17 00:00:00 2001 From: David Lambauer Date: Sun, 4 Dec 2022 16:33:39 +0100 Subject: [PATCH 5/9] WIP - Working on Github Actions --- .github/workflows/static-tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/static-tests.yml b/.github/workflows/static-tests.yml index 202c056c8d9d..35ae85a75863 100644 --- a/.github/workflows/static-tests.yml +++ b/.github/workflows/static-tests.yml @@ -61,5 +61,7 @@ jobs: if [[ $file == *.php ]] then php vendor/bin/phpmd ${changed_file} github dev/tests/static/testsuite/Magento/Test/Php/_files/phpmd/ruleset.xml + else + echo "Skip for ${changed_file}" fi done From d033709d076e97f67262152d14b9b49b83e447c7 Mon Sep 17 00:00:00 2001 From: David Lambauer Date: Sun, 4 Dec 2022 16:36:54 +0100 Subject: [PATCH 6/9] WIP - Working on Github Actions --- .github/workflows/static-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/static-tests.yml b/.github/workflows/static-tests.yml index 35ae85a75863..50b999791c49 100644 --- a/.github/workflows/static-tests.yml +++ b/.github/workflows/static-tests.yml @@ -58,7 +58,7 @@ jobs: working-directory: ${{ steps.setup-magento.outputs.path }} run: | for changed_file in ${{ steps.changed-files.outputs.added_modified }}; do - if [[ $file == *.php ]] + if [[ ${changed_file} == *.php ]] then php vendor/bin/phpmd ${changed_file} github dev/tests/static/testsuite/Magento/Test/Php/_files/phpmd/ruleset.xml else From 5a35a187f8641c8cfb9562902945794c800ae5a3 Mon Sep 17 00:00:00 2001 From: David Lambauer Date: Sun, 4 Dec 2022 21:12:51 +0100 Subject: [PATCH 7/9] WIP - Working on Github Actions --- .../AdminAdobeIms/App/Action/Plugin/Authentication.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/code/Magento/AdminAdobeIms/App/Action/Plugin/Authentication.php b/app/code/Magento/AdminAdobeIms/App/Action/Plugin/Authentication.php index e4b8bb851def..845b908d7524 100644 --- a/app/code/Magento/AdminAdobeIms/App/Action/Plugin/Authentication.php +++ b/app/code/Magento/AdminAdobeIms/App/Action/Plugin/Authentication.php @@ -56,10 +56,4 @@ public function __construct( $this->_openActions[] = ImsCallback::ACTION_NAME; } - - private function unusedMethod() - { - - return 'unused'; - } } From 98b986e8c56d0e28a1d787db0483dd2a1ed34627 Mon Sep 17 00:00:00 2001 From: David Lambauer Date: Mon, 5 Dec 2022 13:38:53 +0100 Subject: [PATCH 8/9] WIP - Working on Github Actions --- .github/workflows/linter.yml | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/linter.yml diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 000000000000..406a81db0fa3 --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,38 @@ +name: Linter + +on: + pull_request: + paths: + - '*.yml' + - '*.yaml' + - '*.xml' + - '*.php' + +jobs: + linter: + runs-on: ubuntu-latest + + steps: + + # Check out the repository + - uses: actions/checkout@v2 + + # Install the required version of Node.js + - uses: actions/setup-node@v1 + with: + node-version: '12' + + # Install the YAML, XML, and PHP linters + - run: npm install -g yaml-linter xml-linter php-linter + + # Run the YAML Linter + - name: 🚀 Run YAML Linter + run: yaml-linter app/code/**/*.yml + + # Run the XML Linter + - name: 🚀 Run XML Linter + run: xml-linter app/code/**/*.xml + + # Run the PHP Linter + - name: 🚀 Run PHP Linter + run: php-linter app/code/**/*.php From 1a30cba263c1d4d68b7e4f44d753e67835b84f34 Mon Sep 17 00:00:00 2001 From: David Lambauer Date: Mon, 5 Dec 2022 13:40:08 +0100 Subject: [PATCH 9/9] WIP - Working on Github Actions --- app/code/Magento/AdminAnalytics/etc/adminhtml/routes.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/AdminAnalytics/etc/adminhtml/routes.xml b/app/code/Magento/AdminAnalytics/etc/adminhtml/routes.xml index 5b5f2b52210b..d0313bb65694 100644 --- a/app/code/Magento/AdminAnalytics/etc/adminhtml/routes.xml +++ b/app/code/Magento/AdminAnalytics/etc/adminhtml/routes.xml @@ -11,4 +11,5 @@ +