Skip to content

Commit ae26117

Browse files
committed
Merge branch '2.x' into 3.x
# By Hugo Alliaume (5) and github-actions[bot] (1) * 2.x: Create E2E app & run it in CI Update versions to 2.29.2 Use Playwright to run E2E tests Rework test_package.sh to allow passing tail args to vitest Rename back vitest.config.unit.mjs to vitest.config.mjs Configure Vitest for unit and browser tests (use @puppeteer/browsers and webdriverio) # Conflicts: # pnpm-lock.yaml # src/LazyImage/assets/package.json # src/LazyImage/assets/test/unit/controller.test.ts # src/Swup/assets/package.json # src/Swup/assets/test/unit/controller.test.ts # src/TogglePassword/assets/package.json # src/TogglePassword/assets/test/unit/controller.test.ts # src/Typed/assets/package.json # src/Typed/assets/test/unit/controller.test.ts
2 parents d7685d2 + 9d62749 commit ae26117

File tree

215 files changed

+13371
-450
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

215 files changed

+13371
-450
lines changed

.gitattributes

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Browser Tests
2+
3+
defaults:
4+
run:
5+
shell: bash
6+
7+
on:
8+
push:
9+
paths-ignore:
10+
- 'src/*/doc/**'
11+
- 'src/**/*.md'
12+
- 'ux.symfony.com/**'
13+
- '.github/workflows/app-tests.yaml'
14+
- '.github/workflows/unit-tests.yaml'
15+
pull_request:
16+
paths-ignore:
17+
- 'src/*/doc/**'
18+
- 'src/**/*.md'
19+
- 'ux.symfony.com/**'
20+
- '.github/workflows/app-tests.yaml'
21+
- '.github/workflows/unit-tests.yaml'
22+
23+
concurrency:
24+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
25+
cancel-in-progress: true
26+
27+
jobs:
28+
test:
29+
runs-on: ubuntu-latest
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
symfony: ['6.4', '7.3']
34+
env:
35+
SYMFONY_REQUIRE: '${{ matrix.symfony }}.*'
36+
steps:
37+
- uses: actions/checkout@v4
38+
39+
- run: npm i -g corepack && corepack enable
40+
- uses: actions/setup-node@v4
41+
with:
42+
node-version-file: '.nvmrc'
43+
cache: 'pnpm'
44+
cache-dependency-path: |
45+
pnpm-lock.yaml
46+
package.json
47+
48+
- name: Install root JS dependencies
49+
run: pnpm install --frozen-lockfile
50+
51+
- name: Install custom browsers
52+
run: node ./bin/get_browsers.mjs
53+
54+
- name: Install browsers with Playwright
55+
run: pnpm exec playwright install firefox ffmpeg
56+
57+
- uses: shivammathur/setup-php@v2
58+
with:
59+
php-version: 8.2
60+
tools: symfony-cli, flex
61+
62+
- name: Install root PHP dependencies
63+
uses: ramsey/composer-install@v3
64+
with:
65+
working-directory: ${{ github.workspace }}
66+
67+
- name: Build root packages
68+
run: php .github/build-packages.php
69+
70+
- name: Start Docker containers
71+
run: docker compose up -d --build
72+
working-directory: test_apps/e2e-app
73+
74+
- name: Configure E2E app
75+
run: |
76+
echo 'APP_ENV=prod' >> .env.local
77+
echo 'APP_DEBUG=0' >> .env.local
78+
echo 'APP_SECRET=df4c071596e64cc75a349456f2887ae2419ae650' >> .env.local
79+
working-directory: test_apps/e2e-app
80+
81+
- name: Install E2E PHP dependencies
82+
uses: ramsey/composer-install@v3
83+
with:
84+
working-directory: test_apps/e2e-app
85+
dependency-versions: highest
86+
composer-options: --no-dev
87+
custom-cache-suffix: symfony-${{ matrix.symfony }}
88+
89+
- name: Prepare E2E app
90+
run: |
91+
symfony composer dump-autoload --classmap-authoritative --no-dev
92+
symfony composer dump-env
93+
symfony console asset-map:compile
94+
symfony console ux:icons:warm-cache
95+
working-directory: test_apps/e2e-app
96+
97+
- name: Start E2E app
98+
run: symfony serve --daemon
99+
working-directory: test_apps/e2e-app
100+
101+
- name: Run browser tests
102+
run: pnpm run test:browser
103+
id: browser-tests
104+
105+
- uses: actions/upload-artifact@v4
106+
if: ${{ always() && steps.browser-tests.conclusion == 'failure' }}
107+
with:
108+
name: Playwright report and output (${{ matrix.symfony }})
109+
path: |
110+
src/**/assets/.playwright-report/
111+
src/**/assets/.playwright-output/
112+
retention-days: 7
113+
114+
- uses: actions/upload-artifact@v4
115+
if: ${{ always() && steps.browser-tests.conclusion == 'failure' }}
116+
with:
117+
name: Symfony logs (${{ matrix.symfony }})
118+
path: test_apps/e2e-app/var/log/
119+
retention-days: 7

