|
| 1 | +name: Integration Test |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
| 8 | +jobs: |
| 9 | + integration-test: |
| 10 | + runs-on: "ubuntu-latest" |
| 11 | + |
| 12 | + # Only run integration tests on feature branches. Simple documentation updates, formatting can be ignored |
| 13 | + if: contains(github.head_ref, 'feature') |
| 14 | + name: ${{ matrix.job_title }} |
| 15 | + strategy: |
| 16 | + fail-fast: true |
| 17 | + matrix: |
| 18 | + magento: |
| 19 | + [ |
| 20 | + "magento/project-community-edition:>=2.4.6 <2.4.7", |
| 21 | + "magento/project-community-edition:>=2.4.7 <2.4.8", |
| 22 | + ] |
| 23 | + include: |
| 24 | + - magento: magento/project-community-edition:>=2.4.6 <2.4.7 |
| 25 | + php: 8.2 |
| 26 | + composer: 2.2 |
| 27 | + mysql: "mysql:8.0" |
| 28 | + elasticsearch: "elasticsearch:7.17.9" |
| 29 | + rabbitmq: "rabbitmq:3.12-management" |
| 30 | + redis: "redis:7.0" |
| 31 | + job_title: "2.4.6" |
| 32 | + |
| 33 | + - magento: magento/project-community-edition:>=2.4.7 <2.4.8 |
| 34 | + php: 8.3 |
| 35 | + composer: 2.7 |
| 36 | + mysql: "mariadb:10.6" |
| 37 | + elasticsearch: "elasticsearch:7.17.9" |
| 38 | + rabbitmq: "rabbitmq:3.12-management" |
| 39 | + redis: "redis:7.2" |
| 40 | + job_title: "2.4.7" |
| 41 | + |
| 42 | + services: |
| 43 | + elasticsearch: |
| 44 | + image: ${{ matrix.elasticsearch }} |
| 45 | + env: |
| 46 | + discovery.type: single-node |
| 47 | + options: >- |
| 48 | + --health-cmd "curl http://localhost:9200/_cluster/health" |
| 49 | + --health-interval 10s |
| 50 | + --health-timeout 5s |
| 51 | + --health-retries 10 |
| 52 | + ports: |
| 53 | + - 9200:9200 |
| 54 | + |
| 55 | + mysql: |
| 56 | + image: ${{ matrix.mysql }} |
| 57 | + env: |
| 58 | + MYSQL_DATABASE: magento_integration_tests |
| 59 | + MYSQL_USER: user |
| 60 | + MYSQL_PASSWORD: password |
| 61 | + MYSQL_ROOT_PASSWORD: rootpassword |
| 62 | + ports: |
| 63 | + - 3306:3306 |
| 64 | + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 |
| 65 | + |
| 66 | + rabbitmq: |
| 67 | + image: ${{ matrix.rabbitmq }} |
| 68 | + env: |
| 69 | + RABBITMQ_DEFAULT_USER: guest |
| 70 | + RABBITMQ_DEFAULT_PASS: guest |
| 71 | + ports: |
| 72 | + - 5672:5672 |
| 73 | + - 15672:15672 |
| 74 | + steps: |
| 75 | + - uses: actions/checkout@v4 |
| 76 | + - name: Set PHP Version |
| 77 | + uses: shivammathur/setup-php@v2 |
| 78 | + with: |
| 79 | + php-version: ${{ matrix.php }} |
| 80 | + tools: composer:2 |
| 81 | + coverage: none |
| 82 | + |
| 83 | + - run: composer create-project --repository-url="https://mirror.mage-os.org/" "${{ matrix.magento }}" ../magento2 --no-install |
| 84 | + shell: bash |
| 85 | + env: |
| 86 | + COMPOSER_AUTH: "" |
| 87 | + name: Create Magento ${{ matrix.magento }} Project |
| 88 | + |
| 89 | + - uses: graycoreio/github-actions-magento2/get-magento-version@main |
| 90 | + id: magento-version |
| 91 | + with: |
| 92 | + working-directory: "../magento2" |
| 93 | + |
| 94 | + - name: Get Composer Cache Directory |
| 95 | + shell: bash |
| 96 | + working-directory: "../magento2" |
| 97 | + id: composer-cache |
| 98 | + run: | |
| 99 | + echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT |
| 100 | +
|
| 101 | + - name: "Cache Composer Packages" |
| 102 | + uses: actions/cache@v4 |
| 103 | + with: |
| 104 | + key: "composer | v5 | '' | ${{ hashFiles('composer.lock') }}" |
| 105 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 106 | + |
| 107 | + - run: composer config repositories.local path $GITHUB_WORKSPACE |
| 108 | + name: Add Github Repo for Testing |
| 109 | + working-directory: "../magento2" |
| 110 | + shell: bash |
| 111 | + |
| 112 | + - run: | |
| 113 | + composer config --no-interaction allow-plugins.dealerdirect/phpcodesniffer-composer-installer true |
| 114 | + composer config --no-interaction allow-plugins.laminas/laminas-dependency-plugin true |
| 115 | + composer config --no-interaction allow-plugins.magento/* true |
| 116 | + name: Fixup Composer Plugins |
| 117 | + working-directory: "../magento2" |
| 118 | +
|
| 119 | + - run: composer require aligent/magento2-pci-4-compatibility "@dev" --no-update && composer install |
| 120 | + name: Require and attempt install |
| 121 | + working-directory: "../magento2" |
| 122 | + shell: bash |
| 123 | + env: |
| 124 | + COMPOSER_CACHE_DIR: ${{ steps.composer-cache.outputs.dir }} |
| 125 | + COMPOSER_AUTH: ${{ secrets.composer_auth }} |
| 126 | + |
| 127 | + - name: Replace Configuration Settings for env |
| 128 | + working-directory: ../magento2/dev/tests/integration |
| 129 | + run: | |
| 130 | + sed -i "s/'db-host' => 'localhost'/'db-host' => '127.0.0.1'/" etc/install-config-mysql.php.dist |
| 131 | + sed -i "s/'db-user' => 'root'/'db-user' => 'user'/" etc/install-config-mysql.php.dist |
| 132 | + sed -i "s/'db-password' => '123123q'/'db-password' => 'password'/" etc/install-config-mysql.php.dist |
| 133 | + sed -i "s/'elasticsearch-host' => 'localhost'/'elasticsearch-host' => '127.0.0.1'/" etc/install-config-mysql.php.dist |
| 134 | + sed -i "s/'amqp-host' => 'localhost'/'amqp-host' => '127.0.0.1'/" etc/install-config-mysql.php.dist |
| 135 | +
|
| 136 | + - run: ../../../vendor/bin/phpunit ../../../vendor/aligent/magento2-pci-4-compatibility/Test/Integration |
| 137 | + working-directory: ../magento2/dev/tests/integration |
| 138 | + name: Run Integration Tests |
0 commit comments