Skip to content

Commit

Permalink
Merge pull request #122 from 8lines/migration-to-bs5
Browse files Browse the repository at this point in the history
Migration to Bootstrap 5
  • Loading branch information
oallain committed Jan 15, 2024
2 parents 3199a8f + c52d301 commit bc0ae8c
Show file tree
Hide file tree
Showing 533 changed files with 4,609 additions and 4,489 deletions.
16 changes: 16 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
root: true,
env: {
browser: true,
es2021: true,
},
extends: [
"eslint:recommended",
],
parserOptions: {
sourceType: "module"
},
globals: {
Translator: 'readonly',
},
};
18 changes: 14 additions & 4 deletions .github/workflows/code_quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ jobs:
runs-on: ubuntu-latest

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

-
name: 'Setup PHP'
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: '8.0'
coverage: none

- name: Composer - Get Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- uses: actions/cache@v1
- uses: actions/cache@v3
id: cache-composer
with:
path: ${{ steps.composer-cache.outputs.dir }}
Expand All @@ -48,5 +48,15 @@ jobs:
- name: Composer - Update dependencies
run: composer update --no-progress

- name: Yarn install
uses: borales/actions-yarn@v4
with:
cmd: install

- name: Yarn ESLint
uses: borales/actions-yarn@v4
with:
cmd: lint

- name: TwigCS - Check
run: vendor/bin/twigcs SyliusShopBundle/ --severity error --display blocking
run: vendor/bin/twigcs templates/ --severity error --display blocking --reporter githubAction
101 changes: 101 additions & 0 deletions .github/workflows/sylius.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Install & Test
'on':
push:
branches:
- master
paths-ignore:
- README.md
pull_request:
paths-ignore:
- README.md
jobs:
sylius:
name: 'Sylius ${{ matrix.sylius }} Node ${{ matrix.node }}'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php:
- 8.2
sylius:
- 1.12.0
symfony:
- 6.3
node:
- 18.x
env:
APP_ENV: test
package-name: sylius/bootstrap-theme
steps:
-
name: 'Setup PHP'
uses: shivammathur/setup-php@v2
with:
php-version: '${{ matrix.php }}'
ini-values: date.timezone=UTC
extensions: intl
tools: symfony
coverage: none
-
name: 'Setup Node'
uses: actions/setup-node@v3
with:
node-version: '${{ matrix.node }}'
-
uses: actions/checkout@v3
-
name: 'Composer - Get Cache Directory'
id: composer-cache
run: 'echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT'
-
name: 'Composer - Set cache'
uses: actions/cache@v3
id: cache-composer
with:
path: '${{ steps.composer-cache.outputs.dir }}'
key: 'php-${{ matrix.php }}-sylius-${{ matrix.sylius }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles(''**/composer.json'') }}'
restore-keys: 'php-${{ matrix.php }}-sylius-${{ matrix.sylius }}-symfony-${{ matrix.symfony }}-composer-'
-
name: 'Composer - Create cache directory'
run: 'mkdir -p /home/runner/.composer/cache'
if: 'steps.cache-composer.outputs.cache-hit != ''true'''
-
name: 'Composer - Github Auth'
run: 'composer config -g github-oauth.github.com ${{ github.token }}'
-
name: 'Yarn - Get cache directory'
id: yarn-cache
run: 'echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT'
-
name: 'Yarn - Set Cache'
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'
run: 'make install -e SYLIUS_VERSION=${{ matrix.sylius }} SYMFONY_VERSION=${{ matrix.symfony }} PHP_VERSION=${{ matrix.php }}'
-
name: 'Output PHP version for Symfony CLI'
working-directory: ./tests/Application
run: 'php -v | head -n 1 | awk ''{ print $2 }'' > .php-version'
-
name: 'Install certificates'
working-directory: ./tests/Application
run: 'symfony server:ca:install'
-
name: 'Run webserver'
working-directory: ./tests/Application
run: 'symfony server:start --port=8080 --dir=public --daemon'
-
name: 'Run PHPUnit'
run: 'make phpunit'
services:
mariadb:
image: 'mariadb:10'
ports:
- '3306:3306'
env:
MYSQL_ALLOW_EMPTY_PASSWORD: true
options: '--health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3'
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
/vendor/
/node_modules
/composer.lock

