mirror of
https://github.com/graycoreio/github-actions-magento2.git
synced 2026-06-09 03:46:42 +00:00
feat: add matrix to integration-test workflow (#7)
This commit is contained in:
@@ -17,11 +17,22 @@ on:
|
|||||||
- ".github/workflows/integration.yaml"
|
- ".github/workflows/integration.yaml"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
compute_matrix:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
matrix: ${{ steps.supported-version.outputs.matrix }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: ./supported-version
|
||||||
|
id: supported-version
|
||||||
|
- run: echo ${{ steps.supported-version.outputs.matrix }}
|
||||||
integration-workflow:
|
integration-workflow:
|
||||||
|
needs: compute_matrix
|
||||||
uses: ./.github/workflows/integration.yaml
|
uses: ./.github/workflows/integration.yaml
|
||||||
with:
|
with:
|
||||||
package_name: graycore/magento2-demo-package
|
package_name: graycore/magento2-demo-package
|
||||||
source_folder: $GITHUB_WORKSPACE/_test/demo-package
|
source_folder: $GITHUB_WORKSPACE/_test/demo-package
|
||||||
|
matrix: ${{ needs.compute_matrix.outputs.matrix }}
|
||||||
test_command: ../../../vendor/bin/phpunit ../../../vendor/graycore/magento2-demo-package/Test/Integration
|
test_command: ../../../vendor/bin/phpunit ../../../vendor/graycore/magento2-demo-package/Test/Integration
|
||||||
secrets:
|
secrets:
|
||||||
composer_auth: ${{ secrets.COMPOSER_AUTH }}
|
composer_auth: ${{ secrets.COMPOSER_AUTH }}
|
||||||
|
|||||||
@@ -6,6 +6,26 @@ A Github Workflow that runs the Integration Tests of a Magento Package
|
|||||||
|
|
||||||
See the [integration.yaml](./integration.yaml)
|
See the [integration.yaml](./integration.yaml)
|
||||||
|
|
||||||
|
| Input | Description | Required | Default |
|
||||||
|
| ------------------ | ------------------------------------------------------------- | -------- | ----------------------------- |
|
||||||
|
| matrix | JSON string of [version matrix for Magento](#./matrix-format) | true | NULL |
|
||||||
|
| package_name | The name of the package | true | NULL |
|
||||||
|
| source_folder | The source folder of the package | false | $GITHUB_WORKSPACE |
|
||||||
|
| magento_directory | The folder where Magento will be installed | false | ../magento2 |
|
||||||
|
| magento_repository | Where to install Magento from | false | https://repo.magento.com/ |
|
||||||
|
| test_command | The integration test command to run | false | "../../../vendor/bin/phpunit" |
|
||||||
|
|
||||||
|
## Secrets
|
||||||
|
| Input | Description | Required | Default |
|
||||||
|
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------- |
|
||||||
|
| composer_auth | JSON string of [composer credentials]([#./matrix-format](https://devdocs.magento.com/guides/v2.4/install-gde/prereq/connect-auth.html)) | true | NULL |
|
||||||
|
|
||||||
|
### Matrix Format
|
||||||
|
|
||||||
|
The Magento matrix format outlined by the [supported versions action.](https://github.com/graycoreio/github-actions-magento2/tree/main/supported-version/supported.json
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
@@ -20,12 +40,23 @@ on:
|
|||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
compute_matrix:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
matrix: ${{ steps.supported-version.outputs.matrix }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: graycoreio/github-actions-magento2/supported-version@main
|
||||||
|
id: supported-version
|
||||||
|
- run: echo ${{ steps.supported-version.outputs.matrix }}
|
||||||
integration-workflow:
|
integration-workflow:
|
||||||
|
needs: compute_matrix
|
||||||
uses: graycoreio/github-actions-magento2/.github/workflows/integration.yaml@main
|
uses: graycoreio/github-actions-magento2/.github/workflows/integration.yaml@main
|
||||||
with:
|
with:
|
||||||
package_name: YOUR_PACKAGE_NAME
|
package_name: graycore/magento2-demo-package
|
||||||
source_folder: $GITHUB_WORKSPACE
|
source_folder: $GITHUB_WORKSPACE/_test/demo-package
|
||||||
test_command: ../../../vendor/bin/phpunit ../../../vendor/YOUR_VENDOR/YOUR_PACKAGE_NAME/Test/Integration
|
matrix: ${{ needs.compute_matrix.outputs.matrix }}
|
||||||
|
test_command: ../../../vendor/bin/phpunit ../../../vendor/graycore/magento2-demo-package/Test/Integration
|
||||||
secrets:
|
secrets:
|
||||||
composer_auth: ${{ secrets.COMPOSER_AUTH }}
|
composer_auth: ${{ secrets.COMPOSER_AUTH }}
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -13,24 +13,6 @@ on:
|
|||||||
required: true
|
required: true
|
||||||
description: "The name of the package"
|
description: "The name of the package"
|
||||||
|
|
||||||
composer_version:
|
|
||||||
type: string
|
|
||||||
default: "2"
|
|
||||||
description: The composer version to use.
|
|
||||||
required: false
|
|
||||||
|
|
||||||
php_version:
|
|
||||||
type: string
|
|
||||||
default: "7.4"
|
|
||||||
description: The php version to use.
|
|
||||||
required: false
|
|
||||||
|
|
||||||
magento_version:
|
|
||||||
type: string
|
|
||||||
default: magento/project-community-edition:>2.4.3 <2.4.4
|
|
||||||
description: The magento version to use.
|
|
||||||
required: false
|
|
||||||
|
|
||||||
magento_directory:
|
magento_directory:
|
||||||
type: string
|
type: string
|
||||||
required: false
|
required: false
|
||||||
@@ -43,23 +25,10 @@ on:
|
|||||||
default: "https://repo.magento.com/"
|
default: "https://repo.magento.com/"
|
||||||
description: "Where to install Magento from"
|
description: "Where to install Magento from"
|
||||||
|
|
||||||
mysql_image:
|
matrix:
|
||||||
type: string
|
type: string
|
||||||
default: mysql:8.0
|
required: true
|
||||||
description: The mysql image to use.
|
description: "The matrix of Magento versions to test against"
|
||||||
required: false
|
|
||||||
|
|
||||||
rabbitmq_image:
|
|
||||||
type: string
|
|
||||||
default: rabbitmq:3.10-alpine
|
|
||||||
description: The RabbitMQ image to use.
|
|
||||||
required: false
|
|
||||||
|
|
||||||
elasticsearch_image:
|
|
||||||
type: string
|
|
||||||
default: docker.elastic.co/elasticsearch/elasticsearch:7.16.3
|
|
||||||
description: The elasticsearch image to use.
|
|
||||||
required: false
|
|
||||||
|
|
||||||
test_command:
|
test_command:
|
||||||
type: string
|
type: string
|
||||||
@@ -73,10 +42,12 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
integration_test:
|
integration_test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix: ${{ fromJSON(inputs.matrix) }}
|
||||||
services:
|
services:
|
||||||
elasticsearch:
|
elasticsearch:
|
||||||
image: ${{ inputs.elasticsearch_image }}
|
image: ${{ matrix.elasticsearch }}
|
||||||
env:
|
env:
|
||||||
discovery.type: single-node
|
discovery.type: single-node
|
||||||
options: >-
|
options: >-
|
||||||
@@ -88,7 +59,7 @@ jobs:
|
|||||||
- 9200:9200
|
- 9200:9200
|
||||||
|
|
||||||
mysql:
|
mysql:
|
||||||
image: ${{ inputs.mysql_image }}
|
image: ${{ matrix.mysql }}
|
||||||
env:
|
env:
|
||||||
MYSQL_DATABASE: magento_integration_tests
|
MYSQL_DATABASE: magento_integration_tests
|
||||||
MYSQL_USER: user
|
MYSQL_USER: user
|
||||||
@@ -99,7 +70,7 @@ jobs:
|
|||||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||||
|
|
||||||
rabbitmq:
|
rabbitmq:
|
||||||
image: ${{ inputs.rabbitmq_image }}
|
image: ${{ matrix.rabbitmq }}
|
||||||
env:
|
env:
|
||||||
RABBITMQ_DEFAULT_USER: guest
|
RABBITMQ_DEFAULT_USER: guest
|
||||||
RABBITMQ_DEFAULT_PASS: guest
|
RABBITMQ_DEFAULT_PASS: guest
|
||||||
@@ -110,17 +81,17 @@ jobs:
|
|||||||
- name: Set PHP Version
|
- name: Set PHP Version
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: ${{ inputs.php_version }}
|
php-version: ${{ matrix.php }}
|
||||||
|
|
||||||
- run: composer self-update --${{ inputs.composer_version }}
|
- run: composer self-update --${{ matrix.composer }}
|
||||||
name: Pin to Composer Version ${{ inputs.composer_version }}
|
name: Pin to Composer Version ${{ matrix.composer }}
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- run: composer create-project --repository-url="${{ inputs.magento_repository }}" "${{ inputs.magento_version }}" ${{ inputs.magento_directory }} --no-install
|
- run: composer create-project --repository-url="${{ inputs.magento_repository }}" "${{ matrix.magento }}" ${{ inputs.magento_directory }} --no-install
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
COMPOSER_AUTH: ${{ secrets.composer_auth }}
|
COMPOSER_AUTH: ${{ secrets.composer_auth }}
|
||||||
name: Create Magento ${{ inputs.magento_version }} Project
|
name: Create Magento ${{ matrix.magento }} Project
|
||||||
|
|
||||||
- name: Get Composer Cache Directory
|
- name: Get Composer Cache Directory
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -132,7 +103,7 @@ jobs:
|
|||||||
- name: "Cache Composer Packages"
|
- name: "Cache Composer Packages"
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
key: 'composer | v3 | "$(Agent.OS)" | composer.lock | ${{ inputs.composer_version }} | ${{ inputs.php_version }} | ${{ inputs.magento_version }}'
|
key: 'composer | v3 | "$(Agent.OS)" | composer.lock | ${{ matrix.composer }} | ${{ matrix.php }} | ${{ matrix.magento }}'
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
|
|
||||||
- run: composer config repositories.local path ${{ inputs.source_folder }}
|
- run: composer config repositories.local path ${{ inputs.source_folder }}
|
||||||
@@ -140,6 +111,10 @@ jobs:
|
|||||||
working-directory: ${{ inputs.magento_directory }}
|
working-directory: ${{ inputs.magento_directory }}
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
|
- run: composer require monolog/monolog:"!=2.7.0" --no-update
|
||||||
|
name: Fixup Monolog (https://github.com/magento/magento2/pull/35596)
|
||||||
|
working-directory: ${{ inputs.magento_directory }}
|
||||||
|
|
||||||
- run: composer require ${{ inputs.package_name }} "@dev" --no-update && composer install
|
- run: composer require ${{ inputs.package_name }} "@dev" --no-update && composer install
|
||||||
name: Require and attempt install
|
name: Require and attempt install
|
||||||
working-directory: ${{ inputs.magento_directory }}
|
working-directory: ${{ inputs.magento_directory }}
|
||||||
|
|||||||
Reference in New Issue
Block a user