Skip to content

Commit

Permalink
💚 update test workflow files
Browse files Browse the repository at this point in the history
  • Loading branch information
gowrizrh committed Nov 22, 2024
1 parent 3867d59 commit 0fe27f1
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 52 deletions.
72 changes: 46 additions & 26 deletions .github/workflows/api-functional-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,57 @@ on:

jobs:
api-functional-test:
runs-on: "ubuntu-latest"
runs-on: 'ubuntu-latest'

# Only run api tests on feature branches. Simple documentation updates, formatting can be ignored
if: contains(github.head_ref, 'feature')
name: ${{ matrix.job_title }}
strategy:
fail-fast: true
matrix:
magento: ["magento/project-community-edition:>=2.4.4 <2.4.5", "magento/project-community-edition:>=2.4.5 <2.4.6"]
magento:
[
'magento/project-community-edition:>=2.4.4 <2.4.5',
'magento/project-community-edition:>=2.4.5 <2.4.6',
'magento/project-community-edition:>=2.4.6 <2.4.7',
'magento/project-community-edition:>=2.4.7 <2.4.8',
]
include:
- magento: magento/project-community-edition:>=2.4.4 <2.4.5
php: 8.1
composer: 2
mysql: "mysql:8.0"
elasticsearch: "elasticsearch:7.16.3"
rabbitmq: "rabbitmq:3.9-management"
redis: "redis:6.2"
varnish: "varnish:7.0"
nginx: "nginx:1.18"
job_title: "2.4.5"
mysql: 'mysql:8.0'
elasticsearch: 'elasticsearch:7.16.3'
rabbitmq: 'rabbitmq:3.9-management'
redis: 'redis:6.2'
job_title: '2.4.4'

- magento: magento/project-community-edition:>=2.4.5 <2.4.6
php: 8.1
composer: 2
mysql: "mysql:8.0"
elasticsearch: "elasticsearch:7.16.3"
rabbitmq: "rabbitmq:3.9-management"
redis: "redis:6.2"
varnish: "varnish:7.0"
nginx: "nginx:1.18"
job_title: "2.4.6"
mysql: 'mysql:8.0'
elasticsearch: 'elasticsearch:7.16.3'
rabbitmq: 'rabbitmq:3.9-management'
redis: 'redis:6.2'
job_title: '2.4.5'

- magento: magento/project-community-edition:>=2.4.6 <2.4.7
php: 8.2
composer: 2.2
mysql: 'mysql:8.0'
elasticsearch: 'elasticsearch:7.17.9'
rabbitmq: 'rabbitmq:3.12-management'
redis: 'redis:7.0'
job_title: '2.4.6'

- magento: magento/project-community-edition:>=2.4.7 <2.4.8
php: 8.3
composer: 2.7
mysql: 'mariadb:10.6'
elasticsearch: 'elasticsearch:7.17.9'
rabbitmq: 'rabbitmq:3.12-management'
redis: 'redis:7.2'
job_title: '2.4.7'

services:
elasticsearch:
Expand All @@ -54,7 +74,7 @@ jobs:
- 9200:9200

mysql:
image: ${{ matrix.mysql }}
image: ${{ matrix.mysql }}
env:
MYSQL_DATABASE: magento_functional_tests
MYSQL_USER: user
Expand Down Expand Up @@ -84,49 +104,49 @@ jobs:
- run: composer create-project --repository-url="https://mirror.mage-os.org/" "${{ matrix.magento }}" ../magento2 --no-install
shell: bash
env:
COMPOSER_AUTH: ""
COMPOSER_AUTH: ''
name: Create Magento ${{ matrix.magento }} Project

- uses: graycoreio/github-actions-magento2/get-magento-version@main
id: magento-version
with:
working-directory: "../magento2"
working-directory: '../magento2'

- name: Get Composer Cache Directory
shell: bash
working-directory: "../magento2"
working-directory: '../magento2'
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: "Cache Composer Packages"
- name: 'Cache Composer Packages'
uses: actions/cache@v4
with:
key: "composer | v5 | '' | ${{ hashFiles('composer.lock') }}"
path: ${{ steps.composer-cache.outputs.dir }}

- run: composer config repositories.local path $GITHUB_WORKSPACE
name: Add Github Repo for Testing
working-directory: "../magento2"
working-directory: '../magento2'
shell: bash

