|
| 1 | +name: Magento 2 Integration Tests |
| 2 | +on: ['push', 'pull_request'] |
| 3 | + |
| 4 | +jobs: |
| 5 | + integration-tests: |
| 6 | + name: Magento 2 Integration Tests |
| 7 | + #runs-on: self-hosted |
| 8 | + runs-on: ubuntu-latest |
| 9 | + container: |
| 10 | + image: yireo/magento2installed:2.4.8-p3 |
| 11 | + services: |
| 12 | + mysql: |
| 13 | + image: yireo/mariadb:10 |
| 14 | + env: |
| 15 | + MYSQL_ROOT_PASSWORD: root |
| 16 | + MYSQL_USER: magento2 |
| 17 | + MYSQL_PASSWORD: magento2 |
| 18 | + MYSQL_DATABASE: magento2 |
| 19 | + options: --tmpfs /tmp:rw --tmpfs /var/lib/mysql:rw --health-cmd="mysqladmin ping" |
| 20 | + opensearch: |
| 21 | + image: yireo/opensearch:latest |
| 22 | + env: |
| 23 | + 'discovery.type': single-node |
| 24 | + ES_JAVA_OPTS: "-Xms256m -Xmx256m" |
| 25 | + options: --health-cmd="curl localhost:9200/_cluster/health?wait_for_status=yellow&timeout=60s" --health-interval=10s --health-timeout=5s --health-retries=3 |
| 26 | + redis: |
| 27 | + image: redis |
| 28 | + options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5 |
| 29 | + steps: |
| 30 | + - name: Checkout sources |
| 31 | + uses: actions/checkout@v4 |
| 32 | + |
| 33 | + - name: Apply patch for reporting memory under Alpine |
| 34 | + run: cd /tmp/magento && curl -fsSL https://patch-diff.githubusercontent.com/raw/magento/magento2/pull/39216.diff | git apply |
| 35 | + |
| 36 | + - name: Apply patch for changing MySQL client configuration |
| 37 | + run: cd /tmp/magento && curl -fsSL https://patch-diff.githubusercontent.com/raw/magento/magento2/pull/40410.diff | git apply |
| 38 | + |
| 39 | + - name: Configure GitLab |
| 40 | + run: | |
| 41 | + test -n "${{ secrets.GITLAB_TOKEN }}" || exit 0 |
| 42 | + cd /tmp/magento |
| 43 | + composer config --auth gitlab-token.gitlab.yireo.com ${{ secrets.GITLAB_TOKEN }} |
| 44 | + composer config repositories.loki-checkout composer https://gitlab.yireo.com/api/v4/group/loki-checkout/-/packages/composer/packages.json |
| 45 | +
|
| 46 | + - name: Add module source |
| 47 | + run: | |
| 48 | + export COMPOSER_NAME=`cat .module.ini | grep COMPOSER_NAME | cut -f2 -d= | tr -d '"'` |
| 49 | + cp -R ${GITHUB_WORKSPACE} /tmp/magento/package-source |
| 50 | + cd /tmp/magento |
| 51 | + composer config repositories.local-source path package-source/ |
| 52 | + composer require --prefer-source -- ${COMPOSER_NAME}:@dev yireo/magento2-integration-test-helper |
| 53 | +
|
| 54 | + - name: Run Magento 2 Integration Tests |
| 55 | + run: | |
| 56 | + test -d $GITHUB_WORKSPACE/Test/Integration || exit 0 |
| 57 | + export EXTENSION_VENDOR=`cat .module.ini | grep EXTENSION_VENDOR | cut -f2 -d= | tr -d '"'` |
| 58 | + export EXTENSION_NAME=`cat .module.ini | grep EXTENSION_NAME | cut -f2 -d= | tr -d '"'` |
| 59 | + export COMPOSER_NAME=`cat .module.ini | grep COMPOSER_NAME | cut -f2 -d= | tr -d '"'` |
| 60 | + export MAGENTO_MODULE=${EXTENSION_VENDOR}_${EXTENSION_NAME} |
| 61 | + cd /tmp/magento/dev/tests/integration/ |
| 62 | + cp -R ${GITHUB_WORKSPACE}/.github/workflows/integration-tests/* . |
| 63 | + php ../../../vendor/bin/phpunit --atleast-version 9 && cp phpunit9.xml phpunit.xml |
| 64 | + php ../../../vendor/bin/phpunit --atleast-version 10 && cp phpunit10.xml phpunit.xml |
| 65 | + php -d memory_limit=4G ../../../vendor/bin/phpunit -c phpunit.xml ../../../vendor/$COMPOSER_NAME/Test/Integration |
| 66 | +
|
0 commit comments