Skip to content

Commit 4fa91ca

Browse files
committed
[CI] Rework app-tests job to use npm as user's packages manager
1 parent 8ab561f commit 4fa91ca

File tree

21 files changed

+499
-7425
lines changed

21 files changed

+499
-7425
lines changed

.github/workflows/app-tests.yaml

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,35 +60,60 @@ jobs:
6060
working-directory: test_apps/encore-app
6161
dependency-versions: highest
6262

63+
- name: Manually replacing "workspace:*" references
64+
run: |
65+
for PACKAGE_DATA in $(cd ../..; pnpm ls -r --json --depth -1 | jq 'map(select(.private != true))' | jq -c '.[]'); do
66+
PACKAGE=$(echo $PACKAGE_DATA | jq -r '.name')
67+
PACKAGE_PATH=$(echo $PACKAGE_DATA | jq -r '.path')
68+
69+
echo "Searching for \"workspace:*\" references in $PACKAGE_PATH/package.json"
70+
71+
# Manually replace "workspace:" constraints with the actual package version, it ensure packages can be installed with npm
72+
jq -rc '[(.dependencies // {}) + (.devDependencies // {}) | to_entries[] | select(.value == "workspace:*") | .key][]' "$PACKAGE_PATH/package.json" | while read -r PACKAGE_FROM_WORKSPACE ; do
73+
# Extract the resolved version of the package from the workspace, e.g.: "link:../../../../assets"
74+
echo "Found \"$PACKAGE_FROM_WORKSPACE\" with \"workspace:*\"
75+
76+
echo '---'
77+
pnpm ls --filter $PACKAGE_FROM_WORKSPACE --json --depth -1
78+
echo '---'
79+
80+
PACKAGE_FROM_WORKSPACE_PATH=$(cd ../..; pnpm ls --filter $PACKAGE_FROM_WORKSPACE --json --depth -1 | jq -r '.[].path')
81+
echo "The package \"$PACKAGE_FROM_WORKSPACE\" is located in \"$PACKAGE_FROM_WORKSPACE_PATH\" directory"
82+
83+
echo "Replacing \"$PACKAGE_FROM_WORKSPACE\" with \"file:$PACKAGE_FROM_WORKSPACE_PATH\" in $PACKAGE_PATH/package.json"
84+
sed -i "s|\"$PACKAGE_FROM_WORKSPACE\": \"workspace:\*\"|\"$PACKAGE_FROM_WORKSPACE\": \"file:$PACKAGE_FROM_WORKSPACE_PATH\"|g" "$PACKAGE_PATH/package.json"
85+
done;
86+
done
87+
6388
- working-directory: test_apps/encore-app
64-
run: pnpm install --ignore-workspace
89+
run: npm install
6590

6691
- if: matrix.ux-packages-source == 'js-packages'
6792
name: Install UX JS packages with a JS package manager
6893
working-directory: test_apps/encore-app
6994
run: |
7095
PACKAGES_TO_INSTALL=''
71-
for PACKAGE in $(cd ../..; pnpm ls -r --json --depth -1 | jq 'map(select(.private != true))' | jq -c '.[]'); do
72-
PACKAGE_ABSOLUTE_PATH=$(echo $PACKAGE | jq -r '.path')
73-
PACKAGE_RELATIVE_PATH=$(realpath --relative-to=. "$PACKAGE_ABSOLUTE_PATH")
74-
PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL file:$PACKAGE_RELATIVE_PATH"
96+
for PACKAGE_DATA in $(cd ../..; pnpm ls -r --json --depth -1 | jq 'map(select(.private != true))' | jq -c '.[]'); do
97+
PACKAGE_PATH=$(echo $PACKAGE_DATA | jq -r '.path')
98+
PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL file:$(realpath --relative-to=. "$PACKAGE_PATH")"
7599
done
100+
76101
echo "Installing packages: $PACKAGES_TO_INSTALL"
77-
pnpm add --save-dev $PACKAGES_TO_INSTALL
102+
npm add --save-dev $PACKAGES_TO_INSTALL
78103
79104
- name: Ensure UX packages are installed from "${{ env.EXPECTED_PATTERN }}"
80105
working-directory: test_apps/encore-app
81106
run: |
82107
for PACKAGE in $(cat package.json | jq -c '(.dependencies // {}) + (.devDependencies // {}) | to_entries[] | select(.key | startswith("@symfony/ux-")) | {name: .key, version: .value}'); do
83-
PACKAGE_NAME=$(echo $PACKAGE | jq -r '.name')
108+
PACKAGE=$(echo $PACKAGE | jq -r '.name')
84109
PACKAGE_VERSION=$(echo $PACKAGE | jq -r '.version')
85110
86-
echo -n "Checking $PACKAGE_NAME@$PACKAGE_VERSION..."
111+
echo -n "Checking $PACKAGE@$PACKAGE_VERSION..."
87112
if [[ $PACKAGE_VERSION == $EXPECTED_PATTERN* ]]; then
88113
echo " OK"
89114
else
90115
echo " KO"
91-
echo "The package version of $PACKAGE_NAME must starts with the pattern (e.g.: $EXPECTED_PATTERN), got $PACKAGE_VERSION instead."
116+
echo "The package version of $PACKAGE must starts with the pattern (e.g.: $EXPECTED_PATTERN), got $PACKAGE_VERSION instead."
92117
exit 1
93118
fi
94119
done;
@@ -97,8 +122,8 @@ jobs:
97122

