forked from torproject/support
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
142 lines (131 loc) · 4.18 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
image: debian:buster-slim
# This template should be usable on any system that's based on apt.
# taken from tor gitlabci
.apt-template: &apt-template |
export LC_ALL=C.UTF-8
echo Etc/UTC > /etc/timezone
mkdir -p apt-cache
export APT_CACHE_DIR="$(pwd)/apt-cache"
echo 'quiet "1";' \
'APT::Install-Recommends "0";' \
'APT::Install-Suggests "0";' \
'APT::Acquire::Retries "20";' \
'APT::Get::Assume-Yes "true";' \
'Dpkg::Use-Pty "0";' \
"Dir::Cache::Archives \"${APT_CACHE_DIR}\"; " \
>> /etc/apt/apt.conf.d/99gitlab
DEBIAN_FRONTEND=noninteractive apt-get update -qq
DEBIAN_FRONTEND=noninteractive apt-get upgrade -qy
DEBIAN_FRONTEND=noninteractive apt-get install git apt-utils ca-certificates -y
variables:
GIT_SUBMODULE_STRATEGY: recursive
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
workflow:
rules:
- if: $CI_PROJECT_NAME == "support"
variables:
TRANSLATION_BRANCH: "support-portal"
- if: $CI_PROJECT_NAME == "manual"
variables:
TRANSLATION_BRANCH: "tbmanual-contentspot"
- if: $CI_PROJECT_NAME == "community"
variables:
TRANSLATION_BRANCH: "communitytpo-contentspot"
- if: $CI_PROJECT_NAME == "tpo"
variables:
TRANSLATION_BRANCH: "tpo-web"
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 python3-inifile python3-dev python3-setuptools python3-openssl python3-cryptography -y
- pip3 install virtualenv
- virtualenv venv
- source venv/bin/activate
- pip3 install lektor
- echo 'checking out translations'
- rm -rf i18n
- git clone --branch $TRANSLATION_BRANCH --depth=1 https://git.torproject.org/translation.git i18n
- echo 'reinstall lektor plugins'
- lektor plugins reinstall
- 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
artifacts:
paths:
- public
- i18n
rules:
- if: $TRANSLATION_BRANCH
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS'
when: never
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_BRANCH == $CI_DEFAULT_BRANCH
- if: '$CI_COMMIT_BRANCH == "translations"'
- if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS'
when: never
script:
- *apt-template
- DEBIAN_FRONTEND=noninteractive apt-get install gettext python3-dev python3-setuptools i18nspector python3-polib python3-requests -y
- git clone --depth=1 https://gitlab.torproject.org/tpo/community/l10n.git
- echo 'lets see if there are any UPDATES ON THE STRINGS for translation after this changes'
- l10n/bin/check_po_status.py $TRANSLATION_BRANCH
artifacts:
paths:
- public
- i18n
l10n_QA:
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: [new_strings]
script:
- *apt-template
- DEBIAN_FRONTEND=noninteractive apt-get install gettext python3-polib -y
- echo '==START Translations QA=='
- rm -rf l10n
- git clone --depth=1 https://gitlab.torproject.org/tpo/community/l10n.git
- echo 'lets see if there are any problems with the translations'
- l10n/bin/check_common_errors.py i18n/
- echo 'Enabled translations and their completion'
- l10n/bin/check_completion.py
build_tests_page:
stage: test_l10n
allow_failure: true
trigger: tpo/community/l10n
rules:
- changes:
- i18n/contents.pot