Skip to content

Commit 85b11e6

Browse files
Readd ga check
1 parent 05ff970 commit 85b11e6

File tree

1 file changed

+228
-4
lines changed

1 file changed

+228
-4
lines changed

.github/workflows/callable-qa.yml

Lines changed: 228 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,236 @@ on:
1313
find_yaml:
1414
required: false
1515
type: string
16+
skeleton_74:
17+
required: false
18+
default: symfony/skeleton
19+
type: string
20+
skeleton_74_version:
21+
required: false
22+
default: ^5
23+
type: string
24+
skeleton_81:
25+
required: false
26+
default: symfony/skeleton
27+
type: string
28+
skeleton_81_version:
29+
required: false
30+
default: ^6
31+
type: string
1632
secrets:
1733
token:
1834
required: true
1935

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

@@ -46,8 +270,8 @@ jobs:
46270
run: |
47271
set -x
48272
php -v
49-
composer create-project --ansi "symfony/skeleton:^5" v5
50-
cd v5
273+
composer create-project --ansi "${{ inputs.skeleton_74 }}:${{ inputs.skeleton_74_version }}" skeleton_74
274+
cd skeleton_74
51275
composer config extra.symfony.allow-contrib ${{ inputs.contrib && 'true' || 'false' }}
52276
composer config minimum-stability dev
53277
export SYMFONY_ENDPOINT=https://raw.githubusercontent.com/${{ github.repository }}/flex/pull-${{ github.event.number }}/index.json
@@ -74,8 +298,8 @@ jobs:
74298
run: |
75299
set -x
76300
php -v
77-
composer create-project --ansi "symfony/skeleton:^6" v6
78-
cd v6
301+
composer create-project --ansi "${{ inputs.skeleton_81 }}:${{ inputs.skeleton_81_version }}" skeleton_81
302+
cd skeleton_81
79303
composer config extra.symfony.allow-contrib ${{ inputs.contrib && 'true' || 'false' }}
80304
composer config minimum-stability dev
81305
export SYMFONY_ENDPOINT=https://raw.githubusercontent.com/${{ github.repository }}/flex/pull-${{ github.event.number }}/index.json

0 commit comments

Comments
 (0)