1+ on :
2+ workflow_call :
3+ inputs :
4+
5+ source_folder :
6+ type : string
7+ required : false
8+ default : $GITHUB_WORKSPACE
9+ description : " The source folder of the package"
10+
11+ package_name :
12+ type : string
13+ required : true
14+ description : " The name of the package"
15+
16+ composer_version :
17+ type : string
18+ default : " 2"
19+ description : The composer version to use.
20+ required : false
21+
22+ php_version :
23+ type : string
24+ default : " 7.4"
25+ description : The php version to use.
26+ required : false
27+
28+ magento_version :
29+ type : string
30+ default : magento/project-community-edition:>2.4.3 <2.4.4
31+ description : The magento version to use.
32+ required : false
33+
34+ magento_directory :
35+ type : string
36+ required : false
37+ default : " ../magento2"
38+ description : " The folder where Magento will be installed"
39+
40+ magento_repository :
41+ type : string
42+ required : false
43+ default : " https://repo.magento.com/"
44+ description : " Where to install Magento from"
45+
46+ mysql_image :
47+ type : string
48+ default : mysql:8.0
49+ description : The mysql image to use.
50+ required : false
51+
52+ rabbitmq_image :
53+ type : string
54+ default : rabbitmq:3.10-alpine
55+ description : The RabbitMQ image to use.
56+ required : false
57+
58+ elasticsearch_image :
59+ type : string
60+ default : docker.elastic.co/elasticsearch/elasticsearch:7.16.3
61+ description : The elasticsearch image to use.
62+ required : false
63+
64+ test_command :
65+ type : string
66+ required : false
67+ default : ../../../vendor/bin/phpunit
68+ description : " The integration test command to run"
69+
70+ secrets :
71+ composer_auth :
72+ required : true
73+
74+ jobs :
75+ integration_test :
76+ runs-on : ubuntu-latest
77+ services :
78+ elasticsearch :
79+ image : ${{ inputs.elasticsearch_image }}
80+ env :
81+ discovery.type : single-node
82+ options : >-
83+ --health-cmd "curl http://localhost:9200/_cluster/health"
84+ --health-interval 10s
85+ --health-timeout 5s
86+ --health-retries 10
87+ ports :
88+ - 9200:9200
89+
90+ mysql :
91+ image : ${{ inputs.mysql_image }}
92+ env :
93+ MYSQL_DATABASE : magento_integration_tests
94+ MYSQL_USER : user
95+ MYSQL_PASSWORD : password
96+ MYSQL_ROOT_PASSWORD : rootpassword
97+ ports :
98+ - 3306:3306
99+ options : --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
100+
101+ rabbitmq :
102+ image : ${{ inputs.rabbitmq_image }}
103+ env :
104+ RABBITMQ_DEFAULT_USER : guest
105+ RABBITMQ_DEFAULT_PASS : guest
106+ ports :
107+ - 5672:5672
108+ steps :
109+ - uses : actions/checkout@v2
110+ - name : Set PHP Version
111+ uses : shivammathur/setup-php@v2
112+ with :
113+ php-version : ${{ inputs.php_version }}
114+
115+ - run : composer self-update --${{ inputs.composer_version }}
116+ name : Pin to Composer Version ${{ inputs.composer_version }}
117+ shell : bash
118+
119+ - run : composer create-project --repository-url="${{ inputs.magento_repository }}" "${{ inputs.magento_version }}" ${{ inputs.magento_directory }} --no-install
120+ shell : bash
121+ env :
122+ COMPOSER_AUTH : ${{ secrets.composer_auth }}
123+ name : Create Magento ${{ inputs.magento_version }} Project
124+
125+ - name : Get Composer Cache Directory
126+ shell : bash
127+ working-directory : ${{ inputs.magento_directory }}
128+ id : composer-cache
129+ run : |
130+ echo "::set-output name=dir::$(composer config cache-files-dir)"
131+
132+ - name : " Cache Composer Packages"
133+ uses : actions/cache@v3
134+ with :
135+ key : ' composer | v3 | "$(Agent.OS)" | composer.lock | ${{ inputs.composer_version }} | ${{ inputs.php_version }} | ${{ inputs.magento_version }}'
136+ path : ${{ steps.composer-cache.outputs.dir }}
137+
138+ - run : composer config repositories.local path ${{ inputs.source_folder }}
139+ name : Add Github Repo for Testing
140+ working-directory : ${{ inputs.magento_directory }}
141+ shell : bash
142+
143+ - run : composer require ${{ inputs.package_name }} "@dev" --no-update && composer install
144+ name : Require and attempt install
145+ working-directory : ${{ inputs.magento_directory }}
146+ shell : bash
147+ env :
148+ COMPOSER_CACHE_DIR : ${{ steps.composer-cache.outputs.dir }}
149+ COMPOSER_AUTH : ${{ secrets.composer_auth }}
150+
151+ - name : Replace Configuration Settings for env
152+ working-directory : ${{ inputs.magento_directory }}/dev/tests/integration
153+ run : |
154+ sed -i "s/'db-host' => 'localhost'/'db-host' => '127.0.0.1'/" etc/install-config-mysql.php.dist
155+ sed -i "s/'db-user' => 'root'/'db-user' => 'user'/" etc/install-config-mysql.php.dist
156+ sed -i "s/'db-password' => '123123q'/'db-password' => 'password'/" etc/install-config-mysql.php.dist
157+ sed -i "s/'elasticsearch-host' => 'localhost'/'elasticsearch-host' => '127.0.0.1'/" etc/install-config-mysql.php.dist
158+ sed -i "s/'amqp-host' => 'localhost'/'amqp-host' => '127.0.0.1'/" etc/install-config-mysql.php.dist
159+
160+ - run : ${{ inputs.test_command }}
161+ working-directory : ${{ inputs.magento_directory }}/dev/tests/integration
162+ name : Run Integration Tests
0 commit comments