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