Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

[travis] added strings check #751

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ matrix:
# Run behat first as it takes the most time (don't need to specify php version here as we don't really care about version on host)
- php: 5.6
env: BEFORE="./bin/travis/prepare_behat.sh" TEST_CMD="./bin/travis/runbehat.sh" AFTER_SUCCESS='echo "After success"' RUN_INSTALL=1 COMPOSE_FILE="doc/docker-compose/base-prod.yml:doc/docker-compose/selenium.yml" SYMFONY_ENV=behat SYMFONY_DEBUG=0
- php: 5.6
env: BEFORE="./bin/travis/prepare_behat.sh" TEST_CMD="./bin/travis/runcheckstrings.sh" AFTER_SUCCESS='echo "After success"' RUN_INSTALL=1 COMPOSE_FILE="$HOME/build/ezplatform/doc/docker-compose/base-dev.yml" SYMFONY_ENV=dev SYMFONY_DEBUG=1
- env: BEFORE="./bin/travis/setupnode.sh" TEST_CMD="./bin/travis/runnode.sh" AFTER_SUCCESS="./bin/travis/generate_apidoc.sh"
- php: 7.0
env: BEFORE="./bin/travis/setupphpunit.sh" TEST_CMD="./vendor/bin/phpunit -c phpunit.xml" AFTER_SUCCESS='echo "After success"'
Expand Down
29 changes: 29 additions & 0 deletions bin/travis/checkstrings.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env sh

OUTPUT=$(./bin/updatestrings.sh --dry-run)

echo "> Output from updatestrings.sh"
echo $OUTPUT

echo "> Strings check result"

ADDED_MESSAGES=$(echo "$OUTPUT" | awk '/Added Messages/ { print $3 }')
DELETED_MESSAGES=$(echo "$OUTPUT" | awk '/Deleted Messages/ { print $3 }')

RETURN=0

if test "$ADDED_MESSAGES" != "0"; then
echo "$ADDED_MESSAGES strings are added";
RETURN=1
fi

if test "$DELETED_MESSAGES" != "0"; then
echo "$DELETED_MESSAGES strings are deleted";
RETURN=1
fi

if test "$RETURN" != 0; then
echo "Failure: strings need to be regenerated"
fi

exit $RETURN;
9 changes: 9 additions & 0 deletions bin/travis/runcheckstrings.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env sh

set -x

cd "$HOME/build/ezplatform"
ls -l
$(docker-compose exec --user www-data app sh -c "cd vendor/ezsystems/platform-ui-bundle; ./bin/travis/checkstrings.sh")

exit $?
6 changes: 6 additions & 0 deletions bin/updatestrings.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env sh
../../../app/console translation:extract en -v \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe change to run from project root as they seems to depend on that anyway? (and check if in root while at it, this is placed in public folder, aka no .<folder> like .travis, so should probably do some sanity checks before running)

--dir=. \
--exclude-dir=vendor --exclude-dir=Tests --exclude-dir=Features --exclude-dir=node_modules --exclude-dir=Resources/public/vendors \
--output-dir=./Resources/translations \
"$@"