Skip to content

Commit be48030

Browse files
committed
Create E2E app & run it in CI
1 parent 466612a commit be48030

File tree

101 files changed

+11551
-24
lines changed

Some content is hidden

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

101 files changed

+11551
-24
lines changed

.github/workflows/browser-tests.yml

Lines changed: 70 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,22 @@ on:
2020
- '.github/workflows/app-tests.yaml'
2121
- '.github/workflows/unit-tests.yaml'
2222

23+
concurrency:
24+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
25+
cancel-in-progress: true
26+
2327
jobs:
24-
js:
28+
test:
2529
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 }}'
2636
steps:
2737
- uses: actions/checkout@v4
38+
2839
- run: npm i -g corepack && corepack enable
2940
- uses: actions/setup-node@v4
3041
with:
@@ -33,21 +44,69 @@ jobs:
3344
cache-dependency-path: |
3445
pnpm-lock.yaml
3546
package.json
36-
src/**/package.json
37-
- run: pnpm install --frozen-lockfile
3847
39-
- name: Install custom browsers
40-
run: node ./bin/get_browsers.mjs
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
4169

42-
- name: Install browsers with Playwright
43-
run: pnpm exec playwright install firefox ffmpeg
70+
- name: Start Docker containers
71+
run: docker compose up -d --build
72+
working-directory: test_apps/e2e-app
4473

45-
# TODO: Install the E2E app + run webserver
46-
- run: pnpm run test:browser
74+
- name: Configure E2E app
75+
run: |
76+
echo 'APP_ENV=test' >> .env.local
77+
echo 'APP_DEBUG=0' >> .env.local
78+
working-directory: test_apps/e2e-app
79+
80+
- name: Install E2E PHP dependencies
81+
uses: ramsey/composer-install@v3
82+
with:
83+
dependency-versions: highest
84+
working-directory: test_apps/e2e-app
85+
86+
- name: Prepare E2E app
87+
run: |
88+
symfony composer dump-env
89+
symfony console cache:warmup
90+
working-directory: test_apps/e2e-app
91+
92+
- name: Start E2E app
93+
run: symfony serve --daemon
94+
working-directory: test_apps/e2e-app
95+
96+
- name: Run browser tests
97+
run: pnpm run test:browser
98+
id: browser-tests
4799

48100
- uses: actions/upload-artifact@v4
49-
if: ${{ !cancelled() }}
101+
if: ${{ steps.browser-tests.outcome == 'failure' }}
50102
with:
51-
name: playwright-report
103+
name: Playwright report
52104
path: .playwright-report/
53105
retention-days: 7
106+
107+
- uses: actions/upload-artifact@v4
108+
if: ${{ steps.browser-tests.outcome == 'failure' }}
109+
with:
110+
name: Symfony logs
111+
path: test_apps/e2e-app/var/log/
112+
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/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: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ jobs:
145145
runs-on: ubuntu-latest
146146
steps:
147147
- uses: actions/checkout@v4
148+
148149
- run: npm i -g corepack && corepack enable
149150
- uses: actions/setup-node@v4
150151
with:
@@ -154,5 +155,8 @@ jobs:
154155
pnpm-lock.yaml
155156
package.json
156157
src/**/package.json
157-
- run: pnpm install --frozen-lockfile
158+
159+
- name: Install root JS dependencies
160+
run: pnpm install --frozen-lockfile
161+
158162
- run: pnpm run test:unit

