diff --git a/.github/workflows/TestFunctional.yml b/.github/workflows/TestFunctional.yml index 58170d6e..0d51facb 100644 --- a/.github/workflows/TestFunctional.yml +++ b/.github/workflows/TestFunctional.yml @@ -52,6 +52,20 @@ jobs: ddev composer config minimum-stability dev ddev composer require "lullabot/drainpipe @dev" --with-all-dependencies ddev composer require "lullabot/drainpipe-dev @dev" --dev --with-all-dependencies + git config --global user.email "no-reply@example.com" + git config --global user.name "Drainpipe Bot" + git init + echo "/drainpipe" >> .gitignore + echo "/drainpipe-dev" >> .gitignore + echo ".ddev/config.yaml" >> .gitignore + echo ".ddev/docker-compose.selenium.yaml" >> .gitignore + echo ".yarnrc.yml" >> .gitignore + echo "package.json" >> .gitignore + echo "yarn.lock" >> .gitignore + echo "package-lock.json" >> .gitignore + echo "README.md" >> .gitignore + git add . + git commit -m "Initial commit" - name: Setup Nightwatch run: | diff --git a/.github/workflows/TestStatic.yml b/.github/workflows/TestStatic.yml index 9c10fa1f..9f0651d3 100644 --- a/.github/workflows/TestStatic.yml +++ b/.github/workflows/TestStatic.yml @@ -58,10 +58,34 @@ jobs: test -f phpcs.xml.dist test -f phpstan.neon.dist + - name: Create a git repository + run: | + git config --global user.email "no-reply@example.com" + git config --global user.name "Drainpipe Bot" + git init + echo "/drainpipe" >> .gitignore + echo "/drainpipe-dev" >> .gitignore + git add . + git commit -m "Initial commit" + - name: Fix settings.php run: | sed -i '/^.*container_yamls.*$/i /** @phpstan-ignore-next-line */' web/sites/default/settings.php + - name: Test for untracked and modified files + id: test_untracked + continue-on-error: true + run: ddev task test:untracked + + - name: Test for untracked and modified files + run: | + if [ "${{ steps.test_untracked.outcome }}" != "failure" ]; then + exit 1 + fi + git add . + git commit -m "Second commit" + ddev task test:untracked + - name: Run Static Tests run: ddev task test:static diff --git a/scaffold/gitignore/common.gitignore b/scaffold/gitignore/common.gitignore index ac8e47d4..c52dcbca 100644 --- a/scaffold/gitignore/common.gitignore +++ b/scaffold/gitignore/common.gitignore @@ -59,6 +59,7 @@ node_modules ######### test_result .prettiercache +.twig-cs-fixer.cache vrt-report test/nightwatch/vrt/latest test/nightwatch/vrt/diff diff --git a/tasks/test.yml b/tasks/test.yml index 84848c50..d5277286 100644 --- a/tasks/test.yml +++ b/tasks/test.yml @@ -18,9 +18,13 @@ tasks: static: desc: Runs all static tests deps: [lint, phpstan, phpunit:static, phpcs] + cmds: + - task: untracked functional: desc: Runs all tests that require a bootstrapped Drupal site deps: [config, phpunit:functional, nightwatch] + cmds: + - task: untracked security: desc: Runs security checks for composer packages and Drupal contrib cmds: @@ -178,6 +182,15 @@ tasks: for DIR in "${DIRS_ARR[@]}"; do ./vendor/bin/twig-cs-fixer lint --fix $DIR done + untracked: + desc: Checks for any untracked files in git + cmds: + - | + if [ "$(git status -s --ignore-submodules=dirty)" != "" ]; then + git status -s --ignore-submodules=dirty + echo "Untracked changes detected - please rectify or add the files to your .gitignore" + exit 1 + fi nightwatch:check: #desc: Verifies Nightwatch is setup correctly cmds: