Skip to content

Test

Test #112

name: Integration Tests
# This makes sure that the tests are run on every push. See this page for more options:
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
on: push
jobs:
build:
strategy:
# This Matrix will run the tests on PHP 7.0, 7.1 and 7.2 and on Magento 2.2.11 and 2.3.5-p1.
# Magento 2.3.5-p1 requires PHP 7.1 and higher, so PHP 7.0 is disabled for this version.
# Magento 2.2.11 supports PHP up to version 7.1, so PHP 7.2 is disabled for this version.
matrix:
include:
- PHP_VERSION: php73-fpm
MAGENTO_VERSION: 2.3.7
- PHP_VERSION: php74-fpm
MAGENTO_VERSION: 2.4.3-p1
- PHP_VERSION: php81-fpm
MAGENTO_VERSION: 2.4.5-p1
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
# Download the correct Docker image with the correct Magento & PHP version for this specific run.
- name: Start Docker
run: docker run --detach --name magento-project-community-edition michielgerritsen/magento-project-community-edition:${{ matrix.PHP_VERSION }}-magento${{ matrix.MAGENTO_VERSION }}
# Create separate branch and remove version from `composer.json`.
- name: Create branch for Composer and remove version from composer.json
run: git checkout -b integration-test-branch && sed -i '/version/d' ./composer.json
# If your code is not in the root but in a subdirectory you need to change this command.
# Example: If your code is in the `src` folder then you need to do this:
# run: docker cp $(pwd)/src magento-project-community-edition:/data/extensions/
- name: Upload our code into the docker container
run: docker cp $(pwd) magento-project-community-edition:/data/extensions/
# Replace <VENDOR> and <MODULE> with the name in your `composer.json`.
- name: Install the extension in Magento
run: docker exec magento-project-community-edition composer require cmdotcom-plugins/magento2-payments:@dev
# This step is optional but good to include in your pipeline.
- name: Run setup:di:compile
run: docker exec magento-project-community-edition php bin/magento setup:di:compile
# I'm not sure why, but this step is required. You might end up with loads and loads of failed tests.
- name: Enable developer mode
run: docker exec magento-project-community-edition php bin/magento deploy:mode:set developer
# Only the tests in your repository will be run, the default Magento tests are not included in this.
- name: Run tests
run: docker exec magento-project-community-edition bash -c "cd /data/dev/tests/integration/ && ../../../vendor/bin/phpunit"