bin/test_package.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,15 @@ processWorkspace() {
101101
# Install each version of the library separately
102102
echo -e " - Install $library@$trimmed_version for $workspace\n"
103103
pnpm add "$library@$trimmed_version" --save-peer --filter "$workspace"
104+
pnpm run --filter "$workspace" build
104105

105106
runTestSuite
106107
fi
107108
done
108109
done
109110

110-
echo " -> Reverting version changes from $package_json_path"
111-
git checkout -- "$package_json_path" "$PROJECT_DIR/pnpm-lock.yaml"
111+
echo " -> Reverting changes"
112+
git checkout -- "$package_json_path" "$location/dist" "$PROJECT_DIR/pnpm-lock.yaml"
112113
else
113114
echo -e " -> No peerDependencies found with multiple versions defined\n"
114115
runTestSuite

playwright.config.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ export default defineConfig({
2727
trace: 'retain-on-failure'
2828
},
2929

30-
//webServer: {
31-
// command: 'cd test_apps/e2e-app && symfony serve',
32-
// url: 'http://localhost:9876',
33-
// reuseExistingServer: !process.env.CI,
34-
// stderr: 'pipe',
35-
//},
36-
3730
projects: [
3831
{
3932
name: 'chrome-lowest',

test_apps/e2e-app/.editorconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
indent_size = 4
9+
indent_style = space
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true
12+
13+
[{compose.yaml,compose.*.yaml}]
14+
indent_size = 2
15+
16+
[*.md]
17+
trim_trailing_whitespace = false

test_apps/e2e-app/.env

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# In all environments, the following files are loaded if they exist,
2+
# the latter taking precedence over the former:
3+
#
4+
# * .env contains default values for the environment variables needed by the app
5+
# * .env.local uncommitted file with local overrides
6+
# * .env.$APP_ENV committed environment-specific defaults
7+
# * .env.$APP_ENV.local uncommitted environment-specific overrides
8+
#
9+
# Real environment variables win over .env files.
10+
#
11+
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
12+
# https://symfony.com/doc/current/configuration/secrets.html
13+
#
14+
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
15+
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
16+
17+
###> symfony/framework-bundle ###
18+
APP_ENV=dev
19+
APP_SECRET=
20+
###< symfony/framework-bundle ###
21+
22+
###> doctrine/doctrine-bundle ###
23+
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
24+
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
25+
#
26+
DATABASE_URL="sqlite:///%kernel.project_dir%/var/data_%kernel.environment%.db"
27+
# DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=8.0.32&charset=utf8mb4"
28+
# DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
29+
# DATABASE_URL="postgresql://app:[email protected]:5432/app?serverVersion=16&charset=utf8"
30+
###< doctrine/doctrine-bundle ###
31+
32+
###> symfony/ux-google-map ###
33+
# Options available at https://github.com/symfony/ux/blob/2.x/src/Map/src/Bridge/Google/README.md
34+
#
35+
GOOGLE_MAPS_API_KEY="# Get your API key at https://developers.google.com/maps/documentation/javascript/get-api-key"
36+
#UX_MAP_DSN=google://%env(GOOGLE_MAPS_API_KEY)%@default
37+
###< symfony/ux-google-map ###
38+
39+
###> symfony/ux-leaflet-map ###
40+
# Options available at https://github.com/symfony/ux/blob/2.x/src/Map/src/Bridge/Leaflet/README.md
41+
#
42+
UX_MAP_DSN=leaflet://default
43+
###< symfony/ux-leaflet-map ###
44+
45+
###> symfony/mercure-notifier ###
46+
# MERCURE_DSN=mercure://default
47+
###< symfony/mercure-notifier ###
48+
49+
###> symfony/mercure-bundle ###
50+
# See https://symfony.com/doc/current/mercure.html#configuration
51+
# The URL of the Mercure hub, used by the app to publish updates (can be a local URL)
52+
MERCURE_URL=https://example.com/.well-known/mercure
53+
# The public URL of the Mercure hub, used by the browser to connect
54+
MERCURE_PUBLIC_URL=https://example.com/.well-known/mercure
55+
# The secret used to sign the JWTs
56+
MERCURE_JWT_SECRET="!ChangeThisMercureHubJWTSecretKey!"
57+
###< symfony/mercure-bundle ###

test_apps/e2e-app/.env.dev

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
###> symfony/framework-bundle ###
3+
APP_SECRET=6714654acdda58a8d804a0d5e10f98a2
4+
###< symfony/framework-bundle ###

0 commit comments

Comments
 (0)