98123
- name: Ensure project can be built in dev mode
99124
working-directory: test_apps/encore-app
100-
run: pnpm run dev
125+
run: npm run dev
101126

102127
- name: Ensure project can be built in prod mode
103128
working-directory: test_apps/encore-app
104-
run: pnpm run build
129+
run: npm run build

.github/workflows/code-quality.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ on:
66
- 'src/*/doc/**'
77
- 'src/**/*.md'
88
- 'ux.symfony.com/**'
9+
- '.github/workflows/app-tests.yaml'
910
pull_request:
1011
paths-ignore:
1112
- 'src/*/doc/**'
1213
- 'src/**/*.md'
1314
- 'ux.symfony.com/**'
15+
- '.github/workflows/app-tests.yaml'
1416

1517
concurrency:
1618
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}

.github/workflows/unit-tests.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ on:
1010
- 'src/*/doc/**'
1111
- 'src/**/*.md'
1212
- 'ux.symfony.com/**'
13+
- '.github/workflows/app-tests.yaml'
1314
pull_request:
1415
paths-ignore:
1516
- 'src/*/doc/**'
1617
- 'src/**/*.md'
1718
- 'ux.symfony.com/**'
19+
- '.github/workflows/app-tests.yaml'
1820

1921
concurrency:
2022
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}

.github/workflows/ux.symfony.com.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ on:
88
- '!src/*/doc/**'
99
- '!src/**/*.md'
1010
- '.github/**'
11+
- '!.github/workflows/app-tests.yaml'
1112
pull_request:
1213
paths:
1314
- 'ux.symfony.com/**'
1415
- 'src/*/**'
1516
- '!src/*/doc/**'
1617
- '!src/**/*.md'
1718
- '.github/**'
19+
- '!.github/workflows/app-tests.yaml'
1820

1921
jobs:
2022

src/Chartjs/composer.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"symfony/config": "^5.4|^6.0|^7.0",
3333
"symfony/dependency-injection": "^5.4|^6.0|^7.0",
3434
"symfony/http-kernel": "^5.4|^6.0|^7.0",
35-
"symfony/stimulus-bundle": "^2.9.1"
35+
"symfony/stimulus-bundle": "@dev"
3636
},
3737
"require-dev": {
3838
"symfony/framework-bundle": "^5.4|^6.0|^7.0",
@@ -49,5 +49,11 @@
4949
"url": "https://github.com/symfony/ux"
5050
}
5151
},
52-
"minimum-stability": "dev"
52+
"minimum-stability": "dev",
53+
"repositories": [
54+
{
55+
"type": "path",
56+
"url": "/Users/kocal/workspace-os/symfony-ux/src/StimulusBundle"
57+
}
58+
]
5359
}

