Skip to content

Commit

Permalink
tests: github ci
Browse files Browse the repository at this point in the history
Signed-off-by: Jérôme Engeln <[email protected]>

tests: github ci

Signed-off-by: Jérôme Engeln <[email protected]>

tests: github ci

Signed-off-by: Jérôme Engeln <[email protected]>

tests: github ci

Signed-off-by: Jérôme Engeln <[email protected]>

tests: github ci

Signed-off-by: Jérôme Engeln <[email protected]>

tests: github ci

Signed-off-by: Jérôme Engeln <[email protected]>

style: fix template syntax

Signed-off-by: Jérôme Engeln <[email protected]>

tests: github ci

Signed-off-by: Jérôme Engeln <[email protected]>

tests: github ci

Signed-off-by: Jérôme Engeln <[email protected]>

tests: github ci

Signed-off-by: Jérôme Engeln <[email protected]>
  • Loading branch information
jeromeengeln committed Mar 7, 2024
1 parent 86fa888 commit 40b9dc3
Show file tree
Hide file tree
Showing 33 changed files with 4,364 additions and 190 deletions.
71 changes: 37 additions & 34 deletions .github/workflows/code_quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: Code Quality

on:
push:
branches: [master]
branches: [ 0.x ]
paths-ignore:
- README.md
pull_request:
branches: [master]
branches: [ 0.x ]
paths-ignore:
- README.md

Expand All @@ -15,48 +15,51 @@ jobs:
runs-on: ubuntu-latest

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

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

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

- uses: actions/cache@v3
id: cache-composer
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-php-${{ github.sha }}
restore-keys: composer-php-
- uses: actions/cache@v3
id: cache-composer
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-php-${{ github.sha }}
restore-keys: composer-php-

- name: Composer - Create cache directory
run: mkdir -p /home/runner/.composer/cache
if: steps.cache-composer.outputs.cache-hit != 'true'

- name: Composer - Create cache directory
run: mkdir -p /home/runner/.composer/cache
if: steps.cache-composer.outputs.cache-hit != 'true'
- name: Composer - Validate composer.json and composer.lock
run: composer validate --strict

- name: Composer - Validate composer.json and composer.lock
run: composer validate --strict
- name: Composer - Github Auth
run: composer config -g github-oauth.github.com ${{ github.token }}

- name: Composer - Github Auth
run: composer config -g github-oauth.github.com ${{ github.token }}
- name: Composer - Update dependencies
run: composer update --no-progress

- name: Composer - Update dependencies
run: composer update --no-progress
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18

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

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

- name: Lint Style
run: npm run lint-style

- name: TwigCS - Check
run: vendor/bin/twigcs templates/ --severity error --display blocking --reporter githubAction
- name: TwigCS - Check
run: vendor/bin/twigcs templates/ --severity error --display blocking --reporter githubAction
39 changes: 24 additions & 15 deletions .github/workflows/sylius.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Install & Test
'on':
push:
branches:
- master
- 0.x
paths-ignore:
- README.md
pull_request:
Expand All @@ -20,12 +20,12 @@ jobs:
sylius:
- 1.12.0
symfony:
- 6.3
- 6.4
node:
- 18.x
- 20.x
env:
APP_ENV: test
package-name: sylius/bootstrap-theme
package-name: agence-adeliom/sylius-tailwindcss-theme
steps:
-
name: 'Setup PHP'
Expand Down Expand Up @@ -62,20 +62,29 @@ jobs:
-
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'

- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: '${{ steps.yarn-cache.outputs.dir }}'
key: 'node-${{ matrix.node }}-yarn-${{ hashFiles(''**/package.json **/yarn.lock'') }}'
restore-keys: "node-${{ matrix.node }}-yarn-\n"
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: List the state of node modules
continue-on-error: true
run: npm list

-
name: 'Install Sylius-Standard and Plugin'
run: 'make install -e SYLIUS_VERSION=${{ matrix.sylius }} SYMFONY_VERSION=${{ matrix.symfony }} PHP_VERSION=${{ matrix.php }}'
run: 'make install-ci -e SYLIUS_VERSION=${{ matrix.sylius }} SYMFONY_VERSION=${{ matrix.symfony }} PHP_VERSION=${{ matrix.php }}'
-
name: 'Output PHP version for Symfony CLI'
working-directory: ./install/Application
Expand All @@ -90,7 +99,7 @@ jobs:
run: 'symfony server:start --port=8080 --dir=public --daemon'
-
name: 'Run PHPUnit'
run: 'make phpunit'
run: 'make phpunit-ci'
services:
mariadb:
image: 'mariadb:10'
Expand Down
1 change: 1 addition & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "extends": ["stylelint-config-standard"] }
119 changes: 114 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ PLUGIN_NAME=agence-adeliom/sylius-tailwindcss-theme
### DEVELOPMENT
### ¯¯¯¯¯¯¯¯¯¯¯

