mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-05 20:57:12 +00:00
197 lines
8.1 KiB
YAML
197 lines
8.1 KiB
YAML
name: Tests (MySQL)
|
|
|
|
on:
|
|
workflow_dispatch: ~
|
|
workflow_call:
|
|
inputs:
|
|
branch:
|
|
description: "Branch"
|
|
required: false
|
|
type: string
|
|
default: ""
|
|
type:
|
|
description: "Type of the build"
|
|
required: true
|
|
type: string
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
get-matrix:
|
|
runs-on: ubuntu-latest
|
|
name: "Get matrix"
|
|
outputs:
|
|
matrix: ${{ steps.matrix.outputs.prop }}
|
|
steps:
|
|
- name: "Checkout (With Branch)"
|
|
if: "${{ inputs.branch != '' }}"
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ inputs.branch }}
|
|
|
|
- name: "Checkout"
|
|
uses: actions/checkout@v4
|
|
if: "${{ inputs.branch == '' }}"
|
|
|
|
- name: "Get matrix"
|
|
id: matrix
|
|
uses: notiz-dev/github-action-json-property@release
|
|
with:
|
|
path: '.github/workflows/matrix.json'
|
|
prop_path: '${{ inputs.type }}.e2e-mysql'
|
|
|
|
phpunit-cli-api:
|
|
needs: get-matrix
|
|
runs-on: ubuntu-latest
|
|
name: "PHPUnit, CLI, API, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}"
|
|
timeout-minutes: 20
|
|
strategy:
|
|
fail-fast: false
|
|
matrix: ${{ fromJson(needs.get-matrix.outputs.matrix) }}
|
|
|
|
env:
|
|
APP_ENV: ${{ matrix.env || 'test_cached' }}
|
|
BEHAT_BASE_CMD: "vendor/bin/behat --colors --strict --no-interaction -vvv -f progress"
|
|
BEHAT_RERUN_CMD: "vendor/bin/behat --colors --strict --no-interaction -vvv -f pretty --rerun"
|
|
|
|
steps:
|
|
- name: "Checkout (With Branch)"
|
|
if: "${{ inputs.branch != '' }}"
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ inputs.branch }}
|
|
|
|
- name: "Checkout"
|
|
if: "${{ inputs.branch == '' }}"
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Restrict Twig
|
|
if: matrix.twig == '^2.12'
|
|
run: composer require --no-update --no-scripts --no-interaction "twig/twig:${{ matrix.twig }}"
|
|
|
|
- name: Prepare manifest.json files
|
|
run: |
|
|
mkdir -p public/build/admin
|
|
mkdir -p public/build/shop
|
|
mkdir -p public/build/app/admin
|
|
mkdir -p public/build/app/shop
|
|
echo "{}" > public/build/admin/manifest.json
|
|
echo "{}" > public/build/shop/manifest.json
|
|
echo "{}" > public/build/app/admin/manifest.json
|
|
echo "{}" > public/build/app/shop/manifest.json
|
|
|
|
- name: Build application
|
|
uses: SyliusLabs/BuildTestAppAction@v4
|
|
with:
|
|
build_type: "sylius"
|
|
cache_key: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-symfony-${{ matrix.symfony }}"
|
|
cache_restore_key: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-symfony-${{ matrix.symfony }}"
|
|
e2e: "yes"
|
|
database: "mysql:${{ matrix.mysql }}"
|
|
php_version: ${{ matrix.php }}
|
|
symfony_version: ${{ matrix.symfony }}
|
|
node_version: "24.x"
|
|
|
|
- name: Fix permissions for Symfony logs directory
|
|
run: |
|
|
LOGS_DIR=$(bin/console debug:container --parameter=kernel.logs_dir | grep 'kernel.logs_dir' | awk '{print $2}')
|
|
mkdir -p "$LOGS_DIR"
|
|
chmod -R 777 "$LOGS_DIR"
|
|
|
|
- name: Test installer
|
|
run: bin/console sylius:install --no-interaction -vvv
|
|
|
|
- name: Run PHPUnit
|
|
run: |
|
|
vendor/bin/phpunit --testsuite all --colors=always
|
|
vendor/bin/phpunit --testsuite="Sylius Test Suite" --colors=always
|
|
|
|
- name: Run CLI Behat
|
|
run: |
|
|
$BEHAT_BASE_CMD --tags="@cli&&~@todo" --suite-tags="@cli" || \
|
|
$BEHAT_RERUN_CMD --tags="@cli&&~@todo" --suite-tags="@cli"
|
|
|
|
- name: Run API Behat
|
|
run: |
|
|
$BEHAT_BASE_CMD --tags="~@todo&&~@cli" --suite-tags="@api,@domain" || \
|
|
$BEHAT_RERUN_CMD --tags="~@todo&&~@cli" --suite-tags="@api,@domain"
|
|
|
|
- name: Upload logs
|
|
uses: actions/upload-artifact@v4
|
|
if: failure()
|
|
with:
|
|
name: "Logs (PHPUnit, CLI, API, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}) - ${{ github.run_id }}-${{ github.run_number }}"
|
|
path: |
|
|
etc/build/
|
|
var/log
|
|
if-no-files-found: ignore
|
|
overwrite: true
|
|
|
|
behat-ui:
|
|
needs: get-matrix
|
|
runs-on: ubuntu-latest
|
|
name: "UI, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}"
|
|
timeout-minutes: 20
|
|
strategy:
|
|
fail-fast: false
|
|
matrix: ${{ fromJson(needs.get-matrix.outputs.matrix) }}
|
|
|
|
env:
|
|
APP_ENV: ${{ matrix.env || 'test_cached' }}
|
|
BEHAT_BASE_CMD: "vendor/bin/behat --colors --strict --no-interaction -vvv -f progress"
|
|
BEHAT_RERUN_CMD: "vendor/bin/behat --colors --strict --no-interaction -vvv -f pretty --rerun"
|
|
|
|
steps:
|
|
- name: "Checkout (With Branch)"
|
|
if: "${{ inputs.branch != '' }}"
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ inputs.branch }}
|
|
|
|
- name: "Checkout"
|
|
if: "${{ inputs.branch == '' }}"
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Restrict Twig
|
|
if: matrix.twig == '^2.12'
|
|
run: composer require --no-update --no-scripts --no-interaction "twig/twig:${{ matrix.twig }}"
|
|
|
|
- name: Prepare manifest.json files
|
|
run: |
|
|
mkdir -p public/build/admin
|
|
mkdir -p public/build/shop
|
|
mkdir -p public/build/app/admin
|
|
mkdir -p public/build/app/shop
|
|
echo "{}" > public/build/admin/manifest.json
|
|
echo "{}" > public/build/shop/manifest.json
|
|
echo "{}" > public/build/app/admin/manifest.json
|
|
echo "{}" > public/build/app/shop/manifest.json
|
|
|
|
- name: Build application
|
|
uses: SyliusLabs/BuildTestAppAction@v4
|
|
with:
|
|
build_type: "sylius"
|
|
cache_key: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-symfony-${{ matrix.symfony }}"
|
|
cache_restore_key: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-symfony-${{ matrix.symfony }}"
|
|
e2e: "yes"
|
|
database: "mysql:${{ matrix.mysql }}"
|
|
php_version: ${{ matrix.php }}
|
|
symfony_version: ${{ matrix.symfony }}
|
|
node_version: "24.x"
|
|
|
|
- name: Run UI Behat
|
|
run: |
|
|
$BEHAT_BASE_CMD --tags="~@javascript&&~@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@hybrid,@ui" || \
|
|
$BEHAT_RERUN_CMD --tags="~@javascript&&~@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@hybrid,@ui"
|
|
|
|
- name: Upload logs
|
|
uses: actions/upload-artifact@v4
|
|
if: failure()
|
|
with:
|
|
name: "Logs (UI, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}) - ${{ github.run_id }}-${{ github.run_number }}"
|
|
path: |
|
|
etc/build/
|
|
var/log
|
|
if-no-files-found: ignore
|
|
overwrite: true
|