src/Icons/composer.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"symfony/console": "^6.4|^7.0",
4545
"symfony/http-client": "6.4|^7.0",
4646
"symfony/phpunit-bridge": "^6.3|^7.0",
47-
"symfony/ux-twig-component": "^2.14",
47+
"symfony/ux-twig-component": "@dev",
4848
"zenstruck/console-test": "^1.5",
4949
"psr/log": "^2|^3"
5050
},
@@ -61,5 +61,11 @@
6161
"url": "https://github.com/symfony/ux"
6262
}
6363
},
64-
"minimum-stability": "dev"
64+
"minimum-stability": "dev",
65+
"repositories": [
66+
{
67+
"type": "path",
68+
"url": "/Users/kocal/workspace-os/symfony-ux/src/TwigComponent"
69+
}
70+
]
6571
}

src/LiveComponent/composer.json

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
"symfony/deprecation-contracts": "^2.5|^3.0",
3131
"symfony/property-access": "^5.4.5|^6.0|^7.0",
3232
"symfony/property-info": "^5.4|^6.0|^7.0",
33-
"symfony/stimulus-bundle": "^2.9",
34-
"symfony/ux-twig-component": "^2.25.1",
33+
"symfony/stimulus-bundle": "@dev",
34+
"symfony/ux-twig-component": "@dev",
3535
"twig/twig": "^3.10.3"
3636
},
3737
"require-dev": {
@@ -69,5 +69,15 @@
6969
"url": "https://github.com/symfony/ux"
7070
}
7171
},
72-
"minimum-stability": "dev"
72+
"minimum-stability": "dev",
73+
"repositories": [
74+
{
75+
"type": "path",
76+
"url": "/Users/kocal/workspace-os/symfony-ux/src/StimulusBundle"
77+
},
78+
{
79+
"type": "path",
80+
"url": "/Users/kocal/workspace-os/symfony-ux/src/TwigComponent"
81+
}
82+
]
7383
}

src/Map/composer.json

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@
3333
},
3434
"require": {
3535
"php": ">=8.1",
36-
"symfony/stimulus-bundle": "^2.18.1"
36+
"symfony/stimulus-bundle": "@dev"
3737
},
3838
"require-dev": {
3939
"symfony/asset-mapper": "^6.4|^7.0",
4040
"symfony/framework-bundle": "^6.4|^7.0",
4141
"symfony/phpunit-bridge": "^7.2",
4242
"symfony/twig-bundle": "^6.4|^7.0",
43-
"symfony/ux-twig-component": "^2.18",
44-
"symfony/ux-icons": "^2.18",
43+
"symfony/ux-twig-component": "@dev",
44+
"symfony/ux-icons": "@dev",
4545
"spatie/phpunit-snapshot-assertions": "^4.2.17",
4646
"phpunit/phpunit": "^9.6.22"
4747
},
@@ -54,5 +54,19 @@
5454
"url": "https://github.com/symfony/ux"
5555
}
5656
},
57-
"minimum-stability": "dev"
57+
"minimum-stability": "dev",
58+
"repositories": [
59+
{
60+
"type": "path",
61+
"url": "/Users/kocal/workspace-os/symfony-ux/src/Icons"
62+
},
63+
{
64+
"type": "path",
65+
"url": "/Users/kocal/workspace-os/symfony-ux/src/StimulusBundle"
66+
},
67+
{
68+
"type": "path",
69+
"url": "/Users/kocal/workspace-os/symfony-ux/src/TwigComponent"
70+
}
71+
]
5872
}

