From 9eda5eac065dd2e17533240e994da6bf05213b33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tjitse=20Efd=C3=A9?= Date: Thu, 7 Sep 2023 16:39:52 +0200 Subject: [PATCH 1/3] feat: run setup:di:compile on push --- setup-di-compile/README.md | 25 +++++++++++++++++ setup-di-compile/action.yml | 56 +++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 setup-di-compile/README.md create mode 100644 setup-di-compile/action.yml diff --git a/setup-di-compile/README.md b/setup-di-compile/README.md new file mode 100644 index 0000000..088c01f --- /dev/null +++ b/setup-di-compile/README.md @@ -0,0 +1,25 @@ +# Magento 2 setup:di:compile action +A Github Action that runs `php bin/magento setup:di:compile` and checks for compilation errors. + +## Inputs + +See the [action.yml](./action.yml) + +## Usage + +```yml +name: Magento setup:di:compile check + +on: + push: + branches: + +jobs: + coding-standard: + runs-on: ubuntu-latest + steps: + - uses: mage-os/github-actions/setup-di-compile@main + with: + php_version: "8.2" + composer_version: "2" +``` diff --git a/setup-di-compile/action.yml b/setup-di-compile/action.yml new file mode 100644 index 0000000..e1f54f9 --- /dev/null +++ b/setup-di-compile/action.yml @@ -0,0 +1,56 @@ +name: "Magento compilation (setup:di:compile)" +author: "MageOS" +description: "A Github Action that runs bin/magento setup:di:compile." + +inputs: + php_version: + required: true + default: "8.1" + description: "PHP version used to do the coding standard check." + + composer_version: + required: true + default: "2" + description: "The version of composer to use." + +runs: + using: composite + steps: + - name: Checkout Project + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Get changed files that could break compilation + uses: tj-actions/changed-files@v39 + id: changed-files + with: + files_yaml: | + magento: + - 'composer.lock' + - 'composer.json' + - '**/*.php' + - '**/*.xml' + + - name: Set PHP Version + if: steps.changed-files.outputs.magento_any_changed == 'true' + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ inputs.php_version }} + tools: composer:v${{ inputs.composer_version }} + coverage: none + + - name: Install composer dependencies + if: steps.changed-files.outputs.magento_any_changed == 'true' + shell: bash + run: composer install + + - name: Enable all modules + if: steps.changed-files.outputs.magento_any_changed == 'true' + shell: bash + run: php bin/magento module:enable --all + + - name: Compile + if: steps.changed-files.outputs.magento_any_changed == 'true' + shell: bash + run: php bin/magento setup:di:compile From 1e5be06d1ee5f7cab61e5e90975b2fea383a9ca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tjitse=20Efd=C3=A9?= Date: Fri, 8 Sep 2023 14:20:13 +0200 Subject: [PATCH 2/3] feat: use mage-os/github-actions/cache-magento --- setup-di-compile/action.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup-di-compile/action.yml b/setup-di-compile/action.yml index e1f54f9..339ecfa 100644 --- a/setup-di-compile/action.yml +++ b/setup-di-compile/action.yml @@ -6,7 +6,7 @@ inputs: php_version: required: true default: "8.1" - description: "PHP version used to do the coding standard check." + description: "PHP version used to run setup:di:compile." composer_version: required: true @@ -40,6 +40,10 @@ runs: tools: composer:v${{ inputs.composer_version }} coverage: none + - uses: mage-os/github-actions/cache-magento@main + with: + mode: 'store' + - name: Install composer dependencies if: steps.changed-files.outputs.magento_any_changed == 'true' shell: bash From 093c7bee6ad19308e666a7cbbc6fcb2049b781cb Mon Sep 17 00:00:00 2001 From: Fabrizio Balliano Date: Mon, 23 Dec 2024 20:43:30 +0000 Subject: [PATCH 3/3] Removed fetch-depth --- setup-di-compile/action.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/setup-di-compile/action.yml b/setup-di-compile/action.yml index 339ecfa..1bc9e25 100644 --- a/setup-di-compile/action.yml +++ b/setup-di-compile/action.yml @@ -18,8 +18,6 @@ runs: steps: - name: Checkout Project uses: actions/checkout@v3 - with: - fetch-depth: 0 - name: Get changed files that could break compilation uses: tj-actions/changed-files@v39