Move checks to GHA

This commit is contained in:
Nicolas Grekas
2021-07-09 10:19:36 +02:00
parent bdd0dbc050
commit 3df62e0816
64 changed files with 271 additions and 167 deletions

View File

@@ -18,3 +18,156 @@ jobs:
name: Checkout
uses: actions/checkout@v2
id: checkout
-
name: Install tools
run: |
cd .github
wget -q -O recipes-checker.zip https://codeload.github.com/symfony-tools/recipes-checker/zip/refs/heads/main
unzip recipes-checker.zip
cd recipes-checker-main
composer install --no-dev
-
name: Check manifest.json files
if: "always() && steps.checkout.outcome == 'success'"
run: |
.github/recipes-checker-main/run lint:manifests --contrib
-
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' -not -wholename 'codeception/codeception/*/tests/*' -not -wholename 'codeception/codeception/*/codeception.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

View File

@@ -2,7 +2,7 @@
"bundles": {
"ArtoxLab\\Bundle\\ClarcMessageBusBundle\\ArtoxLabClarcMessageBusBundle": ["all"]
},
"copy-from-recipe": {
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/"
}
}

View File

@@ -2,7 +2,7 @@
"bundles": {
"ArtoxLab\\Bundle\\SmsBundle\\ArtoxLabSmsBundle": ["all"]
},
"copy-from-recipe": {
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/"
}
}

View File

@@ -1,14 +1,6 @@
{
"copy-from-recipe": {
"codeception.yaml": "codeception.yml",
"tests/_data/": "tests/_data/",
"tests/_output/": "tests/_output/",
"tests/_support/": "tests/_support",
"tests/acceptance/": "tests/acceptance/",
"tests/functional/": "tests/functional/",
"tests/unit/": "tests/unit/",
"tests/acceptance.suite.yaml": "tests/acceptance.suite.yml",
"tests/functional.suite.yaml": "tests/functional.suite.yml",
"tests/unit.suite.yaml": "tests/unit.suite.yml"
"codeception.yml": "codeception.yml",
"tests/": "tests/"
}
}

View File

@@ -1 +1 @@
import './styles/base.scss';
import './styles/base.scss';

View File

@@ -1 +0,0 @@
../0.2/manifest.json

View File

@@ -0,0 +1,8 @@
{
"bundles": {
"Exercise\\HTMLPurifierBundle\\ExerciseHTMLPurifierBundle": ["all"]
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/"
}
}

View File

@@ -10,7 +10,7 @@ mongo_db_bundle:
ssl: false
connectTimeoutMS: 3000
readPreference: primaryPreferred # see https://docs.mongodb.com/manual/reference/read-preference/#primary for info
connections:
default:
client_name: default

View File

@@ -1,5 +1,5 @@
# Read the documentation: https://symfony.com/doc/master/bundles/FOSRestBundle/index.html
fos_rest: null
#fos_rest:
# param_fetcher_listener: true
# allowed_methods_listener: true
# routing_loader: true

View File

@@ -1,10 +1,10 @@
{
"bundles": {
"bundles": {
"Karser\\Recaptcha3Bundle\\KarserRecaptcha3Bundle": ["all"]
},
"copy-from-recipe": {
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/"
},
},
"env": {
"#1": "Get your API key and secret from https://g.co/recaptcha/v3",
"RECAPTCHA3_KEY": "my_site_key",

View File

@@ -1,8 +1,8 @@
{
"bundles": {
"KnpU\\OAuth2ClientBundle\\KnpUOAuth2ClientBundle": ["all"]
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/"
}
"bundles": {
"KnpU\\OAuth2ClientBundle\\KnpUOAuth2ClientBundle": ["all"]
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/"
}
}

View File

@@ -1 +0,0 @@
../../../5.2/config/routes/kunstmaan_node.yaml

View File

@@ -0,0 +1,6 @@
KunstmaanNodeBundle:
resource: "@KunstmaanNodeBundle/Resources/config/routing.yml"
# If your site is not multi language, remove the "{_locale}/" part of the prefix and the requirements
prefix: /{_locale}/
requirements:
_locale: "%kunstmaan_admin.required_locales%"

View File

@@ -1 +0,0 @@
../5.2/manifest.json

View File

@@ -0,0 +1,8 @@
{
"bundles": {
"Kunstmaan\\NodeBundle\\KunstmaanNodeBundle": ["all"]
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/"
}
}

View File

@@ -4,6 +4,6 @@
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/",
"var/storage/": "%VAR_DIR%/storage/"
"var/": "%VAR_DIR%/"
}
}

