Kaynağa Gözat

ci: Use a UTF-8 locale on Linux and macOS jobs

Brad King 1 hafta önce
ebeveyn
işleme
5f9bcdceb8
1 değiştirilmiş dosya ile 11 ekleme ve 0 silme
  1. 11 0
      .gitlab/ci/env.sh

+ 11 - 0
.gitlab/ci/env.sh

@@ -19,10 +19,21 @@ if test -n "$CMAKE_CI_IN_SYMLINK_TREE"; then
   test "$(git -C "$CI_PROJECT_DIR/work/cmake" rev-parse HEAD)" = "$(git -C "$CI_PROJECT_DIR" rev-parse HEAD)"
 fi
 
+# Default to a UTF-8 locale.  The per-job environment may override it.
+locales="$(locale -a 2>/dev/null)"
+if echo "$locales" | grep -qE '^C\.(UTF-8|utf8)$'; then
+  export LANG=C.UTF-8
+elif echo "$locales" | grep -qE '^en_US\.(UTF-8|utf8)$'; then
+  export LANG=en_US.UTF-8
+fi
+
 if test -r ".gitlab/ci/env_${CMAKE_CONFIGURATION}.sh"; then
   source ".gitlab/ci/env_${CMAKE_CONFIGURATION}.sh"
 fi
 
+# Report the selected locale.
+echo "locale: $(locale | grep '^LANG=') with $(locale -k charmap)"
+
 case "$(uname -s)-$(uname -m)" in
     Linux-*)
         # Remove superuser tools from PATH.