.github/workflows/code-quality.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,16 @@ jobs:
2424
runs-on: ubuntu-latest
2525
steps:
2626
- uses: actions/checkout@v4
27+
2728
- run: npm i -g corepack && corepack enable
2829
- uses: actions/setup-node@v4
2930
with:
3031
node-version-file: '.nvmrc'
3132
cache: 'pnpm'
32-
- run: pnpm install --frozen-lockfile
33+
34+
- name: Install root JS dependencies
35+
run: pnpm install --frozen-lockfile
36+
3337
- run: pnpm run ci
3438

3539
phpstan:

.github/workflows/dist-files-unbuilt.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
runs-on: ubuntu-latest
2222
steps:
2323
- uses: actions/checkout@v4
24+
2425
- run: npm i -g corepack && corepack enable
2526
- uses: actions/setup-node@v4
2627
with:
@@ -29,7 +30,12 @@ jobs:
2930
cache-dependency-path: |
3031
pnpm-lock.yaml
3132
**/package.json
32-
- run: pnpm install --frozen-lockfile && pnpm run build
33+
34+
- name: Install root JS dependencies
35+
run: pnpm install --frozen-lockfile
36+
37+
- name: Build
38+
run: pnpm run build
3339

3440
- name: Check if JS dist files are current
3541
run: |

.github/workflows/functional-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Deprecated, will be removed in favor of browser-tests.yml
12
name: Functional Tests
23

34
defaults:

.github/workflows/release-on-npm.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ jobs:
3030
pnpm-lock.yaml
3131
package.json
3232
src/**/package.json
33-
- run: pnpm install --frozen-lockfile
33+
- name: Install root JS dependencies
34+
run: pnpm install --frozen-lockfile
3435

3536
- name: Update version of JS packages
3637
run: pnpm version ${{ env.VERSION }} --no-git-tag-version --workspaces --no-workspaces-update

.github/workflows/unit-tests.yaml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,21 +138,20 @@ jobs:
138138
fi
139139
js:
140140
runs-on: ubuntu-latest
141-
strategy:
142-
fail-fast: false
143-
matrix:
144-
node-version: [ '18.x', '20.x', '22.x', '24.x' ]
145141
steps:
146142
- uses: actions/checkout@v4
143+
147144
- run: npm i -g corepack && corepack enable
148145
- uses: actions/setup-node@v4
149146
with:
150-
node-version: ${{ matrix.node-version }}
147+
node-version-file: '.nvmrc'
151148
cache: 'pnpm'
152149
cache-dependency-path: |
153150
pnpm-lock.yaml
154151
package.json
155152
src/**/package.json
156-
- run: pnpm install --frozen-lockfile
157-
- run: pnpm exec playwright install chromium
158-
- run: pnpm run test
153+
154+
- name: Install root JS dependencies
155+
run: pnpm install --frozen-lockfile
156+
157+
- run: pnpm run test:unit

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
vendor/
21
node_modules
32

43
.doctor-rst.cache
@@ -7,3 +6,7 @@ node_modules
76

87
/composer.lock
98
/vendor
9+
10+
/browsers
11+
.playwright-report/
12+
.playwright-output/

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
22.11
1+
22.18

CONTRIBUTING.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ To set up the development environment, you need the following tools:
3939

4040
- [PHP](https://www.php.net/downloads.php) 8.1 or higher
4141
- [Composer](https://getcomposer.org/download/)
42-
- [Node.js](https://nodejs.org/en/download/package-manager) 22.11 or higher
42+
- [Node.js](https://nodejs.org/en/download/package-manager) 22.18 or higher
4343
- [Corepack](https://github.com/nodejs/corepack)
4444
- [PNPM](https://pnpm.io/) 10.13 or higher
4545

@@ -82,12 +82,16 @@ To help you with assets, you can run the following commands in a specific packag
8282
- `pnpm run build`: build (compile) assets from the package,
8383
- `pnpm run watch`: watch for modifications and rebuild assets from the package,
8484
- `pnpm run test`: run the tests from the package,
85+
- `pnpm run test:unit`: run the Unit tests from the package,
86+
- `pnpm run test:browser`: run the Browser tests from the package,
8587
- `pnpm run check`: run the formatter, linter, and sort imports, and fails if any modifications
8688
- `pnpm run check --write`: run the formatter, linter, imports sorting, and write modifications
8789

8890
Thanks to [PNPM Workspaces](https://pnpm.io/workspaces), you can also run these commands from the root directory of the project:
8991
- `pnpm run build`: build (compile) assets from **all** packages,
9092
- `pnpm run test`: run the tests from **all** packages,
93+
- `pnpm run test:unit`: run the Unit tests from **all** packages,
94+
- `pnpm run test:browser`: run the Browser tests from **all** packages,
9195
- `pnpm run check`: run the formatter, linter, and sort imports for **all** packages, and fails if any modifications
9296
- `pnpm run check --write`: run the formatter, linter, imports sorting for **all** packages, and write modifications
9397

@@ -112,7 +116,7 @@ docker run --rm -it -e DOCS_DIR='/docs' -v ${PWD}:/docs oskarstark/doctor-rst -
112116
```shell
113117
$ git checkout 2.x && \
114118
git fetch upstream && \
115-
git rebase upstream/2.x && \
119+
git reset --hard upstream/2.x && \
116120
git push origin 2.x
117121
```
118122

0 commit comments

Comments
 (0)