From 91b8a231634da9d86b9037cbd4d388393377b322 Mon Sep 17 00:00:00 2001 From: Andrew Berry Date: Thu, 5 Oct 2023 13:58:42 -0400 Subject: [PATCH] Convert variables to support defaults with override #267 (#268) --- .github/workflows/TestStatic.yml | 8 ++++++++ drainpipe-dev/composer.json | 1 - tasks/test.yml | 10 ++++------ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/TestStatic.yml b/.github/workflows/TestStatic.yml index 4a9322f64..6c11e684f 100644 --- a/.github/workflows/TestStatic.yml +++ b/.github/workflows/TestStatic.yml @@ -61,6 +61,14 @@ jobs: - name: Run Static Tests run: ddev task test:static + - name: Confirm custom directories are scanned + run: | + set -x + mkdir -p custom-yaml-directory + echo 'key: value' >> custom-yaml-directory/test.yml + ddev task test:static YAML_DIRS="custom-yaml-directory/*.yml" | tee static.log + [[ $(grep '\[OK] All 1 YAML files contain valid syntax.' static.log | wc -l) -eq 1 ]] + - name: Upload test artifacts if: ${{ always() }} uses: actions/upload-artifact@v3 diff --git a/drainpipe-dev/composer.json b/drainpipe-dev/composer.json index f1b27360e..93b6acd9b 100644 --- a/drainpipe-dev/composer.json +++ b/drainpipe-dev/composer.json @@ -14,7 +14,6 @@ "ext-json": "*", "composer-plugin-api": "^2.0", "phpunit/phpunit": "^8|^9", - "j13k/yaml-lint": "^1.1", "sserbin/twig-linter": "^3.0", "mikey179/vfsstream": "^1.6", "mockery/mockery": "^1.4", diff --git a/tasks/test.yml b/tasks/test.yml index 42aa1fb88..0af71f883 100644 --- a/tasks/test.yml +++ b/tasks/test.yml @@ -1,15 +1,13 @@ version: '3' -# @todo allow these to be overridden or document them as required folder -# structures. See also config/phpstan.neon vars: - YAML_DIRS: 'web/**/*.yml' - TWIG_DIRS: 'web/modules web/profiles web/themes' + YAML_DIRS: '{{ default "web/**/*.yml" .YAML_DIRS }}' + TWIG_DIRS: '{{ default "web/modules web/profiles web/themes" .TWIG_DIRS }}' # These directories are configured in phpcs.xml. However, phpcs will fail if # those directories do not exist, so we create them with the assumption that # every Drupal site will eventually have these directories. - TEST_DIRS: 'web/modules/custom web/themes/custom web/sites' - NIGHTWATCH_TEST_DIRS: 'test' + TEST_DIRS: '{{ default "web/modules/custom web/themes/custom web/sites" .TEST_DIRS }}' + NIGHTWATCH_TEST_DIRS: '{{ default "test" .NIGHTWATCH_TEST_DIRS }}' FUNC_ENSURE_DIRS: | DIRS_ARR=({{.TEST_DIRS}}) for DIR in "${DIRS_ARR[@]}"; do