Skip to content

Commit 2162e5e

Browse files
authored
Merge pull request #13 from delyriand/fix/ci
Fix CI and Date constraints
2 parents 1dc4fd3 + b3496e0 commit 2162e5e

File tree

7 files changed

+42
-30
lines changed

7 files changed

+42
-30
lines changed

.github/workflows/recipe.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ jobs:
6363
run: |
6464
composer create-project --prefer-dist --no-scripts --no-progress --no-install sylius/sylius-standard sylius "${{ matrix.sylius }}"
6565
66+
# Because the sylius-standard has a soft constraint
67+
- name: Make sure to install the required version of Sylius
68+
working-directory: ./sylius
69+
run: |
70+
composer require --no-install --no-scripts --no-progress sylius/sylius="${{ matrix.sylius }}"
71+
6672
- name: Setup some requirements
6773
working-directory: ./sylius
6874
run: |

.github/workflows/tests.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ jobs:
2323

2424
steps:
2525
- uses: actions/checkout@v2
26+
- uses: actions/setup-node@v2
27+
with:
28+
node-version: '14'
2629

2730
- name: Setup PHP
2831
run: |

Makefile

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.DEFAULT_GOAL := help
22
SHELL=/bin/bash
33
APP_DIR=tests/Application
4-
SYLIUS_VERSION=1.10
4+
SYLIUS_VERSION=1.10.0
55
SYMFONY=cd ${APP_DIR} && symfony
66
COMPOSER=symfony composer
77
CONSOLE=${SYMFONY} console
@@ -21,34 +21,26 @@ up: docker.up server.start ## Up the project (start docker, start symfony server
2121
stop: server.stop docker.stop ## Stop the project (stop docker, stop symfony server)
2222
down: server.stop docker.down ## Down the project (removes docker containers, stop symfony server)
2323

24-
reset: docker.down ## Stop docker and remove dependencies
24+
reset: ## Stop docker and remove dependencies
25+
${MAKE} docker.down || true
2526
rm -rf ${APP_DIR}/node_modules ${APP_DIR}/yarn.lock
2627
rm -rf ${APP_DIR}
2728
rm -rf vendor composer.lock
2829
.PHONY: reset
2930

30-
dependencies: vendor node_modules ## Setup the dependencies
31+
dependencies: composer.lock node_modules ## Setup the dependencies
3132
.PHONY: dependencies
3233

3334
.php-version: .php-version.dist
34-
cp .php-version.dist .php-version
35+
rm -f .php-version
36+
ln -s .php-version.dist .php-version
3537

3638
php.ini: php.ini.dist
37-
cp php.ini.dist php.ini
38-
39-
vendor: composer.lock ## Install the PHP dependencies using composer
40-
ifdef GITHUB_ACTIONS
41-
${COMPOSER} install --prefer-dist
42-
else
43-
${COMPOSER} install --prefer-source
44-
endif
39+
rm -f php.ini
40+
ln -s php.ini.dist php.ini
4541

4642
composer.lock: composer.json
47-
ifdef GITHUB_ACTIONS
48-
${COMPOSER} update --prefer-dist
49-
else
50-
${COMPOSER} update --prefer-source
51-
endif
43+
${COMPOSER} install --no-scripts --no-plugins
5244

5345
yarn.install: ${APP_DIR}/yarn.lock
5446

@@ -70,22 +62,26 @@ ${APP_DIR}/node_modules: yarn.install
7062
application: .php-version php.ini ${APP_DIR} setup_application ${APP_DIR}/docker-compose.yaml
7163

7264
${APP_DIR}:
73-
(${COMPOSER} create-project --prefer-dist --no-scripts --no-progress --no-install sylius/sylius-standard="${SYLIUS_VERSION}" ${APP_DIR})
65+
(${COMPOSER} create-project --no-interaction --prefer-dist --no-scripts --no-progress --no-install sylius/sylius-standard="~${SYLIUS_VERSION}" ${APP_DIR})
7466