View File

@@ -1,9 +1,9 @@
{
"bundles": {
"WebLoader\\WebLoaderBundle\\WebLoaderBundle": ["all"]
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/",
"public/": "%PUBLIC_DIR%/"
}
"bundles": {
"WebLoader\\WebLoaderBundle\\WebLoaderBundle": ["all"]
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/",
"public/": "%PUBLIC_DIR%/"
}
}

View File

@@ -1,12 +0,0 @@
nameisis_cache:
enabled: false
services:
Nameisis\Cache\EventListener\CacheListener:
arguments:
- '@annotation_reader'
- '@service_container'
- null
- null
tags:
- name: kernel.event_subscriber

View File

@@ -1,8 +0,0 @@
{
"bundles": {
"Nameisis\\Cache\\NameisisCache": ["all"]
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/"
}
}

View File

@@ -1,8 +0,0 @@
{
"bundles": {
"Bab\\Datagen\\Bridge\\Symfony\\Bundle\\DatagenBundle": ["dev", "test"]
},
"copy-from-recipe": {
"src/": "%SRC_DIR%/"
}
}

View File

@@ -3,6 +3,6 @@
"Payum\\Bundle\\PayumBundle\\PayumBundle": ["all"]
},
"copy-from-recipe": {
"config/payum.yaml": "%CONFIG_DIR%/packages/payum.yaml"
"config/": "%CONFIG_DIR%/"
}
}

View File

@@ -1,32 +0,0 @@
default:
autoload:
'': '%paths.base%/tests/Behat/features'
suites:
default:
paths:
features: 'tests/Behat/features'
contexts:
- RestContextFr\RestContextFr
- Behat\MinkExtension\Context\MinkContext
- behatch:context:browser
- behatch:context:debug
- behatch:context:system
- behatch:context:json
- behatch:context:table
- behatch:context:rest
- behatch:context:xml
extensions:
Behat\Symfony2Extension:
kernel:
env: test
debug: true
bootstrap: config/bootstrap.php
path: src/Kernel.php
class: App\Kernel
Behat\MinkExtension:
base_url: "http://localhost/api"
sessions:
default:
symfony2: ~
Behatch\Extension: ~

View File

@@ -1,17 +0,0 @@
services:
_defaults:
autowire: true
autoconfigure: true
RestContextFr\RestContextFr:
public: true
arguments:
$request: '@behatch.http_call.request'
$httpCallResultPool: '@behatch.http_call.result_pool'
behatch.http_call.request:
class: Behatch\HttpCall\Request
arguments:
- '@behat.mink'
public: false
behatch.http_call.result_pool:
class: Behatch\HttpCall\HttpCallResultPool
public: false

View File

@@ -1,12 +0,0 @@
# This file contains a user story for demonstration only.
# Learn how to get started with Behat and BDD on Behat's website:
# http://behat.org/en/latest/quick_start.html
Feature:
In order to prove that the Behat Symfony extension is correctly installed
As a user
I want to have a demo scenario
Scenario: It receives a response from Symfony's kernel
When a demo scenario sends a request to "/"
Then the response should be received

View File

@@ -1,9 +0,0 @@
{
"copy-from-recipe": {
"behat.yml.dist": "behat.yml.dist",
"config/": "%CONFIG_DIR%/",
"features/": "features/",
"tests/": "tests/"
},
"gitignore": ["/behat.yml"]
}

View File

@@ -1,6 +0,0 @@
services:
ravenflux.twig.extension.env_in_twig:
class: RavenFlux\Twig\EnvInTwigExtension
tags:
-
name: twig.extension

View File

@@ -1,5 +0,0 @@
{
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/"
}
}

View File

@@ -3,6 +3,6 @@ services:
autowire: true
autoconfigure: true
public: false
rundum.event.entity.subscriber:
class: Rundum\EventSubscriber\EntityEventSubscriber

View File

