Skip to content

Commit

Permalink
test fix sylius install
Browse files Browse the repository at this point in the history
  • Loading branch information
TheGrimmChester committed Jun 20, 2024
1 parent ca9a0c6 commit 3d0bf7a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 33 deletions.
15 changes: 6 additions & 9 deletions .github/workflows/sylius.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,21 @@ jobs:
coverage: none
-
name: 'Setup Node'
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: '${{ matrix.node }}'
-
name: 'Wkhtmltopdf - Install'
run: "sudo apt-get update\nsudo apt-get install xvfb libfontconfig wkhtmltopdf\nprintf '#!/bin/bash\\nxvfb-run -a --server-args=\"-screen 0, 1024x768x24\" /usr/bin/wkhtmltopdf -q $*' | sudo tee /usr/bin/wkhtmltopdf.sh\nsudo chmod a+x /usr/bin/wkhtmltopdf.sh\nsudo ln -s /usr/bin/wkhtmltopdf.sh /usr/local/bin/wkhtmltopdf\n"
-
uses: actions/checkout@v2
uses: actions/checkout@v3
-
name: 'Composer - Get Cache Directory'
id: composer-cache
run: 'echo "::set-output name=dir::$(composer config cache-files-dir)"'
run: 'echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT'
-
name: 'Composer - Set cache'
uses: actions/cache@v2
uses: actions/cache@v3
id: cache-composer
with:
path: '${{ steps.composer-cache.outputs.dir }}'
Expand All @@ -70,18 +70,16 @@ jobs:
-
name: 'Yarn - Get cache directory'
id: yarn-cache
run: 'echo "::set-output name=dir::$(yarn cache dir)"'
run: 'echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT'
-
name: 'Yarn - Set Cache'
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: '${{ steps.yarn-cache.outputs.dir }}'
key: 'node-${{ matrix.node }}-yarn-${{ hashFiles(''**/package.json **/yarn.lock'') }}'
restore-keys: "node-${{ matrix.node }}-yarn-\n"
-
name: 'Install Sylius-Standard and Plugin'
env:
SYMFONY_REQUIRE: '${{ matrix.symfony }}.*'
run: 'make install -e SYLIUS_VERSION=${{ matrix.sylius }} SYMFONY_VERSION=${{ matrix.symfony }} PHP_VERSION=${{ matrix.php }}'
-
name: 'Output PHP version for Symfony CLI'
Expand All @@ -104,7 +102,6 @@ jobs:
name: 'Doctrine Schema Validate - Run'
working-directory: ./tests/Application
run: 'php bin/console doctrine:schema:validate --skip-sync'
if: 'always() && steps.end-of-setup-sylius.outcome == ''success'''
-
name: 'Run PHPUnit'
run: 'make phpunit'
Expand Down
42 changes: 18 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
.DEFAULT_GOAL := help
SHELL=/bin/bash
COMPOSER_ROOT=composer
PLUGIN_NAME=payplug/sylius-payplug-plugin
SYLIUS_VERSION=1.12.0
SYMFONY_VERSION=6.1
PHP_VERSION=8.1
TEST_DIRECTORY=tests/Application
YARN=cd tests/Application && yarn
CONSOLE=cd tests/Application && php bin/console -e test
COMPOSER=cd tests/Application && composer
YARN=cd tests/Application && yarn

SYLIUS_VERSION=1.12.0
SYMFONY_VERSION=6.1
PHP_VERSION=8.1
PLUGIN_NAME=payplug/sylius-payplug-plugin

###
### DEVELOPMENT
Expand All @@ -18,6 +19,9 @@ install: sylius ## Install Plugin on Sylius [SYLIUS_VERSION=1.12.0] [SYMFONY_VER
.PHONY: install

reset: ## Remove dependencies
ifneq ("$(wildcard tests/Application/bin/console)","")
${CONSOLE} doctrine:database:drop --force --if-exists || true
endif
rm -rf tests/Application
.PHONY: reset

Expand All @@ -28,40 +32,30 @@ phpunit: phpunit-configure phpunit-run ## Run PHPUnit
### OTHER
### ¯¯¯¯¯¯

sylius: sylius-standard update-dependencies install-plugin install-sylius
sylius: sylius-standard install-plugin install-sylius
.PHONY: sylius

sylius-standard:
ifeq ($(shell [[ $(SYLIUS_VERSION) == *dev ]] && echo true ),true)
${COMPOSER_ROOT} create-project sylius/sylius-standard:${SYLIUS_VERSION} ${TEST_DIRECTORY} --no-install --no-scripts
else
${COMPOSER_ROOT} create-project sylius/sylius-standard ${TEST_DIRECTORY} "~${SYLIUS_VERSION}" --no-install --no-scripts
endif
${COMPOSER} config allow-plugins true
ifeq ($(shell [[ $(SYLIUS_VERSION) == *dev ]] && echo true ),true)
${COMPOSER} require sylius/sylius:"${SYLIUS_VERSION}"
else
${COMPOSER} require sylius/sylius:"~${SYLIUS_VERSION}"

update-dependencies:
${COMPOSER} config extra.symfony.require "~${SYMFONY_VERSION}"
${COMPOSER} require --dev donatj/mock-webserver:^2.1 --no-scripts --no-update
# FIX since https:/Sylius/Sylius/pull/13215 is not merged
${COMPOSER} require doctrine/dbal:"^2.6" doctrine/orm:"^2.9" --no-scripts --no-update
ifeq ($(shell [[ $(SYMFONY_VERSION) == 4.4 && $(PHP_VERSION) == 7.4 ]] && echo true ),true)
${COMPOSER} require sylius/admin-api-bundle:1.10 --no-scripts --no-update
endif
ifeq ($(SYLIUS_VERSION), 1.8.0)
${COMPOSER} update --no-progress --no-scripts --prefer-dist -n
endif
${COMPOSER} require symfony/asset:^${SYMFONY_VERSION} --no-scripts --no-update
${COMPOSER} update --no-progress -n

install-plugin:
${COMPOSER} config repositories.plugin '{"type": "path", "url": "../../"}'
${COMPOSER} config extra.symfony.allow-contrib true
${COMPOSER} config minimum-stability "dev"
${COMPOSER} config prefer-stable true
${COMPOSER} req ${PLUGIN_NAME}:* --prefer-source --no-scripts
${COMPOSER} symfony:recipes:install "${PLUGIN_NAME}" --force
${COMPOSER} require "${PLUGIN_NAME}:*" --prefer-source --no-scripts

cp -r install/Application tests
sed -i "4a \ \ \ \ form_themes: ['form/form_gateway_config_row.html.twig']" ${TEST_DIRECTORY}/config/packages/twig.yaml
mkdir -p ${TEST_DIRECTORY}/templates/form/
cp -R src/Resources/views/form/* ${TEST_DIRECTORY}/templates/form/

# As of sylius/refund-plugin 1.2 the folder does not exist anymore
ifneq ($(PHP_VERSION), 8)
Expand Down

0 comments on commit 3d0bf7a

Please sign in to comment.