@@ -19,6 +19,117 @@ concurrency:
19
19
cancel-in-progress : true
20
20
21
21
jobs :
22
+ validate-packages :
23
+ name : Valide packages definition
24
+ runs-on : ubuntu-latest
25
+ steps :
26
+ - uses : actions/checkout@v4
27
+
28
+ - run : npm i -g corepack && corepack enable
29
+ - uses : actions/setup-node@v4
30
+ with :
31
+ node-version-file : ' .nvmrc'
32
+ cache : ' pnpm'
33
+ cache-dependency-path : |
34
+ pnpm-lock.yaml
35
+ package.json
36
+
37
+ - name : Install root JS dependencies
38
+ run : pnpm install --frozen-lockfile
39
+
40
+ - name : Check all composer.json have label "symfony-ux"
41
+ run : |
42
+ for file in $(find src/ -mindepth 2 -type f -name composer.json -not -path "*/vendor/*"); do
43
+ if ! jq -e '.keywords | index("symfony-ux")' "$file" > /dev/null; then
44
+ echo "File $file does not have the keyword 'symfony-ux' in its composer.json";
45
+ exit 1;
46
+ fi
47
+ done
48
+
49
+ - name : Check all composer.json have license "MIT"
50
+ run : |
51
+ for file in $(find src/ -mindepth 2 -type f -name composer.json -not -path "*/vendor/*"); do
52
+ if ! jq -e '.license == "MIT"' "$file" > /dev/null; then
53
+ echo "File $file does not have the license 'MIT' in its composer.json";
54
+ exit 1;
55
+ fi
56
+ done
57
+
58
+ - name : Check all composer.json have minimum-stability "dev"
59
+ run : |
60
+ for file in $(find src/ -mindepth 2 -type f -name composer.json -not -path "*/vendor/*"); do
61
+ if ! jq -e '."minimum-stability" == "dev"' "$file" > /dev/null; then
62
+ echo "File $file does not have the minimum-stability 'dev' in its composer.json";
63
+ exit 1;
64
+ fi
65
+ done
66
+
67
+ - name : Check all composer.json have dependency to "php" >=8.1
68
+ run :
69
+ for file in $(find src/ -mindepth 2 -type f -name composer.json -not -path "*/vendor/*"); do
70
+ if ! jq -e '.require.php | test(">=8.1")' "$file" > /dev/null; then
71
+ echo "File $file does not have the dependency 'php' >=8.1 in its composer.json";
72
+ exit 1;
73
+ fi
74
+ done
75
+
76
+ - name : Check all package.json have license "MIT"
77
+ run : |
78
+ for file in $(find src/ -mindepth 2 -type f -name package.json -not -path "*/vendor/*" -not -path "*/node_modules/*" -not -path "*/tests/*"); do
79
+ if ! jq -e '.license == "MIT"' "$file" > /dev/null; then
80
+ echo "File $file does not have the license 'MIT' in its package.json";
81
+ exit 1;
82
+ fi
83
+ done
84
+
85
+ - name : Check all package.json have keywords including "symfony-ux"
86
+ run : |
87
+ for file in $(find src/ -mindepth 2 -type f -name package.json -not -path "*/vendor/*" -not -path "*/node_modules/*" -not -path "*/tests/*"); do
88
+ if ! jq -e '.keywords | index("symfony-ux")' "$file" > /dev/null; then
89
+ echo "File $file does not have the keyword 'symfony-ux' in its package.json";
90
+ exit 1;
91
+ fi
92
+ done
93
+
94
+
95
+ - name : Check all package.json have type "module"
96
+ run : |
97
+ for file in $(find src/ -mindepth 2 -type f -name package.json -not -path "*/vendor/*" -not -path "*/node_modules/*" -not -path "*/tests/*"); do
98
+ if ! jq -e '.type == "module"' "$file" > /dev/null; then
99
+ echo "File $file does not have the type 'module' in its package.json";
100
+ exit 1;
101
+ fi
102
+ done
103
+
104
+ - name : Check all package.json have files '["dist"]'
105
+ run : |
106
+ for file in $(find src/ -mindepth 2 -type f -name package.json -not -path "*/vendor/*" -not -path "*/node_modules/*" -not -path "*/tests/*"); do
107
+ if ! jq -e '.files | index("dist")' "$file" > /dev/null; then
108
+ echo "File $file does not have the files 'dist' in its package.json";
109
+ exit 1;
110
+ fi
111
+ done
112
+
113
+ - name : Check all package.json peerDependencies are present in devDependencies and importmap to the exact same version
114
+ run : |
115
+ for file in $(find src/ -mindepth 2 -type f -name package.json -not -path "*/vendor/*" -not -path "*/node_modules/*" -not -path "*/tests/*"); do
116
+ peerDependencies=$(jq -r '.peerDependencies | keys[]' "$file")
117
+ for peerDependency in $peerDependencies; do
118
+ peerDependencyVersion=$(jq -r --arg dep "$peerDependency" '.peerDependencies[$dep]' "$file")
119
+ importmapVersion=$(jq -r ".symfony.importmap.\"$peerDependency\" | if type == \"string\" then . else .version end" "$file")
120
+
121
+ if [ "$importmapVersion" == null ]; then
122
+ echo "File $file does not have the peerDependency '$peerDependency' in its symfony.importmap, skipping version check";
123
+ continue
124
+ fi
125
+
126
+ if [ "$peerDependencyVersion" != "$importmapVersion" ]; then
127
+ echo "File $file has a mismatch for $peerDependency: peerDependency version is '$peerDependencyVersion' but symfony.importmap version is '$importmapVersion'";
128
+ exit 1;
129
+ fi
130
+ done
131
+ done
132
+
22
133
coding-style-js :
23
134
name : JavaScript Coding Style
24
135
runs-on : ubuntu-latest
0 commit comments