| 
 | 1 | +name: 'Setup Magento'  | 
 | 2 | +description: 'Setup Magento'  | 
 | 3 | +inputs:  | 
 | 4 | +  php-version:  | 
 | 5 | +    description: 'PHP version'  | 
 | 6 | +    required: true  | 
 | 7 | +  magento-version:  | 
 | 8 | +    description: 'Magento version'  | 
 | 9 | +    required: true  | 
 | 10 | +outputs:  | 
 | 11 | +  docker-container-name:  | 
 | 12 | +    description: 'Docker container name'  | 
 | 13 | +    value: ${{ steps.variables.outputs.docker_container_name }}  | 
 | 14 | + | 
 | 15 | + | 
 | 16 | +runs:  | 
 | 17 | +  using: "composite"  | 
 | 18 | +  steps:  | 
 | 19 | +    - name: Install xmllint  | 
 | 20 | +      shell: bash  | 
 | 21 | +      run: sudo apt install -y libxml2-utils  | 
 | 22 | + | 
 | 23 | +    - name: Set variables  | 
 | 24 | +      shell: bash  | 
 | 25 | +      id: variables  | 
 | 26 | +      run: |  | 
 | 27 | +        echo "composer_name=$(cat composer.json | jq .name -r)" >> $GITHUB_OUTPUT  | 
 | 28 | +        echo "extension_name=$(xmllint --xpath 'string(/config/module/@name)' etc/module.xml)" >> $GITHUB_OUTPUT  | 
 | 29 | +        echo "directory=$(cat composer.json | jq .name -r | cut -d '/' -f2)" >> $GITHUB_OUTPUT  | 
 | 30 | +        echo "branch_name=continuous-integration-test-branch-v2" >> $GITHUB_OUTPUT  | 
 | 31 | +        echo "docker_container_name=magento-project-community-edition" >> $GITHUB_OUTPUT  | 
 | 32 | +
  | 
 | 33 | +    - name: Start Docker  | 
 | 34 | +      shell: bash  | 
 | 35 | +      run: PHP_VERSION=${{ inputs.php-version }} MAGENTO_VERSION=magento${{ inputs.magento-version }} docker compose -f .github/actions/setup/templates/docker-compose.yml up -d  | 
 | 36 | + | 
 | 37 | +    - name: Create branch for Composer  | 
 | 38 | +      shell: bash  | 
 | 39 | +      run: git checkout -b ${{ steps.variables.outputs.branch_name }}  | 
 | 40 | + | 
 | 41 | +    - name: Upload our code into the docker container  | 
 | 42 | +      shell: bash  | 
 | 43 | +      run: docker cp $(pwd) ${{ steps.variables.outputs.docker_container_name }}:/data/extensions/  | 
 | 44 | + | 
 | 45 | +    - name: Add git safe directory  | 
 | 46 | +      shell: bash  | 
 | 47 | +      run: docker exec ${{ steps.variables.outputs.docker_container_name }} git config --global --add safe.directory /data/extensions/${{ steps.variables.outputs.directory }}  | 
 | 48 | + | 
 | 49 | +    - name: Install the extension in Magento  | 
 | 50 | +      shell: bash  | 
 | 51 | +      run: docker exec ${{ steps.variables.outputs.docker_container_name }} ./install-composer-package ${{ steps.variables.outputs.composer_name }}:@dev  | 
 | 52 | + | 
 | 53 | +    - name: Install dev dependencies  | 
 | 54 | +      shell: bash  | 
 | 55 | +      run: |  | 
 | 56 | +        docker exec ${{ steps.variables.outputs.docker_container_name }} bash -c "composer require --dev vendic/magento-coding-standard tddwizard/magento2-fixtures"  | 
 | 57 | +
  | 
 | 58 | +    - name: Activate the extension  | 
 | 59 | +      shell: bash  | 
 | 60 | +      run: docker exec ${{ steps.variables.outputs.docker_container_name }} ./retry "php bin/magento module:enable ${{ steps.variables.outputs.extension_name }}"  | 
0 commit comments