mirror of
https://github.com/symfony/recipes.git
synced 2026-09-11 15:16:30 +03:00
Move checks to GHA
This commit is contained in:
@@ -5,6 +5,10 @@ root = true
|
|||||||
[*]
|
[*]
|
||||||
end_of_line = LF
|
end_of_line = LF
|
||||||
|
|
||||||
|
[*.{yml,yaml}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
[*.json]
|
[*.json]
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
|
|||||||
+154
-7
@@ -14,13 +14,160 @@ jobs:
|
|||||||
runs-on: Ubuntu-20.04
|
runs-on: Ubuntu-20.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
-
|
||||||
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
id: checkout
|
||||||
|
|
||||||
- name: No symlinks
|
-
|
||||||
|
name: Install tools
|
||||||
run: |
|
run: |
|
||||||
SYMLINKS=$(find -type l)
|
cd .github
|
||||||
if [[ "" != "$SYMLINKS" ]]; then
|
wget -q -O recipes-checker.zip https://codeload.github.com/symfony-tools/recipes-checker/zip/refs/heads/main
|
||||||
echo "::error::Symlinks are not allowed"
|
unzip recipes-checker.zip
|
||||||
echo "Found $SYMLINKS"
|
cd recipes-checker-main
|
||||||
fi
|
composer install --no-dev
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Check manifest.json files
|
||||||
|
if: "always() && steps.checkout.outcome == 'success'"
|
||||||
|
run: |
|
||||||
|
.github/recipes-checker-main/run lint:manifests
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Remove non-patched packages
|
||||||
|
if: "always() && steps.checkout.outcome == 'success'"
|
||||||
|
run: |
|
||||||
|
.github/recipes-checker-main/run list-unpatched-packages $GITHUB_EVENT_PATH ${{ secrets.GITHUB_TOKEN }} | xargs -n10 rm -rf
|
||||||
|
|
||||||
|
-
|
||||||
|
name: No symlinks
|
||||||
|
if: "always() && steps.checkout.outcome == 'success'"
|
||||||
|
run: |
|
||||||
|
SYMLINKS=$(find * -type l)
|
||||||
|
|
||||||
|
if [[ "" != "$SYMLINKS" ]]; then echo -e "::error::Symlinks are not allowed\nFound $SYMLINKS\n"; exit 1; fi
|
||||||
|
|
||||||
|
-
|
||||||
|
name: No .yml, use .yaml
|
||||||
|
if: "always() && steps.checkout.outcome == 'success'"
|
||||||
|
run: |
|
||||||
|
YMLS=$(find * -name '*.yml')
|
||||||
|
|
||||||
|
if [[ "" != "$YMLS" ]]; then echo -e "::error::*.yml files should renamed to *.yaml\nFound $YMLS\n"; exit 1; fi
|
||||||
|
|
||||||
|
-
|
||||||
|
name: No .gitkeep, use .gitignore
|
||||||
|
if: "always() && steps.checkout.outcome == 'success'"
|
||||||
|
run: |
|
||||||
|
GITKEEPS=$(find * -name .gitkeep)
|
||||||
|
|
||||||
|
if [[ "" != "$GITKEEPS" ]]; then echo -e "::error::.gitkeep files should be renamed to .gitignore\nFound $GITKEEPS\n"; exit 1; fi
|
||||||
|
|
||||||
|
-
|
||||||
|
name: 4 spaces indentation
|
||||||
|
if: "always() && steps.checkout.outcome == 'success'"
|
||||||
|
run: |
|
||||||
|
ERRORS=$(find * -name '*.yaml' -or -name '*.json' \
|
||||||
|
| xargs -n1 grep -P -H -n -v '^(( )*[^ \t]|$)' \
|
||||||
|
| cut -d: -f1-2 \
|
||||||
|
| sed 's/\(.*\):\([0-9]*\)$/\\n::error file=\1,line=\2::Indendation must be a multiple of 4 spaces/' || true)
|
||||||
|
|
||||||
|
if [[ "" != "$ERRORS" ]]; then echo -e "$ERRORS\n"; exit 1; fi
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Text files end with a newline
|
||||||
|
if: "always() && steps.checkout.outcome == 'success'"
|
||||||
|
run: |
|
||||||
|
ERRORS=$(find * -name '*.yaml' -or -name '*.yml' -or -name '*.txt' -or -name '*.md' -or -name '*.markdown' \
|
||||||
|
-or -name '*.json' -or -name '*.rst' -or -name '*.php' -or -name '*.js' -or -name '*.css' -or -name '*.twig' \
|
||||||
|
| xargs -n1 -I{} bash -c '[ -n "$(tail -c1 {})" ] && echo ::error file={},line=$((1 + `wc -l {} | cut -d" " -f1`))::Should end with a newline' || true)
|
||||||
|
|
||||||
|
if [[ "" != "$ERRORS" ]]; then echo -e "$ERRORS\n"; exit 1; fi
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Use https when referencing symfony.com
|
||||||
|
if: "always() && steps.checkout.outcome == 'success'"
|
||||||
|
run: |
|
||||||
|
ERRORS=$(grep -H -n 'http://.*symfony\.com' * -r \
|
||||||
|
| cut -d: -f1-2 \
|
||||||
|
| sed 's/\(.*\):\([0-9]*\)$/\\n::error file=\1,line=\2::Use https when referencing symfony.com/' || true)
|
||||||
|
|
||||||
|
if [[ "" != "$ERRORS" ]]; then echo -e "$ERRORS\n"; exit 1; fi
|
||||||
|
|
||||||
|
-
|
||||||
|
name: manifest.json is found
|
||||||
|
if: "always() && steps.checkout.outcome == 'success'"
|
||||||
|
run: |
|
||||||
|
MISSING=$(find * -mindepth 2 -maxdepth 2 -type d '!' -exec test -f '{}/manifest.json' ';' -print)
|
||||||
|
|
||||||
|
if [[ "" != "$MISSING" ]]; then echo -e "::error::Recipes must define a \"manifest.json\" file\nFile not found in $MISSING\n"; exit 1; fi
|
||||||
|
|
||||||
|
-
|
||||||
|
name: JSON files are valid
|
||||||
|
if: "always() && steps.checkout.outcome == 'success'"
|
||||||
|
run: |
|
||||||
|
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 *}')
|
||||||
|
|
||||||
|
if [[ "" != "$ERRORS" ]]; then echo -e "$ERRORS\n"; exit 1; fi
|
||||||
|
|
||||||
|
-
|
||||||
|
name: YAML files are valid
|
||||||
|
if: "always() && steps.checkout.outcome == 'success'"
|
||||||
|
run: |
|
||||||
|
find * -name '*.yaml' -or -name '*.yml' | .github/recipes-checker-main/run lint:yaml
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Packages exist on packagist.org
|
||||||
|
if: "always() && steps.checkout.outcome == 'success'"
|
||||||
|
run: |
|
||||||
|
.github/recipes-checker-main/run lint:packages
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Contribution is under MIT and has no merge commits
|
||||||
|
if: "always() && steps.checkout.outcome == 'success'"
|
||||||
|
run: |
|
||||||
|
.github/recipes-checker-main/run lint:pull-request $GITHUB_EVENT_PATH ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Parameters should be defined via the "container" configurator
|
||||||
|
if: "always() && steps.checkout.outcome == 'success'"
|
||||||
|
run: |
|
||||||
|
ERRORS=$(find */*/*/config/packages/ -name '*.yaml' -or -name '*.yml' \
|
||||||
|
| xargs -n1 grep -P -H -n '^parameters:' \
|
||||||
|
| cut -d: -f1-2 \
|
||||||
|
| sed 's/\(.*\):\([0-9]*\)$/\\n::error file=\1,line=\2::"parameters" should be defined via the "container" configurator instead/' || true)
|
||||||
|
|
||||||
|
if [[ "" != "$ERRORS" ]]; then echo -e "$ERRORS\n"; exit 1; fi
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Underscore notation under config/
|
||||||
|
if: "always() && steps.checkout.outcome == 'success'"
|
||||||
|
run: |
|
||||||
|
ERRORS=$(find */*/*/config -type f \
|
||||||
|
| grep -v -P '[^/]+/[^/]+/[^/]+/config/[0-9a-z_./]+$' \
|
||||||
|
| xargs -n1 -I{} echo "::error file={}::Underscore notation is required for file and directory names under config/" || true)
|
||||||
|
|
||||||
|
if [[ "" != "$ERRORS" ]]; then echo -e "$ERRORS\n"; exit 1; fi
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Yaml nulls should not be "~"
|
||||||
|
if: "always() && steps.checkout.outcome == 'success'"
|
||||||
|
run: |
|
||||||
|
ERRORS=$(find * -name '*.yaml' -or -name '*.yml' \
|
||||||
|
| xargs -n1 grep -F -H -n ': ~'\
|
||||||
|
| cut -d: -f1-2 \
|
||||||
|
| sed 's/\(.*\):\([0-9]*\)$/\\n::error file=\1,line=\2::"~" should be replaced with "null"/' || true)
|
||||||
|
|
||||||
|
if [[ "" != "$ERRORS" ]]; then echo -e "$ERRORS\n"; exit 1; fi
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Symfony commands should not be wrapped in a Makefile
|
||||||
|
if: "always() && steps.checkout.outcome == 'success'"
|
||||||
|
run: |
|
||||||
|
ERRORS=$(find * -name Makefile \
|
||||||
|
| xargs -n1 grep -P -H -n 'bin/console|\$\(CONSOLE\)' \
|
||||||
|
| cut -d: -f1-2 \
|
||||||
|
| sed 's/\(.*\):\([0-9]*\)$/\\n::error file=\1,line=\2::Symfony commands should not be wrapped in a Makefile/' || true)
|
||||||
|
|
||||||
|
if [[ "" != "$ERRORS" ]]; then echo -e "$ERRORS\n"; exit 1; fi
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# See https://symfony.com/doc/current/email/dev_environment.html
|
# See https://symfony.com/doc/current/email/dev_environment.html
|
||||||
swiftmailer:
|
#swiftmailer:
|
||||||
# send all emails to a specific address
|
# send all emails to a specific address
|
||||||
#delivery_addresses: ['me@example.com']
|
# delivery_addresses: ['me@example.com']
|
||||||
|
|||||||
Reference in New Issue
Block a user