install: sylius ## Install Plugin on Sylius [SYLIUS_VERSION=1.12.13] [SYMFONY_VERSION=6.4]
.PHONY: install
install-project: sylius ## Install Plugin on Sylius [SYLIUS_VERSION=1.12.13] [SYMFONY_VERSION=6.4]
.PHONY: install-project

halt:
cd install/Application && $(DDEV) stop

start:
cd install/Application && $(DDEV) start

reset: ## Remove dependencies
remove-project: ## Remove dependencies
ifneq ("$(wildcard install/Application/bin/console)","")
${CONSOLE} doctrine:database:drop --force --if-exists || true
endif
cd install/Application && $(DDEV) stop
$(DDEV) clean sylius-tailwindcss-theme
rm -rf install/Application
.PHONY: reset
.PHONY: remove-project

phpunit: phpunit-configure phpunit-run ## Run PHPUnit
.PHONY: phpunit
Expand Down Expand Up @@ -112,3 +112,112 @@ help: ## Dislay this help
echo $$line | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m%s\n", $$1, $$2}'; fi; \
done; unset IFS;
.PHONY: help

apply-changes:
cp -r assets ${TEST_DIRECTORY}/themes/TailwindTheme
cp -r templates ${TEST_DIRECTORY}/themes/TailwindTheme

build-changes:
${NPM} install
${NPM} run build

watch-changes:
${NPM} install
${NPM} run watch

lint-changes:
$(DDEV) composer install
$(DDEV) exec vendor/bin/twigcs templates/ --severity error --display blocking --reporter githubAction

###
### CI TEST
### ¯¯¯¯¯¯¯¯¯¯¯
### ¯¯¯¯¯¯¯¯¯¯¯
### ¯¯¯¯¯¯¯¯¯¯¯
### ¯¯¯¯¯¯¯¯¯¯¯
### ¯¯¯¯¯¯¯¯¯¯¯




COMPOSER_CI_ROOT=composer
TEST_DIRECTORY_CI=./install/Application
CONSOLE_CI=cd ./install/Application && php bin/console -e test
COMPOSER_CI=cd ./install/Application && composer
NPM_CI=cd ./install/Application && npm


install-ci: sylius-ci ## Install Plugin on Sylius [SYLIUS_VERSION=1.12.13] [SYMFONY_VERSION=6.4]
.PHONY: install

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

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

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

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

sylius-standard-ci:
${COMPOSER_CI_ROOT} create-project sylius/sylius-standard ${TEST_DIRECTORY_CI} "~${SYLIUS_VERSION}" --no-install --no-scripts
${COMPOSER_CI} config allow-plugins true
${COMPOSER_CI} require sylius/sylius:"~${SYLIUS_VERSION}"

update-dependencies-ci:
${COMPOSER_CI} config extra.symfony.require "~${SYMFONY_VERSION}"
${COMPOSER_CI} update --no-progress -n

install-plugin-ci:
${COMPOSER_CI} config repositories.plugin '{"type": "path", "url": "../../"}'
${COMPOSER_CI} config repositories.adeliom '{"type":"vcs","url":"[email protected]:agence-adeliom/sylius-tailwindcss-theme.git"}'
${COMPOSER_CI} config extra.symfony.allow-contrib true
${COMPOSER_CI} config minimum-stability "dev"
${COMPOSER_CI} config prefer-stable true
${COMPOSER_CI} req ${PLUGIN_NAME}:* --prefer-source --no-scripts

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

install-sylius-ci:
${CONSOLE_CI} doctrine:database:create --if-not-exists
${CONSOLE_CI} doctrine:migrations:migrate -n
${CONSOLE_CI} sylius:fixtures:load default -n
${NPM_CI} install
${NPM_CI} install tailwindcss
${NPM_CI} install daisyui
${NPM_CI} install axios
${NPM_CI} install postcss-loader@^7.0.0 --save-dev
${NPM_CI} install autoprefixer --save-dev
${NPM_CI} run build
${CONSOLE_CI} cache:clear


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

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

4 changes: 2 additions & 2 deletions assets/css/Action/index.css
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@import './Button/index.css';
@import './Dropdown/index.css';
@import url('./Button/index.css');
@import url('./Dropdown/index.css');
2 changes: 1 addition & 1 deletion assets/css/Feedback/index.css
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@import "./Loading/index.css";
@import url("./Loading/index.css");
Loading

0 comments on commit 40b9dc3

Please sign in to comment.