{"id":25900345,"url":"https://github.com/julienloizelet/github-actions-magento2-ddev-installation","last_synced_at":"2025-03-03T02:01:55.536Z","repository":{"id":59433376,"uuid":"526117680","full_name":"julienloizelet/magento2-ddev-installation","owner":"julienloizelet","description":"A GitHub Action to install Magento 2 with DDEV","archived":false,"fork":false,"pushed_at":"2024-05-15T06:19:35.000Z","size":75,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-15T22:01:14.103Z","etag":null,"topics":["ddev","github-action","magento2"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/julienloizelet.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-18T08:11:31.000Z","updated_at":"2024-06-07T09:12:18.281Z","dependencies_parsed_at":"2023-01-11T17:23:25.309Z","dependency_job_id":"718689a8-6986-4ada-9da3-af91fa07c275","html_url":"https://github.com/julienloizelet/magento2-ddev-installation","commit_stats":null,"previous_names":["julienloizelet/github-actions-magento2-ddev-installation"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julienloizelet%2Fmagento2-ddev-installation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julienloizelet%2Fmagento2-ddev-installation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julienloizelet%2Fmagento2-ddev-installation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julienloizelet%2Fmagento2-ddev-installation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/julienloizelet","download_url":"https://codeload.github.com/julienloizelet/magento2-ddev-installation/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241596243,"owners_count":19988043,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ddev","github-action","magento2"],"created_at":"2025-03-03T02:01:40.817Z","updated_at":"2025-03-03T02:01:55.488Z","avatar_url":"https://github.com/julienloizelet.png","language":"Shell","funding_links":[],"categories":["GitHub Actions"],"sub_categories":[],"readme":"# Magento 2 installation with DDEV\n\n[![Version](https://img.shields.io/github/v/release/julienloizelet/magento2-ddev-installation)](https://github.com/julienloizelet/magento2-ddev-installation/releases)\n[![Installation with Varnish](https://github.com/julienloizelet/magento2-ddev-installation/actions/workflows/module-with-varnish-test.yml/badge.svg)](https://github.com/julienloizelet/magento2-ddev-installation/actions/workflows/module-with-varnish-test.yml)\n[![Installation with Static and Unit tests](https://github.com/julienloizelet/magento2-ddev-installation/actions/workflows/module-with-static-and-unit-tests.yml/badge.svg)](https://github.com/julienloizelet/magento2-ddev-installation/actions/workflows/module-with-static-and-unit-tests.yml)\n[![End-to-end tests](https://github.com/julienloizelet/magento2-ddev-installation/actions/workflows/module-with-end-to-end-tests.yml/badge.svg)](https://github.com/julienloizelet/magento2-ddev-installation/actions/workflows/module-with-end-to-end-tests.yml)\n[![MFTF tests](https://github.com/julienloizelet/magento2-ddev-installation/actions/workflows/mftf-tests.yml/badge.svg)](https://github.com/julienloizelet/magento2-ddev-installation/actions/workflows/mftf-tests.yml)\n\nA GitHub Action to install Magento 2 with [DDEV](https://github.com/ddev/ddev).\n\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n**Table of Contents**\n\n- [Quick start](#quick-start)\n- [Inputs](#inputs)\n  - [Available keys](#available-keys)\n  - [Examples](#examples)\n- [Outputs](#outputs)\n- [Usage](#usage)\n  - [Test your Magento 2 instance](#test-your-magento-2-instance)\n  - [Test a module](#test-a-module)\n- [Technical details](#technical-details)\n- [License](#license)\n- [Contribute](#contribute)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## Quick start\n\n_We will suppose here that you want to test on a Magento 2.4.5 instance with PHP 8.1._\n\nYou can add the following step in your workflow:\n\n```yaml\n- uses: julienloizelet/magento2-ddev-installation@v3\n  with:\n    php_version: \"8.1\"\n    magento_version: \"2.4.5\"\n```\n\nThis step will install a Magento `2.4.5` instance with PHP `8.1`.\n\nIn the steps that follow, you will be able to run any DDEV commands to interact with the Magento 2 environment.\n\n\n## Inputs\n\n\n### Available keys\n\nThe following keys are available as `step.with` keys:\n\n---\n- `php_version` (_String_)\n\nPHP version to use in the web container.\n\nDefault: `8.2`.\n\nAllowed values are: `7.2`, `7.3`, `7.4`, `8.1`, `8.2`, `8.3`.\n\nPlease choose a PHP version that is compatible with the `magento_version` below.\n\n---\n- `database` (_String_)\n\nDatabase version and type to use.\n\nDefault: Empty.\n\nAdmissible values are [those allowed by DDEV](https://ddev.readthedocs.io/en/stable/users/extend/database-types/).\n\nIf empty, `mariadb:10.2` will be used for Magento version \u003c 2.4.1 and `mariadb:10.4` for Magento version \u003e= 2.4.1.\n\nPlease choose a DDEV database version and type that is compatible with the `magento_version` below.\n\n\n---\n- `magento_repository` (_String_)\n\nWhere to install Magento from. \n\nDefault: `https://mirror.mage-os.org/`.\n\nCould be \"https://mirror.mage-os.org/\", \"https://repo.magento.com/\" or any available repository.\n\nPlease choose a repository that handle the `magento_version` below.\n\n---\n- `magento_edition` (_String_)\n\nThe edition of Magento to install. \n\nDefault: `magento/project-community-edition`\n\nCould be \"magento/project-community-edition\", \"magento/project-enterprise-edition\" or any available edition.\n\n---\n- `magento_version` (_String_)\n\nThe Magento release version to install.  \n\nDefault: `2.4.7`.\n\nYou can use `X.Y.Z` format or `X.Y.Z-pN` format for patch release.\n\nAllowed versions are `2.3.0`, `2.3.1`, `2.3.2`, `2.3.3`, `2.3.4`, `2.3.5`, `2.3.6`, `2.3.7`, `2.4.0`,\n  `2.4.1`, `2.4.2`, `2.4.3`,`2.4.4`, `2.4.5`, `2.4.6`, `2.4.7` and any of their patches versions. \n\nPlease note that available versions depend on the chosen `magento_repository`.\n\n---\n- `composer_auth` (_String_)\n\nComposer authentication credentials. \n\nDefault: `\"\"`.\n\n\nYou have to pass a JSON string. For example:\n```json\n{\n  \"http-basic\": {\n    \"repo.magento.com\": {\n      \"username\": \"**********************\",\n      \"password\": \"**********************\"\n    }\n  }\n}\n```\nAs GitHub allows saving multiline secret, you can use a secret to store this sensitive value. Just copy/paste the \njson in a `M2_COMPOSER_AUTH` secret and use it like this: `composer_auth: ${{ secrets.M2_COMPOSER_AUTH }}`.\n\n---\n\n- `varnish_setup` (_Boolean_)\n\nInstall with ready-to-use Varnish. \n\nDefault: `false`.\n\n\nYou should use quote to set true:  `varnish_setup: \"true\"`.\n\n---\n\n\n### Examples\n\n- Magento `2.3.7-p4` (`magento/project-community-edition`) , from `https://repo.magento.com/`, with PHP `7.4` and \n  without Varnish:\n\n```\nwith:\n  php_version: \"7.4\"\n  magento_version: \"2.3.7-p4\"\n  magento_repository: \"https://repo.magento.com/\"\n  composer_auth: ${{ secrets.M2_COMPOSER_AUTH }}\n```\n\n- Magento `2.4.4` (`magento/project-community-edition`) , from `https://mirror.mage-os.org/`, with PHP `8.1` and\n  with Varnish:\n\n\n```\nwith:\n  php_version: \"8.1\"\n  magento_version: \"2.4.4\"\n  varnish_setup: \"true\"\n```\n\n## Outputs\n\nThe following keys are available as `outputs` keys:\n\n---\n- `m2_url` (_String_)\n\nThe freshly installed Magento 2 instance url. Example: `https://m245.ddev.site`.\n\n\n---\n\n\n\n## Usage\n\n### Test your Magento 2 instance\n\nYou could run all the DDEV basic commands and some specific ones coming from some DDEV add-ons\n\n\n#### Examples\n\nFor example, you could run these commands in some other steps: \n\n```shell\nddev magento config:set admin/security/password_is_forced 0\nddev magento config:set admin/security/password_lifetime 0\nddev magento module:disable Magento_TwoFactorAuth\nddev magento indexer:reindex\nddev magento c:c\n```\n\n#### MFTF\n\nIf you want to use the [Magento Functional Testing Framework](https://devdocs.magento.com/mftf/docs/introduction.html),\nhere is an example of implementation : [MFTF tests](.github/workflows/mftf-tests.yml)\n\n\n### Test a module\n\nOnce you have run this action, you will be able to install and activate a module. Thus, you will be able to run all \nkind of tests : static tests (coding standards), unit tests, integration tests, or any other end-to-end tests.\n\n#### Examples\n\nBefore reading below, you could read the examples here: \n- [Static and Unit test of a module](.github/workflows/module-with-static-and-unit-tests.yml)\n- [Installation and Varnish test of a module](.github/workflows/module-with-varnish-test.yml)\n- [End-to-end tests of a module](.github/workflows/module-with-end-to-end-tests.yml)\n\n\n#### How to\n\nTo do that, you could use the following folder structure : \n\n```markdown\n$GITHUB_WORKSPACE\n│   \n│ (Magento 2 sources installed with composer)    \n│\n└───.ddev\n│   │   \n│   │ (DDEV files)\n│   \n└───my-own-modules\n    │   \n    │\n    └───\u003csome-path\u003e\n       │   \n       │ (Sources of a module)\n         \n```\n\n\nby adapting the following steps: \n\n```yaml\n- name: Clone module files\n  uses: actions/checkout@v4\n  with:\n    path: my-own-modules/\u003csome-path\u003e\n```\n\n```yaml\n- name: Prepare composer repositories\n  run: |\n      ddev composer config --unset repositories.0\n      ddev composer config repositories.0 '{\"type\": \"path\", \"url\":\"my-own-modules/\u003csome-path\u003e\",  \"canonical\": true, \"options\": {\"symlink\": false}}'\n      ddev composer config repositories.1 '{\"type\": \"composer\", \"url\":\"\u003cthe-magento-repository\u003e\",  \"exclude\": [\"\u003csome-package-name\u003e\"]}'\n```\n\n```yaml\n- name: Add module as composer dependency\n  run: ddev composer require \u003csome-package-name\u003e:@dev --no-interaction\n```\n\n```yaml\n- name: Install module\n  run: |\n    ddev magento module:enable \u003csome-extension-name\u003e\n    ddev magento setup:upgrade\n```\n\n\nThen, you could run: \n\n\n- PHP Code Sniffer: `ddev phpcs my-own-modules/\u003csome-path\u003e`\n- PHP Mess Detector: `ddev phpmd my-own-modules/\u003csome-path\u003e`\n- PHP Stan: `ddev phpstan my-own-modules/\u003csome-path\u003e`\n- Unit test: `ddev phpunit my-own-modules/\u003csome-path\u003e/Test/Unit`\n\n\n\n## Technical details\n\nFor you information, the setup of Magento 2 is launch with the following settings:\n\n```shell\nbin/magento setup:install \\\n   --base-url=https://m245.ddev.site \\\n   --db-host=db \\\n   --db-name=db \\\n   --db-user=db \\\n   --db-password=db \\\n   --backend-frontname=admin \\\n   --admin-firstname=admin \\\n   --admin-lastname=admin \\\n   --admin-email=admin@admin.com \\\n   --admin-user=admin \\\n   --admin-password=admin123 \\\n   --language=en_US \\\n   --currency=USD \\\n   --timezone=America/Chicago \\\n   --use-rewrites=1 \\\n   --elasticsearch-host=elasticsearch --search-engine=elasticsearch7\n```\n\n\nThe Magento 2 environment is a Docker environment created  with DDEV and comes with the following services:\n- `web`: PHP (version depends on `php_version` input), nginx-fpm, NodeJs\n- `db`: Depends on the `database` input\n- `elastisearch`\n- `memcached`\n- `redis`\n\n\nFinally, the structure of your `$GITHUB_WORKSPACE` will look like below.\n\n\n```markdown\n$GITHUB_WORKSPACE\n│   \n│ (Magento 2 sources installed with composer)    \n│\n└───.ddev\n    │   \n    │ (DDEV files)\n```\n\n## License\n\n[MIT](LICENSE)\n\n## Contribute\n\nAnyone is welcome to submit a pull request to this repository.\n\n\n**Contributed and maintained by [julienloizelet](https://github.com/julienloizelet)**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjulienloizelet%2Fgithub-actions-magento2-ddev-installation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjulienloizelet%2Fgithub-actions-magento2-ddev-installation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjulienloizelet%2Fgithub-actions-magento2-ddev-installation/lists"}