@@ -8,247 +8,7 @@ defaults:
88 shell : bash
99
1010jobs :
11-
12- tests :
13- name : Run checks
14- runs-on : Ubuntu-20.04
15-
16- steps :
17- -
18- name : Checkout
19- uses : actions/checkout@v2
20- id : checkout
21- with :
22- fetch-depth : 0
23- ref : ' refs/pull/${{ github.event.number }}/merge'
24-
25- -
26- name : Install tools
27- run : |
28- git config --global user.email ""
29- git config --global user.name "github-action bot"
30- cd .github
31- wget -q -O recipes-checker.zip https://codeload.github.com/symfony-tools/recipes-checker/zip/refs/heads/main
32- unzip recipes-checker.zip
33- cd recipes-checker-main
34- composer install --ansi --no-dev
35-
36- -
37- name : Check manifest.json files
38- if : " always() && steps.checkout.outcome == 'success'"
39- run : |
40- .github/recipes-checker-main/run lint:manifests
41-
42- -
43- name : Remove non-patched packages
44- if : " always() && steps.checkout.outcome == 'success'"
45- run : |
46- .github/recipes-checker-main/run list-unpatched-packages $GITHUB_EVENT_PATH ${{ secrets.GITHUB_TOKEN }} | xargs -r -n10 rm -rf
47-
48- -
49- name : Generate Flex testing endpoint
50- if : " always() && steps.checkout.outcome == 'success' && github.base_ref == 'master'"
51- run : |
52- mkdir .github/flex-endpoint
53- git ls-tree HEAD */*/* | php .github/recipes-checker-main/run generate:flex-endpoint ${{ github.repository }} master flex/pull-${{ github.event.number }} .github/flex-endpoint
54- git stash
55- git switch -c pr
56- git switch --orphan flex/pull-${{ github.event.number }}
57- git reset --hard -q
58- mv .github/flex-endpoint/*.json .
59- git add *.json
60- git commit -m 'Create Flex endpoint' || true
61- git push origin -f flex/pull-${{ github.event.number }}
62- git switch pr
63- git stash pop -q
64-
65- -
66- name : Compute diff between recipe versions
67- if : " always() && steps.checkout.outcome == 'success'"
68- run : |
69- find * -mindepth 1 -maxdepth 1 -type d | sort \
70- | .github/recipes-checker-main/run diff-recipe-versions 'https://api.github.com/repos/${{ github.repository }}/contents/index.json?ref=flex/pull-${{ github.event.number }}' \
71- > .github/diff-recipe-versions.md
72-
73- -
74- name : Post diff between recipe versions
75- if : " always() && steps.checkout.outcome == 'success'"
76- uses : marocchino/sticky-pull-request-comment@v2
77- with :
78- path : .github/diff-recipe-versions.md
79-
80- -
81- name : No symlinks
82- if : " always() && steps.checkout.outcome == 'success'"
83- run : |
84- SYMLINKS=$(find * -type l)
85-
86- if [[ "" != "$SYMLINKS" ]]; then echo -e "::error::Symlinks are not allowed\nFound $SYMLINKS\n"; exit 1; fi
87-
88- -
89- name : No .yml, use .yaml
90- if : " always() && steps.checkout.outcome == 'success'"
91- run : |
92- YMLS=$(find * -name '*.yml')
93-
94- if [[ "" != "$YMLS" ]]; then echo -e "::error::*.yml files should renamed to *.yaml\nFound $YMLS\n"; exit 1; fi
95-
96- -
97- name : No .gitkeep, use .gitignore
98- if : " always() && steps.checkout.outcome == 'success'"
99- run : |
100- GITKEEPS=$(find * -name .gitkeep)
101-
102- if [[ "" != "$GITKEEPS" ]]; then echo -e "::error::.gitkeep files should be renamed to .gitignore\nFound $GITKEEPS\n"; exit 1; fi
103-
104- -
105- name : 4 spaces indentation
106- if : " always() && steps.checkout.outcome == 'success'"
107- run : |
108- ERRORS=$(find * -name '*.yaml' -or -name '*.json' \
109- | xargs -n1 grep -P -H -n -v '^(( )*[^ \t]|$)' \
110- | cut -d: -f1-2 \
111- | sed 's/\(.*\):\([0-9]*\)$/\\n::error file=\1,line=\2::Indendation must be a multiple of 4 spaces/' || true)
112-
113- if [[ "" != "$ERRORS" ]]; then echo -e "$ERRORS\n"; exit 1; fi
114-
115- -
116- name : Text files end with a newline
117- if : " always() && steps.checkout.outcome == 'success'"
118- run : |
119- ERRORS=$(find * -name '*.yaml' -or -name '*.yml' -or -name '*.txt' -or -name '*.md' -or -name '*.markdown' \
120- -or -name '*.json' -or -name '*.rst' -or -name '*.php' -or -name '*.js' -or -name '*.css' -or -name '*.twig' \
121- | xargs -n1 -I{} bash -c '[ -n "$(tail -c1 {})" ] && echo ::error file={},line=$((1 + `wc -l {} | cut -d" " -f1`))::Should end with a newline' || true)
122-
123- if [[ "" != "$ERRORS" ]]; then echo -e "$ERRORS\n"; exit 1; fi
124-
125- -
126- name : Use https when referencing symfony.com
127- if : " always() && steps.checkout.outcome == 'success'"
128- run : |
129- ERRORS=$(grep -H -n 'http://.*symfony\.com' * -r \
130- | cut -d: -f1-2 \
131- | sed 's/\(.*\):\([0-9]*\)$/\\n::error file=\1,line=\2::Use https when referencing symfony.com/' || true)
132-
133- if [[ "" != "$ERRORS" ]]; then echo -e "$ERRORS\n"; exit 1; fi
134-
135- -
136- name : manifest.json is found
137- if : " always() && steps.checkout.outcome == 'success'"
138- run : |
139- MISSING=$(find * -mindepth 2 -maxdepth 2 -type d '!' -exec test -f '{}/manifest.json' ';' -print)
140-
141- if [[ "" != "$MISSING" ]]; then echo -e "::error::Recipes must define a \"manifest.json\" file\nFile not found in $MISSING\n"; exit 1; fi
142-
143- -
144- name : JSON files are valid
145- if : " always() && steps.checkout.outcome == 'success'"
146- run : |
147- 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 *}')
148-
149- if [[ "" != "$ERRORS" ]]; then echo -e "$ERRORS\n"; exit 1; fi
150-
151- -
152- name : YAML files are valid
153- if : " always() && steps.checkout.outcome == 'success'"
154- run : |
155- find * -name '*.yaml' -or -name '*.yml' | .github/recipes-checker-main/run lint:yaml
156-
157- -
158- name : Packages exist on packagist.org
159- if : " always() && steps.checkout.outcome == 'success'"
160- run : |
161- .github/recipes-checker-main/run lint:packages
162-
163- -
164- name : Contribution is under MIT and has no merge commits
165- if : " always() && steps.checkout.outcome == 'success'"
166- run : |
167- .github/recipes-checker-main/run lint:pull-request $GITHUB_EVENT_PATH ${{ secrets.GITHUB_TOKEN }}
168-
169- -
170- name : Parameters should be defined via the "container" configurator
171- if : " always() && steps.checkout.outcome == 'success'"
172- run : |
173- ERRORS=$(find */*/*/config/packages/ -name '*.yaml' -or -name '*.yml' \
174- | xargs -n1 grep -P -H -n '^parameters:' \
175- | cut -d: -f1-2 \
176- | sed 's/\(.*\):\([0-9]*\)$/\\n::error file=\1,line=\2::"parameters" should be defined via the "container" configurator instead/' || true)
177-
178- if [[ "" != "$ERRORS" ]]; then echo -e "$ERRORS\n"; exit 1; fi
179-
180- -
181- name : Underscore notation under config/
182- if : " always() && steps.checkout.outcome == 'success'"
183- run : |
184- ERRORS=$(find */*/*/config -type f \
185- | grep -v -P '[^/]+/[^/]+/[^/]+/config/[0-9a-z_./]+$' \
186- | xargs -n1 -I{} echo "::error file={}::Underscore notation is required for file and directory names under config/" || true)
187-
188- if [[ "" != "$ERRORS" ]]; then echo -e "$ERRORS\n"; exit 1; fi
189-
190- -
191- name : Yaml nulls should not be "~"
192- if : " always() && steps.checkout.outcome == 'success'"
193- run : |
194- ERRORS=$(find * -name '*.yaml' -or -name '*.yml' \
195- | xargs -n1 grep -F -H -n ': ~'\
196- | cut -d: -f1-2 \
197- | sed 's/\(.*\):\([0-9]*\)$/\\n::error file=\1,line=\2::"~" should be replaced with "null"/' || true)
198-
199- if [[ "" != "$ERRORS" ]]; then echo -e "$ERRORS\n"; exit 1; fi
200-
201- -
202- name : Symfony commands should not be wrapped in a Makefile
203- if : " always() && steps.checkout.outcome == 'success'"
204- run : |
205- ERRORS=$(find * -name Makefile \
206- | xargs -n1 grep -P -H -n 'bin/console|\$\(CONSOLE\)' \
207- | cut -d: -f1-2 \
208- | sed 's/\(.*\):\([0-9]*\)$/\\n::error file=\1,line=\2::Symfony commands should not be wrapped in a Makefile/' || true)
209-
210- if [[ "" != "$ERRORS" ]]; then echo -e "$ERRORS\n"; exit 1; fi
211-
212- create-project :
213- needs : tests
214- name : Run updated recipes
215- runs-on : Ubuntu-20.04
216-
217- steps :
218- -
219- name : Setup PHP
220- uses : shivammathur/setup-php@v2
221- with :
222- coverage : " none"
223- php-version : " 7.4"
224-
225- -
226- name : Export configuration
227- continue-on-error : true
228- id : config
229- run : |
230- PACKAGES=$(curl -s https://raw.githubusercontent.com/${{ github.repository }}/flex/pull-${{ github.event.number }}/index.json | jq -r '.recipes | to_entries | map(.key+":^"+.value[-1]) | join(" ")')
231- echo PACKAGES=$PACKAGES >> $GITHUB_ENV
232- [[ "" != "$PACKAGES" ]]
233-
234- -
235- name : Create-project with skeleton ^4
236- if : " always() && steps.config.outcome == 'success'"
237- run : |
238- set -x
239- composer create-project --ansi "symfony/skeleton:^4" v4
240- cd v4
241- composer config minimum-stability dev
242- export SYMFONY_ENDPOINT=https://api.github.com/repos/${{ github.repository }}/contents/index.json?ref=flex/pull-${{ github.event.number }}
243- composer require -W --ansi $PACKAGES
244-
245- -
246- name : Create-project with skeleton ^5
247- if : " always() && steps.config.outcome == 'success'"
248- run : |
249- set -x
250- composer create-project --ansi "symfony/skeleton:^5" v5
251- cd v5
252- composer config minimum-stability dev
253- export SYMFONY_ENDPOINT=https://api.github.com/repos/${{ github.repository }}/contents/index.json?ref=flex/pull-${{ github.event.number }}
254- composer require -W --ansi $PACKAGES
11+ call-qa :
12+ uses : symfony/recipes/.github/workflows/callable-qa.yml@main
13+ with :
14+ branch : master
0 commit comments