7567
setup_application:
7668
rm -f ${APP_DIR}/yarn.lock
7769
(cd ${APP_DIR} && ${COMPOSER} config repositories.plugin '{"type": "path", "url": "../../"}')
7870
(cd ${APP_DIR} && ${COMPOSER} config extra.symfony.allow-contrib true)
79-
(cd ${APP_DIR} && ${COMPOSER} require --no-scripts --no-progress --no-install --no-update monsieurbiz/${PLUGIN_NAME}="*@dev")
80-
$(MAKE) apply_dist
71+
(cd ${APP_DIR} && ${COMPOSER} config minimum-stability dev)
72+
(cd ${APP_DIR} && ${COMPOSER} require --no-install --no-scripts --no-progress sylius/sylius="~${SYLIUS_VERSION}") # Make sure to install the required version of sylius because the sylius-standard has a soft constraint
8173
$(MAKE) ${APP_DIR}/.php-version
8274
$(MAKE) ${APP_DIR}/php.ini
83-
(cd ${APP_DIR} && ${COMPOSER} install)
75+
(cd ${APP_DIR} && ${COMPOSER} install --no-interaction)
76+
$(MAKE) apply_dist
77+
(cd ${APP_DIR} && ${COMPOSER} require --no-progress monsieurbiz/${PLUGIN_NAME}="*@dev")
78+
rm -rf ${APP_DIR}/var/cache
79+
8480

8581
${APP_DIR}/docker-compose.yaml:
8682
rm -f ${APP_DIR}/docker-compose.yml
8783
rm -f ${APP_DIR}/docker-compose.yaml
88-
cp docker-compose.yaml.dist ${APP_DIR}/docker-compose.yaml
84+
ln -s ../../docker-compose.yaml.dist ${APP_DIR}/docker-compose.yaml
8985
.PHONY: ${APP_DIR}/docker-compose.yaml
9086

9187
${APP_DIR}/.php-version: .php-version
@@ -95,7 +91,15 @@ ${APP_DIR}/php.ini: php.ini
9591
(cd ${APP_DIR} && ln -sf ../../php.ini)
9692

9793
apply_dist:
98-
cp -Rv dist/* ${APP_DIR} || true
94+
ROOT_DIR=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))); \
95+
for i in `cd dist && find . -type f`; do \
96+
FILE_PATH=`echo $$i | sed 's|./||'`; \
97+
FOLDER_PATH=`dirname $$FILE_PATH`; \
98+
echo $$FILE_PATH; \
99+
(cd ${APP_DIR} && rm -f $$FILE_PATH); \
100+
(cd ${APP_DIR} && mkdir -p $$FOLDER_PATH); \
101+
(cd ${APP_DIR} && ln -s $$ROOT_DIR/dist/$$FILE_PATH $$FILE_PATH); \
102+
done
99103

100104
###
101105
### TESTS
@@ -182,6 +186,11 @@ docker.logs: ## Logs the docker containers
182186
cd ${APP_DIR} && ${COMPOSE} logs -f
183187
.PHONY: docker.logs
184188

189+
docker.dc: ARGS=ps
190+
docker.dc: ## Run docker-compose command. Use ARGS="" to pass parameters to docker-compose.
191+
cd ${APP_DIR} && ${COMPOSE} ${ARGS}
192+
.PHONY: docker.dc
193+
185194
server.start: ## Run the local webserver using Symfony
186195
${SYMFONY} local:server:start -d
187196

composer.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@
4343
"symfony/web-profiler-bundle": "^4.4",
4444
"phpmd/phpmd": "@stable"
4545
},
46-
"conflict": {
47-
"doctrine/dbal": "^3"
48-
},
4946
"prefer-stable": true,
5047
"autoload": {
5148
"psr-4": {

src/Event/CustomReportEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use MonsieurBiz\SyliusSalesReportsPlugin\Exception\AlreadyExistsReport;
1717
use MonsieurBiz\SyliusSalesReportsPlugin\Exception\NotExistsReport;
1818
use Sylius\Component\Core\Model\ChannelInterface;
19-
use Symfony\Component\EventDispatcher\Event;
19+
use Symfony\Contracts\EventDispatcher\Event;
2020

2121
final class CustomReportEvent extends Event
2222
{

src/Form/Type/DateType.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
2929
'label' => 'monsieurbiz.sales_reports.form.date.label',
3030
'required' => true,
3131
'constraints' => [
32-
new Assert\Date([]),
3332
new Assert\NotBlank([]),
3433
],
3534
])

src/Form/Type/PeriodType.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
2929
'label' => 'monsieurbiz.sales_reports.form.from_date.label',
3030
'required' => true,
3131
'constraints' => [
32-
new Assert\Date([]),
3332
new Assert\NotBlank([]),
3433
],
3534
])
@@ -38,7 +37,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
3837
'label' => 'monsieurbiz.sales_reports.form.to_date.label',
3938
'required' => true,
4039
'constraints' => [
41-
new Assert\Date([]),
4240
new Assert\NotBlank([]),
4341
],
4442
])

0 commit comments

Comments
 (0)