Skip to content

Commit

Permalink
Issue #225: Add a test for untracked files (#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
justafish committed Aug 21, 2024
1 parent 51ccab4 commit b6df7bb
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/TestFunctional.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/TestStatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions scaffold/gitignore/common.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ node_modules
#########
test_result
.prettiercache
.twig-cs-fixer.cache
vrt-report
test/nightwatch/vrt/latest
test/nightwatch/vrt/diff
13 changes: 13 additions & 0 deletions tasks/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit b6df7bb

Please sign in to comment.