Skip to content

Commit 0ffdf8c

Browse files
Move checks to GHA
1 parent 6a19943 commit 0ffdf8c

File tree

6 files changed

+174
-23
lines changed

6 files changed

+174
-23
lines changed

.editorconfig

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ root = true
55
[*]
66
end_of_line = LF
77

8+
[*.{yml,yaml}]
9+
indent_style = space
10+
indent_size = 4
11+
812
[*.json]
913
indent_style = space
1014
indent_size = 4

.github/PULL_REQUEST_TEMPLATE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
| Q | A
22
| ------------- | ---
33
| License | MIT
4-
| Doc issue/PR | symfony/symfony-docs#...
4+
| Doc issue/PR | symfony/symfony-docs#...
55

66
<!--
77
Please, carefully read the README before submitting a pull request.

.github/workflows/qa.yml

+165-18
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,173 @@
11
name: Q&A
22

33
on:
4-
pull_request:
4+
pull_request:
55

66
defaults:
7-
run:
8-
shell: bash
7+
run:
8+
shell: bash
99

1010
jobs:
1111

12-
tests:
13-
name: Checks
14-
runs-on: Ubuntu-20.04
15-
16-
steps:
17-
- name: Checkout
18-
uses: actions/checkout@v2
19-
20-
- name: No symlinks
21-
run: |
22-
SYMLINKS=$(find -type l)
23-
if [[ "" != "$SYMLINKS" ]]; then
24-
echo "::error::Symlinks are not allowed"
25-
echo "Found $SYMLINKS"
26-
fi
12+
tests:
13+
name: Checks
14+
runs-on: Ubuntu-20.04
15+
16+
steps:
17+
-
18+
name: Checkout
19+
uses: actions/checkout@v2
20+
id: checkout
21+
22+
-
23+
name: Install tools
24+
run: |
25+
cd .github
26+
wget -q -O recipes-checker.zip https://codeload.github.com/symfony-tools/recipes-checker/zip/refs/heads/main
27+
unzip recipes-checker.zip
28+
cd recipes-checker-main
29+
composer install --no-dev
30+
31+
-
32+
name: Check manifest.json files
33+
if: "always() && steps.checkout.outcome == 'success'"
34+
run: |
35+
.github/recipes-checker-main/run lint:manifests
36+
37+
-
38+
name: Remove non-patched packages
39+
if: "always() && steps.checkout.outcome == 'success'"
40+
run: |
41+
.github/recipes-checker-main/run list-unpatched-packages $GITHUB_EVENT_PATH ${{ secrets.GITHUB_TOKEN }} | xargs -n10 rm -rf
42+
43+
-
44+
name: No symlinks
45+
if: "always() && steps.checkout.outcome == 'success'"
46+
run: |
47+
SYMLINKS=$(find * -type l)
48+
49+
if [[ "" != "$SYMLINKS" ]]; then echo -e "::error::Symlinks are not allowed\nFound $SYMLINKS\n"; exit 1; fi
50+
51+
-
52+
name: No .yml, use .yaml
53+
if: "always() && steps.checkout.outcome == 'success'"
54+
run: |
55+
YMLS=$(find * -name '*.yml')
56+
57+
if [[ "" != "$YMLS" ]]; then echo -e "::error::*.yml files should renamed to *.yaml\nFound $YMLS\n"; exit 1; fi
58+
59+
-
60+
name: No .gitkeep, use .gitignore
61+
if: "always() && steps.checkout.outcome == 'success'"
62+
run: |
63+
GITKEEPS=$(find * -name .gitkeep)
64+
65+
if [[ "" != "$GITKEEPS" ]]; then echo -e "::error::.gitkeep files should be renamed to .gitignore\nFound $GITKEEPS\n"; exit 1; fi
66+
67+
-
68+
name: 4 spaces indentation
69+
if: "always() && steps.checkout.outcome == 'success'"
70+
run: |
71+
ERRORS=$(find * -name '*.yaml' -or -name '*.json' \
72+
| xargs -n1 grep -P -H -n -v '^(( )*[^ \t]|$)' \
73+
| cut -d: -f1-2 \
74+
| sed 's/\(.*\):\([0-9]*\)$/\\n::error file=\1,line=\2::Indendation must be a multiple of 4 spaces/' || true)
75+
76+
if [[ "" != "$ERRORS" ]]; then echo -e "$ERRORS\n"; exit 1; fi
77+
78+
-
79+
name: Text files end with a newline
80+
if: "always() && steps.checkout.outcome == 'success'"
81+
run: |
82+
ERRORS=$(find * -name '*.yaml' -or -name '*.yml' -or -name '*.txt' -or -name '*.md' -or -name '*.markdown' \
83+
-or -name '*.json' -or -name '*.rst' -or -name '*.php' -or -name '*.js' -or -name '*.css' -or -name '*.twig' \
84+
| xargs -n1 -I{} bash -c '[ -n "$(tail -c1 {})" ] && echo ::error file={},line=$((1 + `wc -l {} | cut -d" " -f1`))::Should end with a newline' || true)
85+
86+
if [[ "" != "$ERRORS" ]]; then echo -e "$ERRORS\n"; exit 1; fi
87+
88+
-
89+
name: Use https when referencing symfony.com
90+
if: "always() && steps.checkout.outcome == 'success'"
91+
run: |
92+
ERRORS=$(grep -H -n 'http://.*symfony\.com' * -r \
93+
| cut -d: -f1-2 \
94+
| sed 's/\(.*\):\([0-9]*\)$/\\n::error file=\1,line=\2::Use https when referencing symfony.com/' || true)
95+
96+
if [[ "" != "$ERRORS" ]]; then echo -e "$ERRORS\n"; exit 1; fi
97+
98+
-
99+
name: manifest.json is found
100+
if: "always() && steps.checkout.outcome == 'success'"
101+
run: |
102+
MISSING=$(find * -mindepth 2 -maxdepth 2 -type d '!' -exec test -f '{}/manifest.json' ';' -print)
103+
104+
if [[ "" != "$MISSING" ]]; then echo -e "::error::Recipes must define a \"manifest.json\" file\nFile not found in $MISSING\n"; exit 1; fi
105+
106+
-
107+
name: JSON files are valid
108+
if: "always() && steps.checkout.outcome == 'success'"
109+
run: |
110+
ERRORS=$(find * -name '*.json' | parallel -j+3 -i{} -n1 bash -c 'ERR=$(python -mjson.tool {} 2>&1 1> /dev/null) || echo \\n::error file={},line=`echo "${ERR#*: line }" | cut -d" " -f 1`::${ERR%%: line *}')
111+
112+
if [[ "" != "$ERRORS" ]]; then echo -e "$ERRORS\n"; exit 1; fi
113+
114+
-
115+
name: YAML files are valid
116+
if: "always() && steps.checkout.outcome == 'success'"
117+
run: |
118+
find * -name '*.yaml' -or -name '*.yml' | .github/recipes-checker-main/run lint:yaml
119+
120+
-
121+
name: Packages exist on packagist.org
122+
if: "always() && steps.checkout.outcome == 'success'"
123+
run: |
124+
.github/recipes-checker-main/run lint:packages
125+
126+
-
127+
name: Contribution is under MIT and has no merge commits
128+
if: "always() && steps.checkout.outcome == 'success'"
129+
run: |
130+
.github/recipes-checker-main/run lint:pull-request $GITHUB_EVENT_PATH ${{ secrets.GITHUB_TOKEN }}
131+
132+
-
133+
name: Parameters should be defined via the "container" configurator
134+
if: "always() && steps.checkout.outcome == 'success'"
135+
run: |
136+
ERRORS=$(find */*/*/config/packages/ -name '*.yaml' -or -name '*.yml' \
137+
| xargs -n1 grep -P -H -n '^parameters:' \
138+
| cut -d: -f1-2 \
139+
| sed 's/\(.*\):\([0-9]*\)$/\\n::error file=\1,line=\2::"parameters" should be defined via the "container" configurator instead/' || true)
140+
141+
if [[ "" != "$ERRORS" ]]; then echo -e "$ERRORS\n"; exit 1; fi
142+
143+
-
144+
name: Underscore notation under config/
145+
if: "always() && steps.checkout.outcome == 'success'"
146+
run: |
147+
ERRORS=$(find */*/*/config -type f \
148+
| grep -v -P '[^/]+/[^/]+/[^/]+/config/[0-9a-z_./]+$' \
149+
| xargs -n1 -I{} echo "::error file={}::Underscore notation is required for file and directory names under config/" || true)
150+
151+
if [[ "" != "$ERRORS" ]]; then echo -e "$ERRORS\n"; exit 1; fi
152+
153+
-
154+
name: Yaml nulls should not be "~"
155+
if: "always() && steps.checkout.outcome == 'success'"
156+
run: |
157+
ERRORS=$(find * -name '*.yaml' -or -name '*.yml' \
158+
| xargs -n1 grep -F -H -n ': ~'\
159+
| cut -d: -f1-2 \
160+
| sed 's/\(.*\):\([0-9]*\)$/\\n::error file=\1,line=\2::"~" should be replaced with "null"/' || true)
161+
162+
if [[ "" != "$ERRORS" ]]; then echo -e "$ERRORS\n"; exit 1; fi
163+
164+
-
165+
name: Symfony commands should not be wrapped in a Makefile
166+
if: "always() && steps.checkout.outcome == 'success'"
167+
run: |
168+
ERRORS=$(find * -name Makefile \
169+
| xargs -n1 grep -P -H -n 'bin/console|\$\(CONSOLE\)' \
170+
| cut -d: -f1-2 \
171+
| sed 's/\(.*\):\([0-9]*\)$/\\n::error file=\1,line=\2::Symfony commands should not be wrapped in a Makefile/' || true)
172+
173+
if [[ "" != "$ERRORS" ]]; then echo -e "$ERRORS\n"; exit 1; fi

lexik/jwt-authentication-bundle/2.3/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
"JWT_PASSPHRASE": "%generate(secret)%"
1414
},
1515
"gitignore": [
16-
"/%CONFIG_DIR%/jwt/*.pem"
16+
"/%CONFIG_DIR%/jwt/*.pem"
1717
]
1818
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# See https://symfony.com/doc/current/email/dev_environment.html
2-
swiftmailer:
3-
# send all emails to a specific address
4-
#delivery_addresses: ['[email protected]']
2+
#swiftmailer:
3+
# send all emails to a specific address
4+
# delivery_addresses: ['[email protected]']

0 commit comments

Comments
 (0)