Verified Commit c15a55c8 authored by Beatriz Rizental's avatar Beatriz Rizental Committed by ma1
Browse files

Add CI for Tor Browser

parent cd1d0183
Loading
Loading
Loading
Loading

.gitlab-ci.yml

0 → 100644
+5 −0
Original line number Diff line number Diff line
stages:
  - update-translations

include:
  - local: '.gitlab/ci/update-translations.yml'
+66 −0
Original line number Diff line number Diff line
.update-translation-base:
  stage: update-translations
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
      changes:
        - "**/*.ftl"
        - "**/*.properties"
        - "**/*.dtd"
    - if: $FORCE_UPDATE_TRANSLATIONS == "true"
  variables:
    TOR_BROWSER_COMBINED_FILES_JSON: "combined-translation-files.json"


combine-en-US-translations:
  extends: .update-translation-base
  image: python
  variables:
    PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
    TRANSLATION_FILES: '
      tor-browser:tor-browser.ftl
      tor-browser:aboutDialog.dtd
      tor-browser:aboutTBUpdate.dtd
      tor-browser:aboutTor.dtd
      tor-browser:torbutton.dtd
      tor-browser:browserOnboarding.properties
      tor-browser:cryptoSafetyPrompt.properties
      tor-browser:onboarding.properties
      tor-browser:onionLocation.properties
      tor-browser:rulesets.properties
      tor-browser:settings.properties
      tor-browser:torbutton.properties
      tor-browser:torConnect.properties
      tor-browser:torlauncher.properties
      base-browser:base-browser.ftl
      base-browser:newIdentity.properties
      base-browser:securityLevel.properties
    '
  cache:
    paths:
      - .cache/pip
  # Artifact is for translation project job
  artifacts:
    paths:
      - "$TOR_BROWSER_COMBINED_FILES_JSON"
    expire_in: "60 min"
    reports:
      dotenv: job_id.env
  # Don't load artifacts for this job.
  dependencies: []
  script:
    # Save this CI_JOB_ID to the dotenv file to be used in the variables for the
    # push-en-US-translations job.
    - echo 'COMBINE_TRANSLATIONS_JOB_ID='"$CI_JOB_ID" >job_id.env
    - pip install compare_locales
    - python ./tools/torbrowser/l10n/combine-translation-versions.py "$CI_COMMIT_BRANCH" "$TRANSLATION_FILES" "$TOR_BROWSER_COMBINED_FILES_JSON"

push-en-US-translations:
  extends: .update-translation-base
  needs:
    - job: combine-en-US-translations
  variables:
    TOR_BROWSER_COMBINED_FILES_JSON_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/${COMBINE_TRANSLATIONS_JOB_ID}/artifacts/${TOR_BROWSER_COMBINED_FILES_JSON}"
  trigger:
    strategy: depend
    project: tor-browser-translation-bot/translation
    branch: tor-browser-ci