-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CI for Twig #978
Add CI for Twig #978
Conversation
tblivet
commented
Oct 29, 2024
Questions | Answers |
---|---|
Description? | Add CI check for Twig |
Type? | new feature |
BC breaks? | no |
Deprecations? | no |
Fixed ticket? | - |
Sponsor company | @PrestaShopCorp |
How to test? | Check in "Actions" and "Twig Check" if the CI is green ! |
|
- name: Set up PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.2' # Use the appropriate PHP version for your project |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the comments of an AI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's a comment from the docs I wrote, but you're right, I can remove it. 👍
{ | ||
"require-dev": { | ||
"vincentlanglet/twig-cs-fixer": "^3.1" | ||
}, | ||
"config": { | ||
"platform": { | ||
"php": "8.2" | ||
} | ||
}, | ||
"scripts": { | ||
"twig": "vendor/bin/twig-cs-fixer lint \"../../views/templates\"", | ||
"twig:fix": "vendor/bin/twig-cs-fixer fix \"../../views/templates\"" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's starting to have a lot of composer.json... We have 4 including the storybook one. We don't have a way to use the main composer, with the dependency in requires-dev?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried using the main composer.json with the dependencies in require-dev, but I couldn’t get it to work because it requires a more recent PHP version. Do we have any other options?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could use docker. You must create an image, use the PHAR given by the project
Ex:
FROM php:8.2-cli
RUN wget -c https://github.com/VincentLanglet/Twig-CS-Fixer/releases/download/3.1.0/twig-cs-fixer.phar \
-O /usr/local/bin/twig-cs-fixer
RUN chmod +x /usr/local/bin/twig-cs-fixer
ENTRYPOINT ["twig-cs-fixer"]
CMD ["twig"]
docker build -t twig-cs-fixer-image .
docker run --rm twig-cs-fixer-image
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is no way to have an additional tool in our existing dependency list, I would rather not try to force its inclusion in the project because it would create one more way to run a specific binary. :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I close this PR !