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