@@ -1 +0,0 @@
../../../3.31/config/routes/sonata_admin.yaml

View File

@@ -0,0 +1,8 @@
admin_area:
resource: "@SonataAdminBundle/Resources/config/routing/sonata_admin.xml"
prefix: /admin
_sonata_admin:
resource: .
type: sonata_admin
prefix: /admin

View File

@@ -1 +0,0 @@
../3.31/manifest.json

View File

@@ -0,0 +1,9 @@
{
"bundles": {
"Sonata\\AdminBundle\\SonataAdminBundle": ["all"]
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/",
"src/": "%SRC_DIR%/"
}
}

View File

@@ -1 +0,0 @@
../../../3.31/src/Admin/.gitignore

View File

View File

@@ -1 +0,0 @@
../../../3.31/config/routes/sonata_admin.yaml

View File

@@ -0,0 +1,8 @@
admin_area:
resource: "@SonataAdminBundle/Resources/config/routing/sonata_admin.xml"
prefix: /admin
_sonata_admin:
resource: .
type: sonata_admin
prefix: /admin

View File

@@ -1 +0,0 @@
../3.31/manifest.json

View File

@@ -0,0 +1,9 @@
{
"bundles": {
"Sonata\\AdminBundle\\SonataAdminBundle": ["all"]
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/",
"src/": "%SRC_DIR%/"
}
}

View File

@@ -1 +0,0 @@
../../../3.31/src/Admin/.gitignore

View File

View File

@@ -1 +0,0 @@
../../../1.0/config/packages/sonata_form.yaml

View File

@@ -0,0 +1,2 @@
sonata_form:
form_type: standard

View File

@@ -1,5 +1,5 @@
# Read the documentation: https://github.com/suncat2000/MobileDetectBundle/blob/v1.0.5/Resources/doc/index.md
mobile_detect:
#mobile_detect:
# redirect:
# full:
# is_enabled: true

View File

@@ -1,5 +1,5 @@
{
"copy-from-recipe": {
"public/.htaccess": "%PUBLIC_DIR%/.htaccess"
"public/": "%PUBLIC_DIR%/"
}
}

View File

@@ -1,7 +1,3 @@
imports:
- { resource: dev/models/*.yaml }
- { resource: dev/predefined-cases/*.yaml }
tienvx_mbt:
email_from: '%env(EMAIL_FROM)%'
admin_url: '%env(ADMIN_URL)%'

View File

@@ -4,7 +4,7 @@
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/",
"var/storage/screenshots/": "%VAR_DIR%/storage/screenshots/"
"var/": "%VAR_DIR%/"
},
"env": {
"EMAIL_FROM": "from@example.com",

View File

@@ -4,7 +4,7 @@
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/",
"var/storage/screenshots/": "%VAR_DIR%/storage/screenshots/"
"var/": "%VAR_DIR%/"
},
"env": {
"SLACK_HOOK_URL": "https://hooks.slack.com/...",

View File

@@ -1 +0,0 @@
../2.0/config

View File

@@ -0,0 +1,13 @@
trikoder_oauth2:
authorization_server:
private_key: /var/oauth/private.key # Change this
private_key_passphrase: null # Passphrase of the private key, if any
encryption_key: '%env(string:OAUTH2_ENCRYPTION_KEY)%' # (Optional) Change this
resource_server:
public_key: /var/oauth/public.key # Change this
persistence:
doctrine: null

View File

@@ -0,0 +1,2 @@
oauth2:
resource: '@TrikoderOAuth2Bundle/Resources/config/routes.xml'

View File

@@ -1 +0,0 @@
../2.0/manifest.json

View File

@@ -0,0 +1,13 @@
{
"bundles": {
"Trikoder\\Bundle\\OAuth2Bundle\\TrikoderOAuth2Bundle": ["all"]
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/"
},
"env": {
"#1": "Fallback OAuth2 encryption key",
"#2": "Please override this with a secure value: https://oauth2.thephpleague.com/installation/#string-password",
"OAUTH2_ENCRYPTION_KEY": "%generate(secret)%"
}
}

View File

@@ -2,7 +2,7 @@
"bundles": {
"Yamilovs\\Bundle\\SmsBundle\\SmsBundle": ["all"]
},
"copy-from-recipe": {
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/"
}
}