src/Map/src/Bridge/Google/composer.json

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
"name": "symfony/ux-google-map",
33
"type": "symfony-ux-map-bridge",
44
"description": "Symfony UX Map GoogleMaps Bridge",
5-
"keywords": ["symfony-ux", "google-maps", "map"],
5+
"keywords": [
6+
"symfony-ux",
7+
"google-maps",
8+
"map"
9+
],
610
"homepage": "https://symfony.com",
711
"license": "MIT",
812
"authors": [
@@ -17,21 +21,39 @@
1721
],
1822
"require": {
1923
"php": ">=8.1",
20-
"symfony/stimulus-bundle": "^2.18.1",
21-
"symfony/ux-map": "^2.19"
24+
"symfony/stimulus-bundle": "@dev",
25+
"symfony/ux-map": "@dev"
2226
},
2327
"require-dev": {
2428
"symfony/phpunit-bridge": "^7.2",
25-
"symfony/ux-icons": "^2.18",
29+
"symfony/ux-icons": "@dev",
2630
"spatie/phpunit-snapshot-assertions": "^4.2.17",
2731
"phpunit/phpunit": "^9.6.22"
2832
},
2933
"autoload": {
30-
"psr-4": { "Symfony\\UX\\Map\\Bridge\\Google\\": "src/" },
34+
"psr-4": {
35+
"Symfony\\UX\\Map\\Bridge\\Google\\": "src/"
36+
},
3137
"exclude-from-classmap": []
3238
},
3339
"autoload-dev": {
34-
"psr-4": { "Symfony\\UX\\Map\\Bridge\\Google\\Tests\\": "tests/" }
40+
"psr-4": {
41+
"Symfony\\UX\\Map\\Bridge\\Google\\Tests\\": "tests/"
42+
}
3543
},
36-
"minimum-stability": "dev"
44+
"minimum-stability": "dev",
45+
"repositories": [
46+
{
47+
"type": "path",
48+
"url": "/Users/kocal/workspace-os/symfony-ux/src/Icons"
49+
},
50+
{
51+
"type": "path",
52+
"url": "/Users/kocal/workspace-os/symfony-ux/src/Map"
53+
},
54+
{
55+
"type": "path",
56+
"url": "/Users/kocal/workspace-os/symfony-ux/src/StimulusBundle"
57+
}
58+
]
3759
}

src/Map/src/Bridge/Leaflet/composer.json

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
"name": "symfony/ux-leaflet-map",
33
"type": "symfony-ux-map-bridge",
44
"description": "Symfony UX Map Leaflet Bridge",
5-
"keywords": ["symfony-ux", "leaflet", "map"],
5+
"keywords": [
6+
"symfony-ux",
7+
"leaflet",
8+
"map"
9+
],
610
"homepage": "https://symfony.com",
711
"license": "MIT",
812
"authors": [
@@ -17,21 +21,39 @@
1721
],
1822
"require": {
1923
"php": ">=8.1",
20-
"symfony/stimulus-bundle": "^2.18.1",
21-
"symfony/ux-map": "^2.19"
24+
"symfony/stimulus-bundle": "@dev",
25+
"symfony/ux-map": "@dev"
2226
},
2327
"require-dev": {
2428
"symfony/phpunit-bridge": "^7.2",
25-
"symfony/ux-icons": "^2.18",
29+
"symfony/ux-icons": "@dev",
2630
"spatie/phpunit-snapshot-assertions": "^4.2.17",
2731
"phpunit/phpunit": "^9.6.22"
2832
},
2933
"autoload": {
30-
"psr-4": { "Symfony\\UX\\Map\\Bridge\\Leaflet\\": "src/" },
34+
"psr-4": {
35+
"Symfony\\UX\\Map\\Bridge\\Leaflet\\": "src/"
36+
},
3137
"exclude-from-classmap": []
3238
},
3339
"autoload-dev": {
34-
"psr-4": { "Symfony\\UX\\Map\\Bridge\\Leaflet\\Tests\\": "tests/" }
40+
"psr-4": {
41+
"Symfony\\UX\\Map\\Bridge\\Leaflet\\Tests\\": "tests/"
42+
}
3543
},
36-
"minimum-stability": "dev"
44+
"minimum-stability": "dev",
45+
"repositories": [
46+
{
47+
"type": "path",
48+
"url": "/Users/kocal/workspace-os/symfony-ux/src/Icons"
49+
},
50+
{
51+
"type": "path",
52+
"url": "/Users/kocal/workspace-os/symfony-ux/src/Map"
53+
},
54+
{
55+
"type": "path",
56+
"url": "/Users/kocal/workspace-os/symfony-ux/src/StimulusBundle"
57+
}
58+
]
3759
}

0 commit comments

Comments
 (0)