[tor-commits] [community/master] cache is per job. also: separate test for different situations

emmapeel at torproject.org emmapeel at torproject.org
Mon Sep 13 16:54:49 UTC 2021


commit eb777acae11247d8695fba8308eade237f77108d
Author: emma peel <emma.peel at riseup.net>
Date:   Mon Sep 13 18:53:36 2021 +0200

    cache is per job. also: separate test for different situations
---
 .gitlab-ci.yml | 96 +++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 81 insertions(+), 15 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index bd05699..e753821 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,11 +1,5 @@
 image: debian:buster-slim
 
-cache:
-  key: $CI_PROJECT_PATH_SLUG.${CI_COMMIT_REF_SLUG}
-  paths:
-    - packages
-    - lego
-    - apt-cache
 
 # This template should be usable on any system that's based on apt.
 # taken from tor gitlabci
@@ -27,26 +21,98 @@ cache:
       apt-get upgrade -qy
 
 variables:
-    GIT_SUBMODULE_STRATEGY: recursive
+  GIT_SUBMODULE_STRATEGY: recursive
+  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
+  TRANSLATION_BRANCH: "communitytpo-contentspot"
+
+
+stages:
+    - build
+    - test_l10n
 
 pages:
+  cache:
+    key: $CI_PROJECT_PATH_SLUG.${CI_COMMIT_REF_SLUG}
+    paths:
+      - packages
+      - lego
+      - apt-cache
+      - venv
+      - .cache/pip
+      - .cache/lektor/builds/
+  stage: build
   script:
     - *apt-template
-    - DEBIAN_FRONTEND=noninteractive apt-get install gettext python3-babel python3-pip git python3-inifile python3-dev python3-setuptools python3-openssl python3-cryptography i18nspector -y
+    - DEBIAN_FRONTEND=noninteractive apt-get install gettext python3-babel python3-pip git python3-inifile python3-dev python3-setuptools python3-openssl python3-cryptography i18nspector apt-utils ca-certificates -y
+    - pip3 install virtualenv
+    - virtualenv venv
+    - source venv/bin/activate
     - pip3 install lektor
     - echo 'checking out translations'
     - rm -rf i18n
-    - git clone --branch communitytpo-contentspot https://git.torproject.org/translation.git i18n
-    - echo 'reinstalling plugins to have last version'
+    - git clone --branch $TRANSLATION_BRANCH https://git.torproject.org/translation.git i18n
+    - echo 'reinstall lektor plugins'
+    - lektor project-info --output-path
     - lektor plugins reinstall
-    - echo 'building lektor 3 times to get translations in place'
+    - echo 'building lektor 3 more times to get translations in place'
     - lektor build --output-path public && lektor build --output-path public && lektor build --output-path public
-    - echo 'lets see if there are any updates in the strings for translation'
+  artifacts:
+    paths:
+      - public
+      - i18n
+  rules:
+    - when: always
+
+check_new_strings:
+  cache:
+    key: $CI_PROJECT_PATH_SLUG.${CI_COMMIT_REF_SLUG}
+    paths:
+      - packages
+      - lego
+      - apt-cache
+      - venv
+      - .cache/pip
+
+  stage: test_l10n
+  needs: [pages]
+  allow_failure: true
+  rules:
+    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
+    - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
+    - if: '$CI_COMMIT_BRANCH == "translations"'
+      when: never
+    - changes:
+      - content/**/*.lr
+      - templates/**/*
+  script:
+    - *apt-template
+    - DEBIAN_FRONTEND=noninteractive apt-get install gettext git python3-dev python3-setuptools i18nspector python3-polib python3-requests ca-certificates apt-utils -y
     - git clone https://gitlab.torproject.org/tpo/community/l10n.git
-    - pip3 install polib
-    - l10n/bin/check_po_status.py communitytpo-contentspot
-    - l10n/bin/check_markdown_links.py i18n/
+    - echo 'lets see if there are any updates in the strings for translation'
+    - l10n/bin/check_po_status.py $TRANSLATION_BRANCH
   artifacts:
     paths:
       - public
       - i18n
+      - l10n
+
+check_l10n:
+  allow_failure: true
+  cache:
+    key: $CI_PROJECT_PATH_SLUG.${CI_COMMIT_REF_SLUG}
+    paths:
+      - packages
+      - lego
+      - apt-cache
+      - venv
+      - i18n
+      - .cache/pip
+  stage: test_l10n
+  needs: [pages]
+  only:
+    - translations
+  script:
+    - DEBIAN_FRONTEND=noninteractive apt-get install gettext i18nspector python3-polib ca-certificates -y
+    - echo 'lets see if there are any broken links on the translations'
+    - l10n/bin/check_markdown_links.py i18n/
+



More information about the tor-commits mailing list