- run: |
composer config --no-interaction allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer config --no-interaction allow-plugins.laminas/laminas-dependency-plugin true
composer config --no-interaction allow-plugins.magento/* true
name: Fixup Composer Plugins
working-directory: "../magento2"
working-directory: '../magento2'
- run: composer require mage-os/mageos-async-events "@dev" --no-update && composer install
name: Require and attempt install
working-directory: "../magento2"
working-directory: '../magento2'
shell: bash
env:
COMPOSER_CACHE_DIR: ${{ steps.composer-cache.outputs.dir }}
COMPOSER_AUTH: ${{ secrets.composer_auth }}

- name: Replace Configuration Settings for env
working-directory: ../magento2/dev/tests/api-functional
working-directory: ../magento2/dev/tests/api-functional
run: |
cp phpunit_rest.xml.dist phpunit_rest.xml
cp config/install-config-mysql.php.dist config/install-config-mysql.php
Expand All @@ -144,5 +164,5 @@ jobs:
php -S 127.0.0.1:8082 -t ./pub/ ./phpserver/router.php &
sleep 5
vendor/bin/phpunit -c $(pwd)/dev/tests/api-functional/phpunit_rest.xml vendor/mage-os/mageos-async-events/Test/Api
working-directory: ../magento2
working-directory: ../magento2
name: Run API Functional Tests
73 changes: 47 additions & 26 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,57 @@ on:

jobs:
integration-test:
runs-on: "ubuntu-latest"
runs-on: 'ubuntu-latest'

# Only run integration tests on feature branches. Simple documentation updates, formatting can be ignored
if: contains(github.head_ref, 'feature')
name: ${{ matrix.job_title }}
strategy:
fail-fast: true
matrix:
magento: ["magento/project-community-edition:>=2.4.4 <2.4.5", "magento/project-community-edition:>=2.4.5 <2.4.6"]
magento:
[
'magento/project-community-edition:>=2.4.4 <2.4.5',
'magento/project-community-edition:>=2.4.5 <2.4.6',
'magento/project-community-edition:>=2.4.6 <2.4.7',
'magento/project-community-edition:>=2.4.7 <2.4.8',
]
include:
- magento: magento/project-community-edition:>=2.4.4 <2.4.5
php: 8.1
composer: 2
mysql: "mysql:8.0"
elasticsearch: "elasticsearch:7.16.3"
rabbitmq: "rabbitmq:3.9-management"
redis: "redis:6.2"
varnish: "varnish:7.0"
nginx: "nginx:1.18"
job_title: "2.4.5"
mysql: 'mysql:8.0'
elasticsearch: 'elasticsearch:7.16.3'
rabbitmq: 'rabbitmq:3.9-management'
redis: 'redis:6.2'
job_title: '2.4.4'

- magento: magento/project-community-edition:>=2.4.5 <2.4.6
php: 8.1
composer: 2
mysql: "mysql:8.0"
elasticsearch: "elasticsearch:7.16.3"
rabbitmq: "rabbitmq:3.9-management"
redis: "redis:6.2"
varnish: "varnish:7.0"
nginx: "nginx:1.18"
job_title: "2.4.6"
mysql: 'mysql:8.0'
elasticsearch: 'elasticsearch:7.16.3'
rabbitmq: 'rabbitmq:3.9-management'
redis: 'redis:6.2'
job_title: '2.4.5'

- magento: magento/project-community-edition:>=2.4.6 <2.4.7
php: 8.2
composer: 2.2
mysql: 'mysql:8.0'
elasticsearch: 'elasticsearch:7.17.9'
rabbitmq: 'rabbitmq:3.12-management'
redis: 'redis:7.0'
job_title: '2.4.6'

- magento: magento/project-community-edition:>=2.4.7 <2.4.8
php: 8.3
composer: 2.7
mysql: 'mariadb:10.6'
elasticsearch: 'elasticsearch:7.17.9'
rabbitmq: 'rabbitmq:3.12-management'
redis: 'redis:7.2'
job_title: '2.4.7'

services:
elasticsearch:
Expand All @@ -53,7 +74,7 @@ jobs:
- 9200:9200

mysql:
image: ${{ matrix.mysql }}
image: ${{ matrix.mysql }}
env:
MYSQL_DATABASE: magento_integration_tests
MYSQL_USER: user
Expand Down Expand Up @@ -83,49 +104,49 @@ jobs:
- run: composer create-project --repository-url="https://mirror.mage-os.org/" "${{ matrix.magento }}" ../magento2 --no-install
shell: bash
env:
COMPOSER_AUTH: ""
COMPOSER_AUTH: ''
name: Create Magento ${{ matrix.magento }} Project

- uses: graycoreio/github-actions-magento2/get-magento-version@main
id: magento-version
with:
working-directory: "../magento2"
working-directory: '../magento2'

- name: Get Composer Cache Directory
shell: bash
working-directory: "../magento2"
working-directory: '../magento2'
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: "Cache Composer Packages"
- name: 'Cache Composer Packages'
uses: actions/cache@v4
with:
key: "composer | v5 | '' | ${{ hashFiles('composer.lock') }}"
path: ${{ steps.composer-cache.outputs.dir }}

- run: composer config repositories.local path $GITHUB_WORKSPACE
name: Add Github Repo for Testing
working-directory: "../magento2"
working-directory: '../magento2'
shell: bash

- run: |
composer config --no-interaction allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer config --no-interaction allow-plugins.laminas/laminas-dependency-plugin true
composer config --no-interaction allow-plugins.magento/* true
name: Fixup Composer Plugins
working-directory: "../magento2"
working-directory: '../magento2'
- run: composer require mage-os/mageos-async-events "@dev" --no-update && composer install
name: Require and attempt install
working-directory: "../magento2"
working-directory: '../magento2'
shell: bash
env:
COMPOSER_CACHE_DIR: ${{ steps.composer-cache.outputs.dir }}
COMPOSER_AUTH: ${{ secrets.composer_auth }}

- name: Replace Configuration Settings for env
working-directory: ../magento2/dev/tests/integration
working-directory: ../magento2/dev/tests/integration
run: |
sed -i "s/'db-host' => 'localhost'/'db-host' => '127.0.0.1'/" etc/install-config-mysql.php.dist
sed -i "s/'db-user' => 'root'/'db-user' => 'user'/" etc/install-config-mysql.php.dist
Expand All @@ -137,5 +158,5 @@ jobs:
cp ../../../vendor/mage-os/mageos-async-events/Test/_files/ce.php ./etc/di/preferences/cli
- run: ../../../vendor/bin/phpunit ../../../vendor/mage-os/mageos-async-events/Test/Integration
working-directory: ../magento2/dev/tests/integration
working-directory: ../magento2/dev/tests/integration
name: Run Integration Tests

0 comments on commit 0fe27f1

Please sign in to comment.