Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Maintenance] Fix invalid integration input usage #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 23 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ The goal of this action is to reduce the repetitive part of our every Sylius Git
Below you can find an example of a workflow file that uses this action. Keep in mind `actions/checkout@v2`
action is required and must be run **before** `SyliusLabs/BuildTestAppAction` action.

> **Note!** If you want to use this action with Sylius 1.12.7 or lower, please use version `2.0` of this action. Version `2.1` introduced
> a support for fixed PostgreSQL migrations (available since Sylius 1.12.8), and will fail on older Sylius versions.

```yaml
name: Example Workflow

Expand All @@ -36,10 +33,10 @@ jobs:
mysql: [ "8.0" ]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Build application
uses: SyliusLabs/BuildTestAppAction@v2.1
uses: SyliusLabs/BuildTestAppAction@v3.0
with:
e2e: "yes"
database_version: ${{ matrix.mysql }}
Expand All @@ -54,20 +51,24 @@ jobs:

## Inputs

| Name | Description | Default | Required to be explicitly defined |
|---------------------------|------------------------------------------------------------------------------------------------------------|-------------------------------------------------------|-----------------------------------|
| `build_type` | Type of the build. Possible values: `sylius` (Sylius/Sylius repo), `app` (Sylius-Standard based), `plugin` | `app` | no |
| `cache_key` | A cache key to be used | | No |
| `cache_restore_key` | A cache restore key to be used | | No |
| `e2e` | Whether prepare the test application for e2e tests | `no` | No |
| `e2e_js` | Whether prepare the test application for e2e tests with JS | `no` | No |
| `database` | A database engine to be used. Possible values: `mysql`, `mariadb`, `postgresql` | `mysql` | Yes |
| `database_version` | MySQL version to be used | `8.0` | No |
| `legacy_postgresql_setup` | Whether to use legacy PostgreSQL setup (before 1.13) | `no` | No |
| `php_version` | PHP version to be used | | Yes |
| `php_extensions` | PHP extensions to be installed | intl, gd, opcache, mysql, pdo_mysql, pgsql, pdo_pgsql | No |
| `php_tools` | PHP tools to be installed | symfony | No |
| `symfony_version` | Symfony version to be used | | Yes |
| `sylius_version` | Sylius version to be used | by default no version restriction is applied | no |
| `sylius_integration` | Parameter only for our internal purposes, where we test Sylius in different configurations | empty | No |
| `node_version` | Node version to be used | `16.x` | No |
| Name | Description | Default | Required to be explicitly defined |
|---------------------------|---------------------------------------------------------------------------------------------------------------|-------------------------------------------------------|-----------------------------------|
| `build_type` | Type of the build. Possible values: `sylius` (Sylius/Sylius repo), `app` (Sylius-Standard based), `plugin` | `app` | No |
| `application_root_dir` | Working directory for composer | `.` | No |
| `application_test_dir` | Directory of the test app (if empty the value gets resolved based on `build_type` and `application_root_dir`) | empty | No |
| `cache_key` | Cache key to be used (if empty no cache will be used) | empty | No |
| `cache_restore_key` | Cache restore key to be used (if empty no cache will be used) | empty | No |
| `e2e` | Whether prepare the test application for e2e tests | `no` | No |
| `e2e_js` | Whether prepare the test application for e2e tests with JS | `no` | No |
| `database` | Database engine to be used. Possible values: `mysql`, `mariadb`, `postgresql` | `mysql` | No |
| `database_version` | Database engine version to be used | | Yes |
| `legacy_postgresql_setup` | Whether to use legacy PostgreSQL setup (necessary for Sylius <1.13) | `no` | No |
| `php_version` | PHP version to be used | | Yes |
| `php_extensions` | PHP extensions to be installed | intl, gd, opcache, mysql, pdo_mysql, pgsql, pdo_pgsql | No |
| `php_tools` | PHP tools to be installed | symfony | No |
| `php_coverage` | PHP coverage to be used. Possible values: `none`, `xdebug`, `pcov` | `none` | No |
| `symfony_version` | Symfony version to be used | | Yes |
| `sylius_version` | Sylius version to be used (if empty no version restriction is applied) | empty | No |
| `sylius_integration` | Parameter only for our internal purposes, where we test Sylius in different configurations | empty | No |
| `node_version` | Node version to be used | `20.x` | No |
| `chrome_version` | Chrome version to be used | `stable` | No |
58 changes: 22 additions & 36 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,27 @@ description: "Builds a Sylius plugin's test application with the given PHP, Syli
inputs:
# General
build_type:
required: true
description: "A build type to be used"
required: false
description: "Build type to be used"
default: "app" # available options are "sylius" (to tests Sylius itself), "app" (to test Sylius-based application, e.g. Sylius-Standard), "plugin" (to test Sylius plugin)

application_root_dir:
required: false
description: "The application directory to be used (useful for monorepos with isolation tests)"
default: "" # If empty directory will be resolved based on the build type

description: "Working directory for composer"
default: "."
application_test_dir:
required: false
description: "The application test directory to be used (useful for monorepos with isolation tests)"
default: "" # If empty directory will be resolved based on the build type
default: "" # If empty directory will be resolved based on the build type and application_root_dir

cache_key:
required: false
description: "A cache key to be used"
description: "Cache key to be used"
default: "" # If empty no cache is used

cache_restore_key:
required: false
description: "A cache restore key to be used"
description: "Cache restore key to be used"
default: "" # If empty no cache is used

e2e:
Expand All @@ -40,20 +39,20 @@ inputs:
# Database
database:
required: true
description: "A database engine to be used"
description: "Database engine to be used"
default: "mysql" # available options are "mysql", "mariadb", "postgresql"
database_version:
required: true
description: "A database version to be used"
description: "Database engine version to be used"
legacy_postgresql_setup:
required: false
description: "Whether to use legacy PostgreSQL setup (before 1.13)"
description: "Whether to use legacy PostgreSQL setup (before Sylius 1.13)"
default: "yes"

# PHP
php_version:
required: true
description: "A PHP version to be used"
description: "PHP version to be used"
php_extensions:
required: true
description: "PHP extensions to be installed"
Expand All @@ -70,22 +69,22 @@ inputs:
# Symfony
symfony_version:
required: true
description: "A Symfony version to be used"
description: "Symfony version to be used"

# Sylius
sylius_version:
required: false
description: "A Sylius version to be used"
description: "Sylius version to be used"
default: "" # If empty no Sylius restriction is applied, also it allows to use this action while testing Sylius itself
sylius_integration:
required: false
description: "A Sylius integration to be used"
description: "Sylius integration to be used"
default: "" # If empty no Sylius integration is applied

# Node.js (only when e2e_js is set to "yes")
node_version:
required: false
description: "A Node.js version to be used"
description: "Node.js version to be used"
default: "20.x"

# Chrome (only when e2e_js is set to "yes")
Expand All @@ -98,25 +97,12 @@ runs:
using: "composite"

steps:
-
name: Set application_dir environment variable
shell: bash
env:
BUILD_TYPE: ${{ inputs.build_type }}
APPLICATION_ROOT_DIR: ${{ inputs.application_root_dir }}
run: |
if [ "$APPLICATION_ROOT_DIR" != "" ]; then
echo "application_dir=${APPLICATION_ROOT_DIR}" >> $GITHUB_ENV
else
echo "application_dir=." >> $GITHUB_ENV
fi

-
name: Set test_dir environment variable
shell: bash
env:
BUILD_TYPE: ${{ inputs.build_type }}
APPLICATION_ROOT_DIR: ${{ env.application_dir }}
APPLICATION_ROOT_DIR: ${{ inputs.application_root_dir }}
APPLICATION_TEST_DIR: ${{ inputs.application_test_dir }}
run: |
if [ "$APPLICATION_TEST_DIR" != "" ]; then
Expand Down Expand Up @@ -182,13 +168,13 @@ runs:
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.17 || ^2.0"
composer config extra.symfony.require "${{ inputs.symfony_version }}"
shell: bash
working-directory: "${{ env.application_dir }}"
working-directory: "${{ inputs.application_root_dir }}"

- name: Restrict Sylius version
if: inputs.sylius_version != '' && inputs.build_type != 'sylius'
run: composer require "sylius/sylius:${{ inputs.sylius_version }}" --no-update --no-scripts --no-interaction
shell: bash
working-directory: "${{ env.application_dir }}"
working-directory: "${{ inputs.application_root_dir }}"

- name: Get Composer cache directory
id: composer-cache
Expand All @@ -209,15 +195,15 @@ runs:
env:
COMPOSER_ROOT_VERSION: dev-main
shell: bash
working-directory: "${{ env.application_dir }}"
working-directory: "${{ inputs.application_root_dir }}"

- name: Install Sylius integration
if: inputs.integration != '' && inputs.build_type != 'sylius'
run: composer integration ${{ inputs.integration }}
if: inputs.sylius_integration != '' && inputs.build_type != 'sylius'
run: composer integration ${{ inputs.sylius_integration }}
env:
COMPOSER_ROOT_VERSION: dev-main
shell: bash
working-directory: "${{ env.application_dir }}"
working-directory: "${{ inputs.application_root_dir }}"

#####################################################################
# Prepare for end-to-end tests #
Expand Down