From 0151361cc9b5ae5bf43f90fabef23fac0e1d2bfe Mon Sep 17 00:00:00 2001
From: Luc Didry <luc@didry.org>
Date: Thu, 5 Apr 2018 10:46:55 +0200
Subject: [PATCH] [i18n] Add check-trad job + pull locales when deploying to
 beta

---
 .gitlab-ci.yml | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 392ebb78..a099e3cb 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -17,6 +17,18 @@ test:
     paths:
       - vendor/
 
+check-trad:
+  stage: test
+  allow_failure: true
+  script:
+    - if [ -z ${ZANATA_CONFIG_FRAMABOT+x} ]; then echo "*** Unable to check if translations need to be pulled, exiting ***"; exit 1; fi
+    - export ORIG=$(git diff-files --shortstat)
+    - if [ ! -z ${ZANATA_CONFIG_FRAMABOT+x} ]; then mkdir -p ${HOME}/.config; echo -e "${ZANATA_CONFIG_FRAMABOT}" > ${HOME}/.config/zanata.ini; fi
+    - if [ ! -z ${ZANATA_CONFIG_FRAMABOT+x} ]; then make push-locales; fi
+    - git status > /dev/null 2>&1
+    - export CHANGES=$(git diff-files --shortstat)
+    - if [[ $CHANGES != $ORIG ]]; then echo "*** There is changes in locales ***"; echo "*** You need to do `make pull-locales` in your repo ***"; exit 1; fi
+
 # Create artifacts on master
 pages:
   stage: deploy
@@ -45,6 +57,8 @@ beta:
   - git checkout develop
   - composer install -o  --no-interaction --no-progress --prefer-dist --no-dev
   - composer dump-autoload --optimize --no-dev --classmap-authoritative
+  - if [ ! -z ${ZANATA_CONFIG_FRAMABOT+x} ]; then mkdir -p ${HOME}/.config; echo -e "${ZANATA_CONFIG_FRAMABOT}" > ${HOME}/.config/zanata.ini; fi
+  - if [ ! -z ${ZANATA_CONFIG_FRAMABOT+x} ]; then make pull-locales; fi
   - mkdir tpl_c
   - mkdir .public
   - cp -r * .public
-- 
GitLab