Compare commits

...

36 Commits

Author SHA1 Message Date
GrayBot 62d2aec976 chore: release 7.0.0 (#230) 2026-05-01 07:52:47 -04:00
kristof-ringleff 771dd05439 fix(cache-magento): address set-output deprecation (#231) 2026-04-28 21:54:56 -04:00
Ryan Hoerr f8036173e1 fix(supported-version): filter uninstallable versions from usable kind (#319)
Exclude versions that cannot be installed due to security or dependency issues:
- Magento 2.4.2 through 2.4.3-p3: require composer <=2.1, which is insecure
- Mage-OS 2.2.1: blocked by webonyx/graphql-php security advisory
2026-04-28 10:21:08 -04:00
Ryan Hoerr bbecc7f5f9 feat(supported-version): update for Mage-OS 2.2.2 (#317) 2026-04-28 10:19:20 -04:00
Ryan Hoerr db1267a94b chore(supported-version): Add supported version for Mage-OS 2.2.1 (#316) 2026-04-28 10:15:31 -04:00
Damien Retzinger 90babb16bf chore: promote release 7.0.0
Release-As: 7.0.0
2026-04-28 10:07:35 -04:00
GrayBot 93c0b480e2 chore: restore internal action refs to @main (#229) 2026-04-28 09:56:18 -04:00
GrayBot 28f9e498aa chore: release 7.0.0-rc.0 (#228) 2026-04-28 09:52:54 -04:00
Damien Retzinger 4001e8118b chore: release 7.0.0-rc.0
Release-As: 7.0.0-rc.0
2026-04-28 09:51:46 -04:00
Damien Retzinger b90317db60 ci: merge release-pinback and release-please workflows 2026-04-28 09:49:40 -04:00
Damien Retzinger ef5e69859c ci: prevent running tests on release PR 2026-04-28 09:45:19 -04:00
Damien Retzinger 1f4db0036c ci: automate pinning of in-repo versions at release time 2026-04-27 19:10:34 -04:00
Damien Retzinger e1a8a81488 feat(coding-standard): skip composer install if the coding is already installed 2026-04-27 14:03:49 -04:00
Damien Retzinger 3fad3a8995 feat(coding-standard): add missing composer_auth to require of magento-coding-standard 2026-04-27 14:03:12 -04:00
Damien Retzinger f8eff3c183 ci: update release refs to specific versions 2026-04-27 13:36:56 -04:00
Damien Retzinger ac4d16919b ci: handle edgecases 2026-04-27 12:03:05 -04:00
Damien Retzinger 5009cbf6da ci: replace pinback PAT with custom PAT 2026-04-27 11:56:02 -04:00
Damien Retzinger 4a0dcce0c9 ci: remove unnecessary cat 2026-04-27 11:46:49 -04:00
Damien Retzinger 5989e53c34 ci: adjust to auto-open PR 2026-04-27 11:44:49 -04:00
Damien Retzinger 7a3a4fdb6d ci: only modify uses 2026-04-27 11:38:52 -04:00
Damien Retzinger d4f4f9f468 ci: show diff'd files on pinback 2026-04-27 11:36:27 -04:00
Damien Retzinger 702ab13a0a build: gitignore tmp 2026-04-27 11:33:14 -04:00
Damien Retzinger 070b7b9901 ci: add workflow to automate version pinback to main for repo HEAD 2026-04-27 11:32:53 -04:00
Damien Retzinger 7e828eef67 ci: adjust to use internal version 2026-04-27 10:20:50 -04:00
Damien Retzinger dd543ffdea ci: adjust to use internal version 2026-04-27 10:16:02 -04:00
Damien Retzinger a2a45eb2fe docs: revise status badges 2026-04-27 10:10:12 -04:00
Damien Retzinger fa5620fc05 docs: remove stale badges and add missing actions 2026-04-27 10:05:54 -04:00
Damien Retzinger d80befbe9b fix(check-extension): mirror path repos to prevent symlink errors with template files (#218)
Composer installs path repositories as symlinks by default, which causes Magento's template engine to fail when resolving .phtml files. Setting `COMPOSER_MIRROR_PATH_REPOS=1` on all composer install steps forces a copy instead, matching how the package would be installed from Packagist in production.

Adds a .phtml template and an integration test to the demo package that
renders it via Magento's template engine. Without COMPOSER_MIRROR_PATH_REPOS=1
the path repo is installed as a symlink and the test fails; with mirroring
it passes.

Closes #217
2026-04-26 23:05:21 -04:00
Damien Retzinger d5c744e155 feat(coding-standard)!: remove pr-diff feature and built-in php setup (#224)
BREAKING CHANGE: Much of the "setup" that's built-into the command is removed in favor of a leaner action. This also includes the "on PR, only diff PR contents" behavior. This can be restored, but it shouldn't be the default and should be done as an input.

Fix SEVERITY_FLAGS construction which exited 1 under bash -e when
severity inputs were empty, causing CI failures.
2026-04-26 22:51:44 -04:00
Damien Retzinger 953de845eb feat(coding-standard-baseline)!: remove coding-standard-baseline action (#223) 2026-04-26 21:49:48 -04:00
Damien Retzinger de415eaff5 feat(install-test)!: remove install test (#222)
BREAKING CHANGE: You should rely on [Check Extension](https://github.com/graycoreio/github-actions-magento2/blob/main/.github/workflows/check-extension-README.md) instead.
2026-04-26 21:40:01 -04:00
Damien Retzinger 8f3c6eb927 refactor(cache-magento): remove unused mode cache arg (#220) 2026-04-26 21:31:21 -04:00
Damien Retzinger 98923b24c5 feat(unit-test)!: remove unit-test action (#221) 2026-04-26 21:31:07 -04:00
Damien Retzinger a92fe04503 docs: add guidance on what things belong in actions and what things dont 2026-04-26 21:15:47 -04:00
David Lambauer b510ea21e3 fix(supported-version)!: default include_services to true (#215)
BREAKING CHANGE: `include_services` now defaults to `true`. Callers that strictly validate the matrix schema and do not expect a `services` key must explicitly pass `include_services: false`.

Closes #214
2026-04-23 18:42:44 -04:00
David Lambauer 7799f0f9bf fix(check-extension): probe vendor dir for MageOS/Magento standards when running phpcs (#216)
Closes #213
2026-04-23 18:41:45 -04:00
41 changed files with 503 additions and 718 deletions
@@ -32,6 +32,7 @@ on:
jobs:
compute_matrix:
if: "!startsWith(github.head_ref, 'release-please')"
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.supported-version.outputs.matrix }}
@@ -51,9 +52,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v${{ matrix.composer }}
coverage: none
- uses: './coding-standard'
with:
version: ${{ github.event.inputs.version || '*' }}
path: ${{ github.event.inputs.path || '_test/demo-package' }}
composer_version: ${{ matrix.composer }}
php_version: ${{ matrix.php }}
path: ${{ github.event.inputs.path || '_test/demo-package' }}
@@ -19,6 +19,7 @@ on:
jobs:
get-composer-version:
if: "!startsWith(github.head_ref, 'release-please')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
@@ -18,6 +18,7 @@ on:
jobs:
get-magento-version:
if: "!startsWith(github.head_ref, 'release-please')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
-56
View File
@@ -1,56 +0,0 @@
name: Installation Test
on:
workflow_dispatch: {}
push:
branches:
- main
paths:
- "_test/demo-package/**"
- "installation-test/**"
- ".github/workflows/_internal-install.yaml"
- "supported-version/**"
- "!(**/*.md)"
pull_request:
branches:
- main
paths:
- "_test/demo-package/**"
- "installation-test/**"
- ".github/workflows/_internal-install.yaml"
- "supported-version/**"
- "!(**/*.md)"
env:
MAGENTO_COMPOSER_REPO: "https://mirror.mage-os.org/"
jobs:
compute_matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.supported-version.outputs.matrix }}
steps:
- uses: actions/checkout@v6
- uses: ./supported-version
with:
kind: currently-supported
id: supported-version
- run: echo ${{ steps.supported-version.outputs.matrix }}
install-test:
needs: compute_matrix
strategy:
matrix: ${{ fromJSON(needs.compute_matrix.outputs.matrix) }}
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./installation-test
with:
composer_version: ${{ matrix.composer }}
php_version: ${{ matrix.php }}
magento_version: ${{ matrix.magento }}
package_name: mage-os/magento2-demo-package
source_folder: $GITHUB_WORKSPACE/_test/demo-package
composer_auth: ${{ secrets.COMPOSER_AUTH }}
magento_repository: ${{ env.MAGENTO_COMPOSER_REPO }}
@@ -23,6 +23,7 @@ on:
jobs:
compute_matrix:
if: "!startsWith(github.head_ref, 'release-please')"
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.supported-version.outputs.matrix }}
@@ -18,6 +18,7 @@ on:
jobs:
semver-compare:
if: "!startsWith(github.head_ref, 'release-please')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
@@ -26,6 +26,7 @@ env:
jobs:
compute_matrix:
if: "!startsWith(github.head_ref, 'release-please')"
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.supported-version.outputs.matrix }}
@@ -101,9 +102,8 @@ jobs:
working-directory: ${{ env.magento_folder }}
composer_auth: ${{ secrets.COMPOSER_AUTH }}
- uses: graycoreio/github-actions-magento2/cache-magento@main
- uses: ./cache-magento
with:
mode: 'store'
composer_cache_key: '${{ matrix.magento }}'
- run: composer install
@@ -114,6 +114,7 @@ jobs:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
setup-magento-extension:
if: "!startsWith(github.head_ref, 'release-please')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
@@ -128,9 +129,8 @@ jobs:
composer_auth: ${{ secrets.COMPOSER_AUTH }}
magento_version: magento/project-community-edition:2.4.8-p3
- uses: graycoreio/github-actions-magento2/cache-magento@main
- uses: ./cache-magento
with:
mode: 'extension'
composer_cache_key: 'magento/project-community-edition:2.4.8-p3'
- run: composer install
-35
View File
@@ -1,35 +0,0 @@
name: Unit Test
on:
push:
branches:
- main
paths:
- "_test/demo-package/**"
- ".github/workflows/_internal-unit.yaml"
- "unit-test/**"
- "!(**/*.md)"
pull_request:
branches:
- main
paths:
- "_test/demo-package/**"
- ".github/workflows/_internal-unit.yaml"
- "unit-test/**"
- "!(**/*.md)"
jobs:
unit-test:
strategy:
matrix:
php_version:
- 8.2
- 8.3
- 8.4
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./unit-test
with:
source_folder: _test/demo-package
php_version: ${{ matrix.php_version }}
@@ -22,6 +22,7 @@ on:
- "!(**/*.md)"
jobs:
compute_matrix:
if: "!startsWith(github.head_ref, 'release-please')"
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.supported-version.outputs.matrix }}
@@ -20,6 +20,7 @@ on:
jobs:
unit-test:
if: "!startsWith(github.head_ref, 'release-please')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
+18 -46
View File
@@ -44,7 +44,7 @@ jobs:
steps:
- uses: actions/checkout@v6
- uses: graycoreio/github-actions-magento2/setup-magento@main
- uses: graycoreio/github-actions-magento2/setup-magento@v7.0.0
id: setup-magento
with:
php-version: ${{ matrix.php }}
@@ -54,9 +54,8 @@ jobs:
magento_repository: ${{ inputs.magento_repository }}
composer_auth: ${{ secrets.composer_auth }}
- uses: graycoreio/github-actions-magento2/cache-magento@main
- uses: graycoreio/github-actions-magento2/cache-magento@v7.0.0
with:
mode: extension
composer_cache_key: ${{ inputs.composer_cache_key }}
- name: Add extension repository
@@ -76,6 +75,7 @@ jobs:
run: composer install
env:
COMPOSER_AUTH: ${{ secrets.composer_auth }}
COMPOSER_MIRROR_PATH_REPOS: 1
- name: Configure phpunit.xml.dist
working-directory: ${{ steps.setup-magento.outputs.path }}
@@ -104,7 +104,7 @@ jobs:
steps:
- uses: actions/checkout@v6
- uses: graycoreio/github-actions-magento2/setup-magento@main
- uses: graycoreio/github-actions-magento2/setup-magento@v7.0.0
id: setup-magento
with:
php-version: ${{ matrix.php }}
@@ -114,9 +114,8 @@ jobs:
magento_repository: ${{ inputs.magento_repository }}
composer_auth: ${{ secrets.composer_auth }}
- uses: graycoreio/github-actions-magento2/cache-magento@main
- uses: graycoreio/github-actions-magento2/cache-magento@v7.0.0
with:
mode: extension
composer_cache_key: ${{ inputs.composer_cache_key }}
- name: Add extension repository
@@ -138,6 +137,7 @@ jobs:
run: composer install
env:
COMPOSER_AUTH: ${{ secrets.composer_auth }}
COMPOSER_MIRROR_PATH_REPOS: 1
- name: Enable all modules
working-directory: ${{ steps.setup-magento.outputs.path }}
@@ -154,45 +154,17 @@ jobs:
fail-fast: ${{ inputs.fail-fast }}
steps:
- uses: actions/checkout@v6
- name: Get Composer Version
uses: graycoreio/github-actions-magento2/get-composer-version@main
id: get-composer-version
- name: Check if allow-plugins option is available for this version of composer
uses: graycoreio/github-actions-magento2/semver-compare@main
- uses: shivammathur/setup-php@v2
with:
version: 2.2
compare_against: ${{ steps.get-composer-version.outputs.version }}
id: is-allow-plugins-available
php-version: ${{ matrix.php }}
tools: composer:v${{ matrix.composer }}
coverage: none
- name: Enable dealerdirect/phpcodesniffer-composer-installer plugin
shell: bash
working-directory: ${{ inputs.path }}
run: composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true --global
if: steps.is-allow-plugins-available.outputs.result < 1
- name: Install Coding Standard
shell: bash
working-directory: ${{ inputs.path }}
run: composer require "magento/magento-coding-standard" "magento/php-compatibility-fork"
env:
COMPOSER_AUTH: ${{ secrets.composer_auth }}
- name: Register Coding Standard
shell: bash
working-directory: ${{ inputs.path }}
run: vendor/bin/phpcs --config-set installed_paths vendor/magento/magento-coding-standard,vendor/magento/php-compatibility-fork
- name: Coding Standard Check
shell: bash
run: |
if [ -f .phpcs.xml ] || [ -f phpcs.xml ] || [ -f .phpcs.xml.dist ] || [ -f phpcs.xml.dist ]; then
./vendor/bin/phpcs .
else
./vendor/bin/phpcs --standard=Magento2 --ignore=*vendor/* .
fi
working-directory: ${{ inputs.path }}
- uses: graycoreio/github-actions-magento2/coding-standard@v7.0.0
with:
path: ${{ inputs.path }}
composer_auth: ${{ secrets.composer_auth }}
integration_test:
runs-on: ${{ matrix.os }}
@@ -203,7 +175,7 @@ jobs:
steps:
- uses: actions/checkout@v6
- uses: graycoreio/github-actions-magento2/setup-magento@main
- uses: graycoreio/github-actions-magento2/setup-magento@v7.0.0
id: setup-magento
with:
php-version: ${{ matrix.php }}
@@ -213,9 +185,8 @@ jobs:
magento_repository: ${{ inputs.magento_repository }}
composer_auth: ${{ secrets.composer_auth }}
- uses: graycoreio/github-actions-magento2/cache-magento@main
- uses: graycoreio/github-actions-magento2/cache-magento@v7.0.0
with:
mode: extension
composer_cache_key: ${{ inputs.composer_cache_key }}
- name: Add extension repository
@@ -237,8 +208,9 @@ jobs:
run: composer install
env:
COMPOSER_AUTH: ${{ secrets.composer_auth }}
COMPOSER_MIRROR_PATH_REPOS: 1
- uses: graycoreio/github-actions-magento2/get-magento-version@main
- uses: graycoreio/github-actions-magento2/get-magento-version@v7.0.0
id: magento-version
with:
working-directory: ${{ steps.setup-magento.outputs.path }}
+2 -1
View File
@@ -82,7 +82,7 @@ jobs:
COMPOSER_AUTH: ${{ secrets.composer_auth }}
name: Create Magento ${{ matrix.magento }} Project
- uses: graycoreio/github-actions-magento2/get-magento-version@main
- uses: graycoreio/github-actions-magento2/get-magento-version@v7.0.0
id: magento-version
with:
working-directory: ${{ inputs.magento_directory }}
@@ -140,6 +140,7 @@ jobs:
env:
COMPOSER_CACHE_DIR: ${{ steps.composer-cache.outputs.dir }}
COMPOSER_AUTH: ${{ secrets.composer_auth }}
COMPOSER_MIRROR_PATH_REPOS: 1
- name: Replace Configuration Settings for env
working-directory: ${{ inputs.magento_directory }}/dev/tests/integration
+125 -1
View File
@@ -4,11 +4,135 @@ on:
push:
branches:
- main
workflow_dispatch:
env:
RELEASE_BRANCH: release-please--branches--main--components--github-actions-magento2
jobs:
release-please:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
releases_created: ${{ steps.release.outputs.releases_created }}
steps:
- uses: googleapis/release-please-action@v4
- id: release
uses: googleapis/release-please-action@v4
with:
token: ${{ secrets.GRAYCORE_GITHUB_TOKEN }}
- name: Check if release branch exists
id: branch-check
if: steps.release.outputs.releases_created != 'true'
env:
GH_TOKEN: ${{ secrets.GRAYCORE_GITHUB_TOKEN }}
run: |
if gh api "repos/${{ github.repository }}/git/refs/heads/${{ env.RELEASE_BRANCH }}" --silent 2>/dev/null; then
echo "EXISTS=true" >> $GITHUB_OUTPUT
else
echo "EXISTS=false" >> $GITHUB_OUTPUT
fi
- name: Checkout release PR branch
if: steps.branch-check.outputs.EXISTS == 'true'
uses: actions/checkout@v6
with:
ref: ${{ env.RELEASE_BRANCH }}
token: ${{ secrets.GRAYBOT_PIN_BACK_PAT }}
- name: Pin refs on release PR branch
id: pin-refs
if: steps.branch-check.outputs.EXISTS == 'true'
run: |
VERSION="v$(jq -r '."."' .release-please-manifest.json)"
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
sed -i "s|uses: graycoreio/github-actions-magento2/\([^@]*\)@main|uses: graycoreio/github-actions-magento2/\1@${VERSION}|g" \
*/action.yml \
$(find .github/workflows \( -name "*.yml" -o -name "*.yaml" \) ! -name "release-*" ! -name "_internal*")
if git diff --quiet; then
echo "HAS_CHANGES=false" >> $GITHUB_OUTPUT
else
echo "HAS_CHANGES=true" >> $GITHUB_OUTPUT
fi
- name: Commit pinned refs
if: steps.pin-refs.outputs.HAS_CHANGES == 'true'
env:
GRAYBOT_GPG_KEY: ${{ secrets.GRAYBOT_GPG_KEY }}
run: |
echo "$GRAYBOT_GPG_KEY" | gpg --batch --import
export GPG_KEY_ID=$(gpg --list-secret-keys --keyid-format LONG | grep sec | awk '{print $2}' | cut -d/ -f2)
git config --global user.signingkey $GPG_KEY_ID
git config --global commit.gpgSign true
git config --global user.email "automation@graycore.io"
git config --global user.name "Beep Boop"
git add .
git commit -m "chore: pin internal action refs to ${{ steps.pin-refs.outputs.VERSION }}"
git push origin ${{ env.RELEASE_BRANCH }}
pinback:
needs: release-please
if: needs.release-please.outputs.releases_created == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
ref: main
token: ${{ secrets.GRAYBOT_PIN_BACK_PAT }}
- name: Extract version
id: version
run: |
VERSION="v$(jq -r '."."' .release-please-manifest.json)"
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
- name: Restore @main refs
run: |
sed -i "s|uses: graycoreio/github-actions-magento2/\([^@]*\)@[^ #]*|uses: graycoreio/github-actions-magento2/\1@main|g" \
*/action.yml \
$(find .github/workflows \( -name "*.yml" -o -name "*.yaml" \) ! -name "release-please.yml")
- name: Show changed files
run: git diff
- name: Check for changes
id: changes
run: |
if git diff --quiet; then
echo "HAS_CHANGES=false" >> $GITHUB_OUTPUT
else
echo "HAS_CHANGES=true" >> $GITHUB_OUTPUT
fi
- name: Commit and open pinback PR
if: steps.changes.outputs.HAS_CHANGES == 'true'
env:
GRAYBOT_GPG_KEY: ${{ secrets.GRAYBOT_GPG_KEY }}
GH_TOKEN: ${{ secrets.GRAYBOT_PIN_BACK_PAT }}
run: |
echo "$GRAYBOT_GPG_KEY" | gpg --batch --import
export GPG_KEY_ID=$(gpg --list-secret-keys --keyid-format LONG | grep sec | awk '{print $2}' | cut -d/ -f2)
git config --global user.signingkey $GPG_KEY_ID
git config --global commit.gpgSign true
git config --global user.email "automation@graycore.io"
git config --global user.name "Beep Boop"
BRANCH="chore/pinback-${{ steps.version.outputs.VERSION }}"
git checkout -b "$BRANCH"
git add .
git commit -m "chore: restore internal action refs to @main"
git push --force origin "$BRANCH"
EXISTING=$(gh pr list --head "$BRANCH" --json number --jq '.[0].number // empty')
if [ -z "$EXISTING" ]; then
gh pr create \
--base main \
--head "$BRANCH" \
--title "chore: restore internal action refs to @main after ${{ steps.version.outputs.VERSION }}" \
--body "Restores all internal \`graycoreio/github-actions-magento2\` action refs from \`${{ steps.version.outputs.VERSION }}\` back to \`@main\`."
else
echo "PR #$EXISTING already exists for $BRANCH — skipping creation"
fi
+1
View File
@@ -1,2 +1,3 @@
node_modules/
.idea/
tmp
+1 -1
View File
@@ -1 +1 @@
{".":"6.0.0"}
{".":"7.0.0"}
+50
View File
@@ -2,6 +2,56 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## [7.0.0](https://github.com/graycoreio/github-actions-magento2/compare/v7.0.0-rc.0...v7.0.0) (2026-04-29)
### Features
* **supported-version:** update for Mage-OS 2.2.2 ([#317](https://github.com/graycoreio/github-actions-magento2/issues/317)) ([bbecc7f](https://github.com/graycoreio/github-actions-magento2/commit/bbecc7f5f9e4ddfdf5b41eb17fac6db1b30b56f0))
### Bug Fixes
* **cache-magento:** address `set-output` deprecation ([#231](https://github.com/graycoreio/github-actions-magento2/issues/231)) ([771dd05](https://github.com/graycoreio/github-actions-magento2/commit/771dd054395a0e0a33e2d712d9793ca8322173e9))
* **supported-version:** filter uninstallable versions from usable kind ([#319](https://github.com/graycoreio/github-actions-magento2/issues/319)) ([f803617](https://github.com/graycoreio/github-actions-magento2/commit/f8036173e143ab5d13147c136e0d9e0c6bbb829b))
### Miscellaneous Chores
* promote release 7.0.0 ([90babb1](https://github.com/graycoreio/github-actions-magento2/commit/90babb16bfb28ca1953c95edb2301c9090b52f67))
## [7.0.0-rc.0](https://github.com/graycoreio/github-actions-magento2/compare/v6.0.0...v7.0.0-rc.0) (2026-04-28)
### ⚠ BREAKING CHANGES
* **coding-standard:** Much of the "setup" that's built-into the command is removed in favor of a leaner action. This also includes the "on PR, only diff PR contents" behavior. This can be restored, but it shouldn't be the default and should be done as an input.
* **coding-standard-baseline:** remove coding-standard-baseline action ([#223](https://github.com/graycoreio/github-actions-magento2/issues/223))
* **install-test:** You should rely on [Check Extension](https://github.com/graycoreio/github-actions-magento2/blob/main/.github/workflows/check-extension-README.md) instead.
* **unit-test:** remove unit-test action ([#221](https://github.com/graycoreio/github-actions-magento2/issues/221))
* **supported-version:** `include_services` now defaults to `true`. Callers that strictly validate the matrix schema and do not expect a `services` key must explicitly pass `include_services: false`.
### Features
* **coding-standard-baseline:** remove coding-standard-baseline action ([#223](https://github.com/graycoreio/github-actions-magento2/issues/223)) ([953de84](https://github.com/graycoreio/github-actions-magento2/commit/953de845ebf7b5d2c9a24670b380c016bd6efdcd))
* **coding-standard:** add missing composer_auth to require of magento-coding-standard ([3fad3a8](https://github.com/graycoreio/github-actions-magento2/commit/3fad3a89954be09a0f11f04a6c1c7d927fc872eb))
* **coding-standard:** remove pr-diff feature and built-in php setup ([#224](https://github.com/graycoreio/github-actions-magento2/issues/224)) ([d5c744e](https://github.com/graycoreio/github-actions-magento2/commit/d5c744e15544e249f79fa486a073d7020635e48a))
* **coding-standard:** skip composer install if the coding is already installed ([e1a8a81](https://github.com/graycoreio/github-actions-magento2/commit/e1a8a81488c77144786427ff63a99f93cd17b897))
* **install-test:** remove install test ([#222](https://github.com/graycoreio/github-actions-magento2/issues/222)) ([de415ea](https://github.com/graycoreio/github-actions-magento2/commit/de415eaff54507ca24cbecf8916fd1526beb0186))
* **unit-test:** remove unit-test action ([#221](https://github.com/graycoreio/github-actions-magento2/issues/221)) ([98923b2](https://github.com/graycoreio/github-actions-magento2/commit/98923b24c58899779a6a6367e3863d718b09bb8d))
### Bug Fixes
* **check-extension:** mirror path repos to prevent symlink errors with template files ([#218](https://github.com/graycoreio/github-actions-magento2/issues/218)) ([d80befb](https://github.com/graycoreio/github-actions-magento2/commit/d80befbe9b26dfa37af117775544c85ea36b7127)), closes [#217](https://github.com/graycoreio/github-actions-magento2/issues/217)
* **check-extension:** probe vendor dir for MageOS/Magento standards when running phpcs ([#216](https://github.com/graycoreio/github-actions-magento2/issues/216)) ([7799f0f](https://github.com/graycoreio/github-actions-magento2/commit/7799f0f9bf788545bc36924b6528c09c6a8bb09a)), closes [#213](https://github.com/graycoreio/github-actions-magento2/issues/213)
* **supported-version:** default include_services to true ([#215](https://github.com/graycoreio/github-actions-magento2/issues/215)) ([b510ea2](https://github.com/graycoreio/github-actions-magento2/commit/b510ea21e38c97a4852776fc4e57fbcf9917fa9f)), closes [#214](https://github.com/graycoreio/github-actions-magento2/issues/214)
### Miscellaneous Chores
* release 7.0.0-rc.0 ([4001e81](https://github.com/graycoreio/github-actions-magento2/commit/4001e8118b6da28d7c9fd18d3ab127cee03681d3))
## [6.0.0](https://github.com/graycoreio/github-actions-magento2/compare/v5.1.0...v6.0.0) (2026-03-11)
+12 -13
View File
@@ -3,9 +3,8 @@
<div align="center">
![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/graycoreio/github-actions-magento2)
[![Unit Test](https://github.com/graycoreio/github-actions-magento2/actions/workflows/_internal-unit.yaml/badge.svg)](https://github.com/graycoreio/github-actions-magento2/actions/workflows/_internal-unit.yaml)
[![Integration Test](https://github.com/graycoreio/github-actions-magento2/actions/workflows/_internal-integration.yaml/badge.svg)](https://github.com/graycoreio/github-actions-magento2/actions/workflows/_internal-integration.yaml)
[![Installation Test](https://github.com/graycoreio/github-actions-magento2/actions/workflows/_internal-install.yaml/badge.svg)](https://github.com/graycoreio/github-actions-magento2/actions/workflows/_internal-install.yaml)
[![Integration Test](https://img.shields.io/github/actions/workflow/status/graycoreio/github-actions-magento2/_internal-integration.yaml?label=Integration%20Test&labelColor=1a1a1a)](https://github.com/graycoreio/github-actions-magento2/actions/workflows/_internal-integration.yaml)
[![MageCheck](https://img.shields.io/github/actions/workflow/status/graycoreio/github-actions-magento2/_internal_check_extension.yaml?label=Check%20Extension%20Test&labelColor=1a1a1a)](https://github.com/graycoreio/github-actions-magento2/actions/workflows/_internal_check_extension.yaml)
</div>
@@ -24,13 +23,13 @@ Opinionated Github Actions and Workflows to make building, testing, and maintain
## Actions
| Action Name | Description |
| ------------------------------------------------------ | ----------------------------------------------------------------------------------------- |
| [Unit Test](./unit-test/README.md) | A Github Action that runs the Unit Tests a Magento Package |
| [Fix Magento Install](./fix-magento-install/README.md) | A Github Action that fixes Magento before `composer install` |
| [Cache Magento](./cache-magento/README.md) | A Github Action that creates a composer cache for a Magento extension or store. |
| [Setup Magento](./setup-magento/README.md) | A Github Action that sets up Magento before `composer install` for an extension or store. |
| [Get Magento Version](./get-magento-version/README.md) | A Github Action that computes the installed Magento version. |
| [Installation Test](./installation-test/README.md) | A Github Action that tests the installability of a Magento Package |
| [Semver Compare](./semver-compare/README.md) | A Github Action that semantically compares two versions |
| [Supported Version](./supported-version/README.md) | A Github Action that computes the currently supported Github Actions Matrix for Magento 2 |
| Action Name | Description |
| ------------------------------------------------------------ | ----------------------------------------------------------------------------------------- |
| [Fix Magento Install](./fix-magento-install/README.md) | A Github Action that fixes Magento before `composer install` |
| [Cache Magento](./cache-magento/README.md) | A Github Action that creates a composer cache for a Magento extension or store. |
| [Setup Magento](./setup-magento/README.md) | A Github Action that sets up Magento before `composer install` for an extension or store. |
| [Get Magento Version](./get-magento-version/README.md) | A Github Action that computes the installed Magento version. |
| [Get Composer Version](./get-composer-version/README.md) | A Github Action that computes an installed Composer version. |
| [Coding Standard](./coding-standard/README.md) | A Github Action that runs the Magento Coding Standard. |
| [Semver Compare](./semver-compare/README.md) | A Github Action that semantically compares two versions |
| [Supported Version](./supported-version/README.md) | A Github Action that computes the currently supported Github Actions Matrix for Magento 2 |
@@ -0,0 +1,24 @@
<?php
namespace Graycore\DemoPackage\Test\Integration;
use Magento\Framework\View\Element\Template;
use Magento\TestFramework\Helper\Bootstrap;
/**
* Fails when the extension is installed as a symlink (default Composer path repo behavior)
* because Magento's template engine cannot resolve .phtml files through symlinks.
* Requires COMPOSER_MIRROR_PATH_REPOS=1 during composer install.
*/
class TemplateRenderTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoAppArea frontend
*/
public function testTemplateRendersWithoutSymlinkError()
{
$block = Bootstrap::getObjectManager()->create(Template::class);
$block->setTemplate('Graycore_DemoPackage::demo.phtml');
$this->assertNotEmpty($block->toHtml());
}
}
@@ -0,0 +1,2 @@
<?php /** @var \Magento\Framework\View\Element\Template $block */ ?>
<div>demo</div>
-3
View File
@@ -10,7 +10,6 @@ See the [action.yml](./action.yml)
| Input | Description | Required | Default |
| ------------------ | -------------------------------------------------------------------------------------- | -------- | ------------ |
| composer_cache_key | A key to version the composer cache. Can be incremented if you need to bust the cache. | false | '__mageos' |
| mode | "The mode for setup, one of: `extension` or `store`." | true | N/A |
### Usage
@@ -31,8 +30,6 @@ jobs:
steps:
- uses: actions/checkout@v6
- uses: graycoreio/github-actions-magento2/cache-magento@main
with:
mode: 'store'
id: cache-magento
- run: composer install
+2 -6
View File
@@ -8,10 +8,6 @@ inputs:
default: "__mageos"
description: A key to version the composer cache. Can be incremented if you need to bust the cache.
mode:
required: true
description: "The mode for setup, one of: `extension` or `store`."
outputs:
cache-hit:
description: "A boolean value to indicate an exact match was found for the key"
@@ -26,11 +22,11 @@ runs:
run: |
echo "dir=$(composer config cache-files-dir --global)" >> $GITHUB_OUTPUT
- run: echo "::set-output name=version::$(php -v | awk 'NR==1{print $2}')"
- run: echo "version=$(php -v | awk 'NR==1{print $2}')" >> "$GITHUB_OUTPUT"
shell: bash
id: cache-magento-get-php-version
- run: echo "::set-output name=version::$(composer --version | awk '{print $3}')"
- run: echo "version=$(composer --version | awk '{print $3}')" >> "$GITHUB_OUTPUT"
shell: bash
name: Compute Composer Version
id: cache-magento-get-composer-version
-45
View File
@@ -1,45 +0,0 @@
# Magento 2 Coding Standard Action
This Github Action automates the enforcement of Magento Coding Standards. It ensures code consistency and quality by checking code against Magento's specific coding guidelines.
## Inputs
For detailed descriptions of each input, refer to [action.yml](./action.yml).
## Why a Baseline?
Running PHP CodeSniffer (PHPCS) with a baseline is crucial for managing legacy code. It allows you to set a "starting point" for code quality, ignoring existing issues while ensuring no new issues are introduced. This approach is especially useful for large codebases where addressing all existing issues at once is not feasible. The baseline serves as a record of known issues, enabling teams to focus on maintaining and gradually improving code quality in new or modified code.
## Usage Example
The following example demonstrates how to set up the action in your workflow:
Check how this action is used in mage-os [here](https://github.com/mage-os/mageos-magento2/blob/2.4-develop/.github/workflows/coding-standard-baseline.yml).
```yml
name: Coding Standard Baseline
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
coding-standard:
runs-on: ubuntu-latest
steps:
- uses: graycoreio/github-actions-magento2/coding-standard-baseline@main
with:
head_repo: "mage-os/mageos-magento2"
head_ref: "main"
php_version: "8.2"
composer_version: "2"
version: "*"
severity: "5"
warning_severity: "8"
error_severity: "8"
baseline_version: "*"
```
-151
View File
@@ -1,151 +0,0 @@
name: "M2 Coding Standard"
author: "Mage-OS"
description: "A Github Action that runs the Magento Coding Standard."
inputs:
php_version:
type: string
required: true
default: "8.2"
description: "PHP version used to do the coding standard check (default: 8.2)."
composer_version:
type: string
required: true
default: "2"
description: "The version of composer to use (default: 2)."
version:
type: string
required: false
default: "*"
description: "The version of the coding standard to use (default: latest)."
severity:
type: string
required: false
default: "5"
description: "The minimum severity required to display an error or warning (default: 5)"
warning_severity:
type: string
required: false
default: "8"
description: "The minimum severity required to display a warning (default: 8)."
error_severity:
type: string
required: false
default: "8"
description: "The minimum severity required to display an error (default: 8)."
baseline_version:
type: string
required: false
default: "*"
description: "The version of phpcs baseline to use (default: latest)."
head_repo:
type: string
required: true
description: "The repository full name of the head branch. E.g.: mage-os/mageos-magento2"
head_ref:
type: string
required: true
description: "The branch name of the head branch. E.g.: main"
runs:
using: composite
steps:
- name: Checkout head
uses: actions/checkout@v6
with:
ref: ${{ inputs.head_ref }}
repository: ${{ inputs.head_repo }}
- uses: dorny/paths-filter@v2
name: Filter changed files
id: filter
with:
list-files: shell
filters: |
baseline:
- modified: '**/**.{php,phtml,graphqls,less,css,html,xml,js}'
phpcs:
- added|modified: '**/**.{php,phtml,graphqls,less,css,html,xml,js}'
- name: Check changed files for PHPcs
if: steps.filter.outputs.phpcs == 'true'
shell: bash
run: |
echo "One or more files relevant to PHPCS have changed."
echo "List all the files that have been added or changed: ${{ steps.filter.outputs.phpcs_files }}"
- name: Setup PHP
if: steps.filter.outputs.phpcs == 'true'
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php_version }}
tools: composer:v${{ inputs.composer_version }}
coverage: none
- name: Install coding standards
if: steps.filter.outputs.phpcs == 'true'
shell: bash
run: |
composer create-project --no-plugins --no-dev \
magento/magento-coding-standard \
magento-coding-standard "${{ github.event.inputs.version || '*' }}"
- name: Install phpcs baseline
if: steps.filter.outputs.phpcs == 'true'
working-directory: magento-coding-standard
shell: bash
run: |
composer config --no-plugins allow-plugins.digitalrevolution/php-codesniffer-baseline true
composer require --dev "digitalrevolution/php-codesniffer-baseline: ${{ github.event.inputs.baseline_version || '*' }}"
- name: Checkout base
if: steps.filter.outputs.phpcs == 'true'
uses: actions/checkout@v6
with:
ref: ${{github.event.pull_request.base.ref}}
repository: ${{github.event.pull_request.base.repo.full_name}}
path: base
- name: Create phpcs.baseline.xml from base
shell: bash
working-directory: base
if: steps.filter.outputs.baseline == 'true'
run: |
php ${{ github.workspace }}/magento-coding-standard/vendor/bin/phpcs --standard=Magento2 \
$([ -n "${{ inputs.severity }}" ] && echo "--severity=${{ inputs.severity }}") \
$([ -n "${{ inputs.warning_severity }}" ] && echo "--warning-severity=${{ inputs.warning_severity }}") \
$([ -n "${{ inputs.error_severity }}" ] && echo "--error-severity=${{ inputs.error_severity }}") \
--report=\\DR\\CodeSnifferBaseline\\Reports\\Baseline --report-file=phpcs.baseline.xml \
${{ steps.filter.outputs.baseline_files }} || /bin/true
- name: Copy baseline to head
if: steps.filter.outputs.baseline == 'true'
shell: bash
run: |
cp ${{ github.workspace }}/base/phpcs.baseline.xml ${{ github.workspace }}/magento-coding-standard/phpcs.baseline.xml
# Since we ran phpcs in the base folder, the files in phpcs.baseline.xml contain the base folder in the path.
# We need to remove /base/ so that the phpcs can locate the correct files.
- name: Remove base dir from phpcs baseline
if: steps.filter.outputs.baseline == 'true'
shell: bash
run: |
sed -i "s|/base/|/|" ${{ github.workspace }}/magento-coding-standard/phpcs.baseline.xml
- name: Execute phpcs on head for changed files
shell: bash
if: steps.filter.outputs.phpcs == 'true'
run: |
php ${{ github.workspace }}/magento-coding-standard/vendor/bin/phpcs --standard=Magento2 \
$([ -n "${{ inputs.severity }}" ] && echo "--severity=${{ inputs.severity }}") \
$([ -n "${{ inputs.warning_severity }}" ] && echo "--warning-severity=${{ inputs.warning_severity }}") \
$([ -n "${{ inputs.error_severity }}" ] && echo "--error-severity=${{ inputs.error_severity }}") \
${{ steps.filter.outputs.phpcs_files }}
+12 -2
View File
@@ -11,6 +11,8 @@ See the [action.yml](./action.yml)
## Usage
The caller is responsible for checking out the repository and setting up PHP before calling this action.
```yml
name: Coding Standard
@@ -26,11 +28,19 @@ jobs:
coding-standard:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
tools: composer:v2
coverage: none
- uses: graycoreio/github-actions-magento2/coding-standard@main
with:
path: app/code # Optional, defaults to .
version: 25 # Optional, will use the latest if omitted.
path: app/code # Optional, will be used when event is not a pull request.
severity: 8 # Optional, will use phpcs default of 5 if not specified.
warning_severity: 4 # Optional, will use severity value if not specified.
error_severity: 7 # Optional, will use severity value if not specified.
```
```
+62 -54
View File
@@ -3,35 +3,25 @@ author: "Graycore"
description: "A Github Action that runs the Magento Coding Standard."
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."
path:
required: true
default: 'app/code'
description: "The directory (relative to the project root) in which the coding standard will be checked. Used when the event is not a pull request."
default: '.'
description: "The directory containing the code to check."
version:
required: false
description: "The version of the coding standard to use. If not provided, will use the latest version."
severity:
required: false
default: ""
description: "The minimum severity required to display an error or warning (default: 5)"
warning_severity:
required: false
default: ""
description: "The minimum severity required to display a warning"
error_severity:
required: false
default: ""
@@ -42,72 +32,90 @@ inputs:
default: 'false'
required: false
composer_auth:
required: false
default: ""
description: "Composer authentication credentials (contents of auth.json as a JSON string)"
runs:
using: composite
steps:
- name: Checkout Project
uses: actions/checkout@v6
with:
fetch-depth: 0
path: project
- name: Create Standard Directory
- name: Check if Coding Standard is already installed
id: check-installed
shell: bash
run: mkdir standard
- name: Set PHP Version
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php_version }}
tools: composer:v${{ inputs.composer_version }}
coverage: none
working-directory: ${{ inputs.path }}
run: |
if [ -d "vendor/magento/magento-coding-standard" ] || [ -d "vendor/mage-os/magento-coding-standard" ]; then
echo "installed=true" >> $GITHUB_OUTPUT
else
echo "installed=false" >> $GITHUB_OUTPUT
fi
- name: Get Composer Version
uses: graycoreio/github-actions-magento2/get-composer-version@main
uses: graycoreio/github-actions-magento2/get-composer-version@v7.0.0
id: get-composer-version
if: steps.check-installed.outputs.installed != 'true'
- name: Check if allow-plugins option is available for this version of composer
uses: graycoreio/github-actions-magento2/semver-compare@main
uses: graycoreio/github-actions-magento2/semver-compare@v7.0.0
id: is-allow-plugins-available
if: steps.check-installed.outputs.installed != 'true'
with:
version: 2.2
compare_against: ${{ steps.get-composer-version.outputs.version }}
id: is-allow-plugins-available
- name: Enable dealerdirect/phpcodesniffer-composer-installer plugin
shell: bash
working-directory: standard
run: composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true --global
if: steps.is-allow-plugins-available.outputs.result < 1
working-directory: ${{ inputs.path }}
run: composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true --global
if: steps.check-installed.outputs.installed != 'true' && steps.is-allow-plugins-available.outputs.result < 1
- name: Install Coding Standard
shell: bash
working-directory: standard
run: composer require "magento/magento-coding-standard:${{ inputs.version || '*' }}"
working-directory: ${{ inputs.path }}
run: composer require "magento/magento-coding-standard:${{ inputs.version || '*' }}" "magento/php-compatibility-fork"
if: steps.check-installed.outputs.installed != 'true'
env:
COMPOSER_AUTH: ${{ inputs.composer_auth }}
- name: Register Coding Standard
shell: bash
working-directory: standard
run: vendor/bin/phpcs --config-set installed_paths ${{ github.workspace }}/standard/vendor/magento/magento-coding-standard,${{ github.workspace }}/standard/vendor/magento/php-compatibility-fork
working-directory: ${{ inputs.path }}
run: |
if [ -d vendor/magento/magento-coding-standard ]; then
CODING_STANDARD_VENDOR=magento
elif [ -d vendor/mage-os/magento-coding-standard ]; then
CODING_STANDARD_VENDOR=mage-os
else
echo "No magento-coding-standard directory found under vendor/magento or vendor/mage-os."
echo "Trusting dealerdirect/phpcodesniffer-composer-installer to have registered installed_paths."
exit 0
fi
vendor/bin/phpcs --config-set installed_paths \
"vendor/${CODING_STANDARD_VENDOR}/magento-coding-standard,vendor/${CODING_STANDARD_VENDOR}/php-compatibility-fork"
if: steps.check-installed.outputs.installed != 'true'
- name: Set ignore warnings flag
shell: bash
working-directory: standard
working-directory: ${{ inputs.path }}
run: vendor/bin/phpcs --config-set ignore_warnings_on_exit 1
if: inputs.ignore_warnings == 'true'
- name: Get Changed Files
shell: bash
working-directory: project
id: changed-files
run: echo "files=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | xargs)" >> $GITHUB_OUTPUT
if: github.event_name == 'pull_request'
- name: Coding Standard Check
shell: bash
working-directory: ${{ inputs.path }}
run: |
../standard/vendor/bin/phpcs --standard=Magento2 \
$([ -n "${{ inputs.severity }}" ] && echo "--severity=${{ inputs.severity }}") \
$([ -n "${{ inputs.warning_severity }}" ] && echo "--warning-severity=${{ inputs.warning_severity }}") \
$([ -n "${{ inputs.error_severity }}" ] && echo "--error-severity=${{ inputs.error_severity }}") \
${{ github.event_name == 'pull_request' && steps.changed-files.outputs.files || inputs.path }}
working-directory: project
FLAGS=()
[ -n "${{ inputs.severity }}" ] && FLAGS+=(--severity=${{ inputs.severity }}) || true
[ -n "${{ inputs.warning_severity }}" ] && FLAGS+=(--warning-severity=${{ inputs.warning_severity }}) || true
[ -n "${{ inputs.error_severity }}" ] && FLAGS+=(--error-severity=${{ inputs.error_severity }}) || true
if [ -f .phpcs.xml ] || [ -f phpcs.xml ] || [ -f .phpcs.xml.dist ] || [ -f phpcs.xml.dist ]; then
vendor/bin/phpcs "${FLAGS[@]}" .
else
vendor/bin/phpcs --standard=Magento2 --ignore=*vendor/* "${FLAGS[@]}" .
fi
branding:
icon: "code"
color: "green"
+40
View File
@@ -0,0 +1,40 @@
# What belongs in a composite action
A composite action should do one thing. The guiding test: **can a caller reasonably want to skip part of what this action does, independently of the rest?** If yes, those parts should be separate actions that the caller composes themselves.
## Good fits for a composite action
**A single tool installation paired with its execution.** Install the tool, run it, done. `coding-standard` installs PHPCS and runs it. `fix-magento-install` applies a known set of patches. The install and the run are not independently useful — splitting them would add complexity with no benefit.
**A utility that extracts and exposes a single value.** `get-composer-version`, `get-magento-version`, and `semver-compare` each run one or two commands and write an output. These exist because their output is needed inline by the next step in the same job. That is the right scope for a composite action.
**A setup operation with a well-defined end state.** `cache-magento` leaves the Composer cache populated. `setup-magento` leaves a Magento project at a known path. The caller gets a clear postcondition and nothing else.
## Signs an action is too broad
**It bundles independent setup concerns with execution.** Imagine a `unit-test` action that sets up PHP, installs Composer dependencies, and then runs the test command. These three things can each be wanted or skipped independently. A caller whose job already has PHP set up cannot avoid step 1. A caller that wants to run tests against already-installed dependencies cannot avoid step 2.
The right scope is just the execution step:
```yaml
inputs:
test_command:
required: true
default: composer run test
source_folder:
required: true
default: .
runs:
using: composite
steps:
- run: ${{ inputs.test_command }}
shell: bash
working-directory: ${{ inputs.source_folder }}
```
The caller is then responsible for composing `setup-php`, `cache-magento`, and `composer install` before calling it — each of which is already a separate action in this repo.
**It reimplements logic that already exists in another action.** If a new action rolls its own Composer caching inline rather than calling `cache-magento`, that creates two different cache key strategies in the same repo and makes it harder to update caching behavior consistently.
**The name describes a pipeline, not a step.** Names like "install and test" or "build and deploy" are warning signs. A good action name describes what state it produces or what it checks — not a sequence of operations.
+1 -1
View File
@@ -9,7 +9,7 @@ inputs:
runs:
using: "composite"
steps:
- uses: graycoreio/github-actions-magento2/get-magento-version@main
- uses: graycoreio/github-actions-magento2/get-magento-version@v7.0.0
id: init-magento-get-magento-version
with:
working-directory: ${{ inputs.magento_directory }}
-48
View File
@@ -1,48 +0,0 @@
# Magento 2 Package Installation Test Action
A Github Action that tests the installability of a Magento Package
## Inputs
See the [action.yml](./action.yml)
## Usage
```yml
name: Installation Test
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
compute_matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.supported-version.outputs.matrix }}
steps:
- uses: actions/checkout@v6
- uses: graycoreio/github-actions-magento2/supported-version@main
id: supported-version
- run: echo ${{ steps.supported-version.outputs.matrix }}
install-test:
needs: compute_matrix
strategy:
matrix: ${{ fromJSON(needs.compute_matrix.outputs.matrix) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: graycoreio/github-actions-magento2/installation-test@main
with:
composer_version: ${{ matrix.composer }}
php_version: ${{ matrix.php }}
magento_version: ${{ matrix.magento }}
composer_auth: ${{ secrets.COMPOSER_AUTH }}
package_name: vendor/package
source_folder: $GITHUB_WORKSPACE
```
-122
View File
@@ -1,122 +0,0 @@
name: "Installation Test"
author: "Graycore"
description: " A Github Action that tests the installability of a Magento Package"
inputs:
php_version:
required: true
default: "8.1"
description: "PHP Version to use"
cache_key:
required: true
default: "2"
description: "The cache key used to hold Composer Packages"
composer_version:
required: true
default: "2"
description: "The version of composer to use"
use_local_source:
required: false
default: "true"
description: "Whether or not you want to test your local package or not."
source_folder:
required: true
default: $GITHUB_WORKSPACE
description: "The source folder of the package"
package_name:
required: true
description: "The name of the package"
magento_directory:
required: true
default: "../magento2"
description: "The folder where Magento will be installed"
magento_version:
required: true
default: "magento/project-community-edition"
description: "The version of Magento to test against"
magento_repository:
required: true
default: "https://mirror.mage-os.org/"
description: "Where to install Magento from"
composer_cache_key:
required: false
default: ''
description: A key to version the composer cache. Can be incremented if you need to bust the cache.
composer_auth:
required: false
description: "Composer Authentication Credentials"
runs:
using: "composite"
steps:
- name: Set PHP Version
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php_version }}
- run: composer self-update ${{ inputs.composer_version }}
name: Pin to Composer Version ${{ inputs.composer_version }}
if: contains(inputs.composer_version, '.') == true
shell: bash
- run: composer self-update --${{ inputs.composer_version }}
name: Pin to Composer Version ${{ inputs.composer_version }} (Range)
if: contains(inputs.composer_version, '.') == false
shell: bash
- run: composer create-project --repository-url="${{ inputs.magento_repository }}" "${{ inputs.magento_version }}" ${{ inputs.magento_directory }} --no-install
shell: bash
env:
COMPOSER_AUTH: ${{ inputs.composer_auth }}
name: Create Magento ${{ inputs.magento_version }} Project
- name: Get Composer Cache Directory
shell: bash
working-directory: ${{ inputs.magento_directory }}
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: "Cache Composer Packages"
uses: actions/cache@v5
with:
key: "composer | v5 | ${{ inputs.composer_cache_key }} | ${{ hashFiles('composer.lock') }} | ${{ runner.os }} | ${{ inputs.composer_version }} | ${{ inputs.php_version }} | ${{ inputs.magento_version }}"
path: ${{ steps.composer-cache.outputs.dir }}
- run: composer config repositories.local path ${{ inputs.source_folder }}
name: Add Github Repo for Testing
working-directory: ${{ inputs.magento_directory }}
shell: bash
if: ${{ inputs.use_local_source == 'true' }}
- run: |
composer config --no-interaction allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer config --no-interaction allow-plugins.laminas/laminas-dependency-plugin true
composer config --no-interaction allow-plugins.magento/* true
name: Fixup Composer Plugins
shell: bash
working-directory: ${{ inputs.magento_directory }}
if: ${{ !startsWith(inputs.composer_version, '1') }}
- run: composer require ${{ inputs.package_name }} "@dev" --no-update && composer install
name: Require and attempt install
working-directory: ${{ inputs.magento_directory }}
shell: bash
env:
COMPOSER_CACHE_DIR: ${{ steps.composer-cache.outputs.dir }}
COMPOSER_AUTH: ${{ inputs.composer_auth }}
branding:
icon: "code"
color: "green"
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "@graycoreio/github-actions-magento2",
"version": "6.0.0",
"version": "7.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@graycoreio/github-actions-magento2",
"version": "6.0.0",
"version": "7.0.0",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.11.1"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@graycoreio/github-actions-magento2",
"version": "6.0.0",
"version": "7.0.0",
"description": "Github Actions for Magento 2",
"scripts": {
"test": "cd supported-version && npm run test && cd -",
+1 -1
View File
@@ -90,7 +90,7 @@ runs:
env:
COMPOSER_AUTH: ${{ inputs.composer_auth }}
- uses: graycoreio/github-actions-magento2/fix-magento-install@main
- uses: graycoreio/github-actions-magento2/fix-magento-install@v7.0.0
name: Fix Magento Out of Box Install Issues
with:
magento_directory: ${{ steps.setup-magento-compute-directory.outputs.MAGENTO_DIRECTORY }}
+1 -1
View File
@@ -24,7 +24,7 @@ inputs:
include_services:
required: false
default: "false"
default: "true"
description: "Whether to include a `services` key in each matrix entry with GitHub Actions service configurations."
outputs:
+13 -13
View File
File diff suppressed because one or more lines are too long
@@ -132,6 +132,12 @@ describe('getCurrentlySupportedVersions for mage-os', () => {
['2025-09-09T00:00:01Z', 'Release of 1.3.1', [
'mage-os/project-community-edition:1.3.1',
]],
['2026-03-10T00:00:01Z', 'Release of 2.2.0', [
'mage-os/project-community-edition:2.2.0',
]],
['2026-04-15T00:00:01Z', 'Release of 2.2.2', [
'mage-os/project-community-edition:2.2.2',
]],
])(
'supportedVersions for %s',
(date, description ,result) => {
+43 -1
View File
@@ -25,7 +25,7 @@ describe('getUsableVersions for magento-open-source', () => {
'magento/project-community-edition:2.4.5': { composer: '1.9.0' },
'magento/project-community-edition:2.4.6': { composer: '2.2.0' }
});
const versions = getUsableVersions(project);
expect(versions).not.toContain('magento/project-community-edition:2.4.5');
expect(versions).toContain('magento/project-community-edition:2.4.6');
@@ -50,4 +50,46 @@ describe('getUsableVersions for magento-open-source', () => {
expect(versions).not.toContain('magento/project-community-edition:2.3.7-p3');
expect(versions).toContain('magento/project-community-edition:2.4.6');
});
it('should filter out uninstallable Magento 2.4.2.x and 2.4.3.x versions', () => {
mockGetVersions.mockReturnValue({
'magento/project-community-edition:2.4.2': { composer: '2.2.21' },
'magento/project-community-edition:2.4.2-p1': { composer: '2.2.21' },
'magento/project-community-edition:2.4.2-p2': { composer: '2.2.21' },
'magento/project-community-edition:2.4.3': { composer: '2.2.21' },
'magento/project-community-edition:2.4.3-p1': { composer: '2.2.21' },
'magento/project-community-edition:2.4.3-p2': { composer: '2.2.21' },
'magento/project-community-edition:2.4.3-p3': { composer: '2.2.21' },
'magento/project-community-edition:2.4.4': { composer: '2.2.21' }
});
const versions = getUsableVersions(project);
expect(versions).not.toContain('magento/project-community-edition:2.4.2');
expect(versions).not.toContain('magento/project-community-edition:2.4.2-p1');
expect(versions).not.toContain('magento/project-community-edition:2.4.2-p2');
expect(versions).not.toContain('magento/project-community-edition:2.4.3');
expect(versions).not.toContain('magento/project-community-edition:2.4.3-p1');
expect(versions).not.toContain('magento/project-community-edition:2.4.3-p2');
expect(versions).not.toContain('magento/project-community-edition:2.4.3-p3');
expect(versions).toContain('magento/project-community-edition:2.4.4');
});
});
describe('getUsableVersions for mage-os', () => {
const project: Project = "mage-os";
beforeEach(() => {
mockGetVersions.mockReset();
});
it('should filter out mage-os 2.2.1 due to security advisory', () => {
mockGetVersions.mockReturnValue({
'mage-os/project-community-edition:2.2.0': { composer: '2.9.3' },
'mage-os/project-community-edition:2.2.1': { composer: '2.9.3' }
});
const versions = getUsableVersions(project);
expect(versions).not.toContain('mage-os/project-community-edition:2.2.1');
expect(versions).toContain('mage-os/project-community-edition:2.2.0');
});
});
+23
View File
@@ -2,6 +2,24 @@ import { PackageMatrixVersion } from '../matrix/matrix-type';
import { getIndividualVersionsForProject } from "../versions/get-versions-for-project";
import semver from 'semver';
/**
* Versions that are known to be uninstallable and should be excluded from the usable set.
* Each entry includes a reason for documentation purposes.
*/
const uninstallableVersions: Record<string, string> = {
// magento/composer-root-update-plugin ~1.1 requires composer/composer <=2.1,
// but all composer versions <=2.1 are insecure and cannot be used.
'magento/project-community-edition:2.4.2': 'requires insecure composer <=2.1',
'magento/project-community-edition:2.4.2-p1': 'requires insecure composer <=2.1',
'magento/project-community-edition:2.4.2-p2': 'requires insecure composer <=2.1',
'magento/project-community-edition:2.4.3': 'requires insecure composer <=2.1',
'magento/project-community-edition:2.4.3-p1': 'requires insecure composer <=2.1',
'magento/project-community-edition:2.4.3-p2': 'requires insecure composer <=2.1',
'magento/project-community-edition:2.4.3-p3': 'requires insecure composer <=2.1',
// Security advisory in webonyx/graphql-php prevents installation.
'mage-os/project-community-edition:2.2.1': 'uninstallable due to webonyx/graphql-php security advisory',
};
export const getUsableVersions = (project: string): string[] => {
const allVersions = getIndividualVersionsForProject(project)
return Object.entries(<Record<string,PackageMatrixVersion>>allVersions)
@@ -17,6 +35,11 @@ export const getUsableVersions = (project: string): string[] => {
return false;
}
// Exclude versions known to be uninstallable.
if (key in uninstallableVersions) {
return false;
}
return true;
})
.map(([key, value]) => key);
@@ -2,30 +2,32 @@
"mage-os/project-community-edition": {
"magento": "mage-os/project-community-edition",
"php": 8.4,
"composer": "2.9.5",
"composer": "2.9.7",
"mysql": "mysql:8.4",
"opensearch": "opensearchproject/opensearch:3",
"rabbitmq": "rabbitmq:4.1-management",
"valkey": "valkey/valkey:8.0",
"redis": "redis:7.2",
"varnish": "varnish:7.7",
"nginx": "nginx:1.28",
"os": "ubuntu-latest",
"release": "2026-03-10T00:00:00+0000",
"eol": "2029-03-10T00:00:00+0000"
"release": "2026-04-15T00:00:00+0000",
"eol": "2029-04-15T00:00:00+0000"
},
"mage-os/project-community-edition:next": {
"magento": "mage-os/project-community-edition:next",
"php": 8.4,
"composer": "2.9.5",
"composer": "2.9.7",
"mysql": "mysql:8.4",
"opensearch": "opensearchproject/opensearch:3",
"rabbitmq": "rabbitmq:4.1-management",
"valkey": "valkey/valkey:8.0",
"redis": "redis:7.2",
"varnish": "varnish:7.7",
"nginx": "nginx:1.28",
"os": "ubuntu-latest",
"release": "2026-03-10T00:00:00+0000",
"eol": "2029-03-10T00:00:00+0000"
"release": "2026-04-15T00:00:00+0000",
"eol": "2029-04-15T00:00:00+0000"
},
"mage-os/project-community-edition:>=1.0 <1.1": {
"magento": "mage-os/project-community-edition:>=1.0 <1.1",
@@ -119,10 +121,11 @@
"opensearch": "opensearchproject/opensearch:3",
"rabbitmq": "rabbitmq:4.1-management",
"valkey": "valkey/valkey:8.0",
"redis": "redis:7.2",
"varnish": "varnish:7.7",
"nginx": "nginx:1.28",
"os": "ubuntu-latest",
"release": "2026-03-10T00:00:00+0000",
"eol": "2029-03-10T00:00:00+0000"
"eol": "2029-04-15T00:00:00+0000"
}
}
@@ -222,6 +222,37 @@
"nginx": "nginx:1.28",
"os": "ubuntu-latest",
"release": "2026-03-10T00:00:00+0000",
"eol": "2029-03-10T00:00:00+0000"
"eol": "2026-03-18T00:00:00+0000"
},
"mage-os/project-community-edition:2.2.1": {
"magento": "mage-os/project-community-edition:2.2.1",
"upstream": "2.4.8-p4",
"php": 8.4,
"composer": "2.9.5",
"mysql": "mysql:8.4",
"opensearch": "opensearchproject/opensearch:3",
"rabbitmq": "rabbitmq:4.1-management",
"valkey": "valkey/valkey:8.0",
"varnish": "varnish:7.7",
"nginx": "nginx:1.28",
"os": "ubuntu-latest",
"release": "2026-03-18T00:00:00+0000",
"eol": "2026-04-15T00:00:00+0000"
},
"mage-os/project-community-edition:2.2.2": {
"magento": "mage-os/project-community-edition:2.2.2",
"upstream": "2.4.8-p4",
"php": 8.4,
"composer": "2.9.7",
"mysql": "mysql:8.4",
"opensearch": "opensearchproject/opensearch:3",
"rabbitmq": "rabbitmq:4.1-management",
"valkey": "valkey/valkey:8.0",
"redis": "redis:7.2",
"varnish": "varnish:7.7",
"nginx": "nginx:1.28",
"os": "ubuntu-latest",
"release": "2026-04-15T00:00:00+0000",
"eol": "2029-04-15T00:00:00+0000"
}
}
-36
View File
@@ -1,36 +0,0 @@
# Magento 2 Unit Test Action
A Github Action that runs the Unit Tests of a Magento Package
## Inputs
See the [action.yml](./action.yml)
## Usage
```yml
name: Unit Test
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
unit-test:
strategy:
matrix:
php_version:
- 7.4
- 8.1
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: graycoreio/github-actions-magento2/unit-test@main
with:
php_version: ${{ matrix.php_version }}
composer_auth: ${{ secrets.COMPOSER_AUTH }}
```
-63
View File
@@ -1,63 +0,0 @@
name: "Unit Test"
author: "Graycore"
description: "A Github Action that runs the Unit Tests of a Magento Package"
inputs:
php_version:
required: true
default: "8.4"
description: "PHP Version to use"
source_folder:
required: true
default: .
description: "The source folder of the package"
test_command:
required: true
default: composer run test
description: "The test command"
composer_auth:
required: false
description: "Composer Authentication Credentials"
runs:
using: "composite"
steps:
- name: Set PHP Version
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php_version }}
- name: Get Composer Cache Directory
shell: bash
working-directory: ${{ inputs.source_folder }}
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: "Cache Composer Packages"
uses: actions/cache@v5
with:
key: "composer | v4 | ${{ hashFiles('composer.lock') }} | ${{ runner.os }} | ${{ inputs.php_version }}"
path: ${{ steps.composer-cache.outputs.dir }}
- run: composer install
name: Require and attempt install
working-directory: ${{ inputs.source_folder }}
shell: bash
env:
COMPOSER_CACHE_DIR: ${{ steps.composer-cache.outputs.dir }}
COMPOSER_AUTH: ${{ inputs.composer_auth }}
- run: ${{ inputs.test_command }}
name: Run Unit Tests
working-directory: ${{ inputs.source_folder }}
shell: bash
env:
COMPOSER_CACHE_DIR: ${{ steps.composer-cache.outputs.dir }}
COMPOSER_AUTH: ${{ inputs.composer_auth }}
branding:
icon: "code"
color: "green"