Skip to content

Commit 43a601c

Browse files
committed
Add JS CI
1 parent 1e06937 commit 43a601c

26 files changed

+468
-323
lines changed

.github/workflows/ci.yaml

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
coverage: none
2222
- name: Validate composer.json
2323
run: composer validate --strict
24-
cs:
24+
cs-php:
2525
name: Check coding standards
2626
runs-on: ubuntu-latest
2727
steps:
@@ -34,7 +34,7 @@ jobs:
3434
tools: php-cs-fixer
3535
- name: Run PHP-CS-Fixer
3636
run: php-cs-fixer fix . --dry-run --diff
37-
sca:
37+
sca-php:
3838
name: PHPStan
3939
runs-on: ubuntu-latest
4040
steps:
@@ -47,6 +47,64 @@ jobs:
4747
- name: Install composer dependencies
4848
run: composer install --no-progress --prefer-dist --optimize-autoloader
4949
- name: Install PHPUnit
50-
run: vendor/bin/simple-php-unit --version
50+
run: vendor/bin/simple-phpunit --version
5151
- name: Run PHPStan
5252
run: vendor/bin/phpstan analyse
53+
cs-js:
54+
name: JavaScript Coding Style
55+
runs-on: ubuntu-latest
56+
steps:
57+
- name: Checkout code
58+
uses: actions/checkout@v2
59+
- name: Get yarn cache directory path
60+
working-directory: ./storybook
61+
id: yarn-cache-dir-path
62+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
63+
- uses: actions/cache@v2
64+
id: yarn-cache
65+
with:
66+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
67+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
68+
restore-keys: |
69+
${{ runner.os }}-yarn-
70+
- working-directory: ./storybook
71+
run: yarn --frozen-lockfile
72+
- working-directory: ./storybook
73+
run: yarn check-lint
74+
- working-directory: ./storybook
75+
run: yarn check-format
76+
tests-php:
77+
name: PHPUnit
78+
runs-on: ubuntu-latest
79+
steps:
80+
- name: Checkout code
81+
uses: actions/checkout@v2
82+
- name: Setup PHP
83+
uses: shivammathur/setup-php@v2
84+
with:
85+
php-version: 8.2
86+
- name: Install composer dependencies
87+
run: composer install --no-progress --prefer-dist --optimize-autoloader
88+
- name: Run PHPUnit
89+
run: vendor/bin/simple-phpunit
90+
tests-js:
91+
name: Vitest
92+
runs-on: ubuntu-latest
93+
steps:
94+
- name: Checkout code
95+
uses: actions/checkout@v2
96+
- name: Get yarn cache directory path
97+
working-directory: ./storybook
98+
id: yarn-cache-dir-path
99+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
100+
- uses: actions/cache@v2
101+
id: yarn-cache
102+
with:
103+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
104+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
105+
restore-keys: |
106+
${{ runner.os }}-yarn-
107+
- working-directory: ./storybook
108+
run: yarn --frozen-lockfile
109+
- working-directory: ./storybook
110+
run: yarn test

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/yarn.lock
88

99
/.phpunit.result.cache
10-
/phpunit.xml.dist
10+
/phpunit.xml
1111

1212
.php-cs-fixer.cache
1313

phpunit.xml.dist

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
3+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" colors="true" bootstrap="vendor/autoload.php" failOnRisky="true" failOnWarning="true">
4+
<coverage processUncoveredFiles="true">
5+
<include>
6+
<directory suffix=".php">./src</directory>
7+
</include>
8+
</coverage>
9+
<php>
10+
<ini name="error_reporting" value="-1"/>
11+
<server name="KERNEL_CLASS" value="Storybook\Tests\Fixtures\Kernel" />
12+
<env name="SHELL_VERBOSITY" value="-1"/>
13+
<server name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0&amp;max[direct]=0"/>
14+
</php>
15+
<testsuites>
16+
<testsuite name="storybook-bundle Test Suite">
17+
<directory>./tests/</directory>
18+
</testsuite>
19+
</testsuites>
20+
<listeners>
21+
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
22+
</listeners>
23+
</phpunit>

storybook/.eslintrc

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"plugins": ["@typescript-eslint"],
5+
"extends": [
6+
"eslint:recommended",
7+
"prettier",
8+
"plugin:@typescript-eslint/eslint-recommended",
9+
"plugin:@typescript-eslint/recommended"
10+
],
11+
"rules": {
12+
"@typescript-eslint/no-explicit-any": "off",
13+
"@typescript-eslint/no-empty-function": "off",
14+
"@typescript-eslint/ban-ts-comment": "off",
15+
"quotes": [
16+
"error",
17+
"single",
18+
{
19+
"avoidEscape": true,
20+
"allowTemplateLiterals": true
21+
}
22+
]
23+
},
24+
"env": {
25+
"browser": false
26+
},
27+
"overrides": [
28+
{
29+
"files": ["test/**/*.ts"]
30+
}
31+
]
32+
}

storybook/.prettierrc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
{}
1+
{
2+
"printWidth": 120,
3+
"trailingComma": "es5",
4+
"tabWidth": 4,
5+
"bracketSameLine": true,
6+
"singleQuote": true
7+
}
8+

storybook/README.md

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,35 @@ Currently, in development mode only.
77
From your main project with Storybook installed, update your `main.ts|js` file:
88

99
```ts
10-
import type { StorybookConfig } from "@storybook/symfony-webpack5";
10+
import type { StorybookConfig } from '@storybook/symfony-webpack5';
1111

1212
const config: StorybookConfig = {
13-
stories: ["../stories/**/*.stories.[tj]s"],
14-
addons: [
15-
// Your addons
16-
"@storybook/addon-links",
17-
"@storybook/addon-essentials",
18-
],
19-
framework: {
20-
// 👇 Here tell storybook to use the Symfony framework
21-
name: "@storybook/symfony-webpack5",
22-
options: {
23-
builder: {
24-
useSWC: true
25-
},
26-
// 👇 Here configure the framework
27-
symfony: {
28-
server: 'https://localhost:8000', // This is mandatory, the URL of your Symfony dev server
29-
proxyPaths: [ // Setup here paths to resolve your assets
30-
'/assets'
31-
]
32-
}
13+
stories: ['../stories/**/*.stories.[tj]s'],
14+
addons: [
15+
// Your addons
16+
'@storybook/addon-links',
17+
'@storybook/addon-essentials',
18+
],
19+
framework: {
20+
// 👇 Here tell storybook to use the Symfony framework
21+
name: '@storybook/symfony-webpack5',
22+
options: {
23+
builder: {
24+
useSWC: true,
25+
},
26+
// 👇 Here configure the framework
27+
symfony: {
28+
server: 'https://localhost:8000', // This is mandatory, the URL of your Symfony dev server
29+
proxyPaths: [
30+
// Setup here paths to resolve your assets
31+
'/assets',
32+
],
33+
},
34+
},
35+
},
36+
docs: {
37+
autodocs: 'tag',
3338
},
34-
},
35-
docs: {
36-
autodocs: "tag",
37-
},
3839
};
3940

4041
export default config;

storybook/dist/builders/webpack5-builder.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

storybook/dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)