/etc/build/*
!/etc/build/.gitignore

/tests/Application/yarn.lock
/tests/Application/
/install/Application/*.local

/.phpunit.result.cache
/behat.yml
/phpspec.yml
/phpunit.xml

###> symfony/webpack-encore-bundle ###
/node_modules/
Expand Down
69 changes: 0 additions & 69 deletions Dockerfile

This file was deleted.

145 changes: 86 additions & 59 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,63 +1,90 @@
.DEFAULT_GOAL := help
SHELL=/bin/bash
COMPOSER_ROOT=composer
TEST_DIRECTORY=tests/Application
CONSOLE=cd tests/Application && php bin/console -e test
COMPOSER=cd tests/Application && composer
YARN=cd tests/Application && yarn

##
## Project setup
##---------------------------------------------------------------------------
.PHONY: install start stop clean

install: start ## Install requirements for tests
sudo chmod -Rf 777 tests/Application/var
sudo chmod -Rf 777 tests/Application/public/media
docker-compose exec php php -d memory_limit=-1 /usr/bin/composer install
docker-compose exec nodejs yarn --cwd tests/Application install
docker-compose exec php tests/Application/bin/console doctrine:database:create --if-not-exists -vvv
docker-compose exec php tests/Application/bin/console doctrine:schema:create -vvv
docker-compose exec php tests/Application/bin/console assets:install tests/Application/public -vvv
docker-compose exec nodejs yarn --cwd tests/Application build
docker-compose exec php php -d memory_limit=-1 tests/Application/bin/console cache:warmup -vvv
docker-compose exec php tests/Application/bin/console sylius:fixtures:load -n

start: ## Start the project
docker-compose up -d

stop: ## Stop and clean
docker-compose kill
docker-compose rm -v --force

clean: stop ## Clean plugin
docker-compose down -v
sudo rm -Rf node_modules vendor .phpunit.result.cache composer.lock

##
## Assets
##---------------------------------------------------------------------------
.PHONY: assets assets-watch

assets: ## Build assets for dev environment
docker-compose exec nodejs yarn --cwd tests/Application dev

assets-watch: ## Watch asset during development
docker-compose exec nodejs yarn --cwd tests/Application watch

##
## QA
##---------------------------------------------------------------------------
.PHONY: validate behat ci

validate: ## Validate composer.json
docker-compose exec php composer validate --ansi --strict

behat: ## Run behat
docker-compose exec php php -d memory_limit=-1 vendor/bin/behat --profile docker --colors --strict -vvv -f progress --no-interaction --tags="@javascript && ~@todo && ~@cli"

ci: validate behat ## Execute github actions tasks

##
## Utilities
##---------------------------------------------------------------------------
.PHONY: help
SYLIUS_VERSION=1.12.0
SYMFONY_VERSION=6.3
PHP_VERSION=8.2
PLUGIN_NAME=sylius/bootstrap-theme

###
### DEVELOPMENT
### ¯¯¯¯¯¯¯¯¯¯¯

install: sylius ## Install Plugin on Sylius [SYLIUS_VERSION=1.12.0] [SYMFONY_VERSION=6.3] [PHP_VERSION=8.2]
.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

phpunit: phpunit-configure phpunit-run ## Run PHPUnit
.PHONY: phpunit

###
### OTHER
### ¯¯¯¯¯¯

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

help: ## Show all make tasks (default)
@grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
sylius-standard:
${COMPOSER_ROOT} create-project sylius/sylius-standard ${TEST_DIRECTORY} "~${SYLIUS_VERSION}" --no-install --no-scripts
${COMPOSER} config allow-plugins true
${COMPOSER} require sylius/sylius:"~${SYLIUS_VERSION}"

-include Makefile.local
update-dependencies:
${COMPOSER} config extra.symfony.require "~${SYMFONY_VERSION}"
${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

install-theme:
ifneq ("$(wildcard install/Application)","")
cp -r install/Application tests
endif
mkdir ${TEST_DIRECTORY}/themes/BootstrapTheme
cp -r assets ${TEST_DIRECTORY}/themes/BootstrapTheme
cp -r templates ${TEST_DIRECTORY}/themes/BootstrapTheme
cp composer.json ${TEST_DIRECTORY}/themes/BootstrapTheme
cp webpack.config.js ${TEST_DIRECTORY}/themes/BootstrapTheme
echo "const bootstrapTheme = require('./themes/BootstrapTheme/webpack.config');" >> ${TEST_DIRECTORY}/webpack.config.js
echo "module.exports = [shopConfig, adminConfig, appShopConfig, appAdminConfig, bootstrapTheme];" >> ${TEST_DIRECTORY}/webpack.config.js
echo " bootstrapTheme:" >> ${TEST_DIRECTORY}/config/packages/assets.yaml
echo " json_manifest_path: '%kernel.project_dir%/public/themes/bootstrap-theme/manifest.json'" >> ${TEST_DIRECTORY}/config/packages/assets.yaml
echo " bootstrapTheme: '%kernel.project_dir%/public/themes/bootstrap-theme'" >> ${TEST_DIRECTORY}/config/packages/webpack_encore.yaml

install-sylius:
${CONSOLE} doctrine:database:create --if-not-exists
${CONSOLE} doctrine:migrations:migrate -n
${CONSOLE} sylius:fixtures:load default -n
${YARN} install
${YARN} add bootstrap@^5.3 @fortawesome/fontawesome-free@^6.4.2 lightbox axios @popperjs/core@^2.11 glightbox
${YARN} build
${CONSOLE} cache:clear

phpunit-configure:
cp phpunit.xml.dist ${TEST_DIRECTORY}/phpunit.xml

phpunit-run:
cd ${TEST_DIRECTORY} && ./vendor/bin/phpunit --testdox

help: SHELL=/bin/bash
help: ## Dislay this help
@IFS=$$'\n'; for line in `grep -h -E '^[a-zA-Z_#-]+:?.*?##.*$$' $(MAKEFILE_LIST)`; do if [ "$${line:0:2}" = "##" ]; then \
echo $$line | awk 'BEGIN {FS = "## "}; {printf "\033[33m %s\033[0m\n", $$2}'; else \
echo $$line | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m%s\n", $$1, $$2}'; fi; \
done; unset IFS;
.PHONY: help
Loading

0 comments on commit bc0ae8c

Please sign in to comment.