This repository has been archived by the owner on Oct 24, 2019. It is now read-only.
forked from adblockplus/adblockpluschrome
/
.gitlab-ci.yml
203 lines (181 loc) · 5.06 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# This file is part of Adblock Plus <https://adblockplus.org/>,
# Copyright (C) 2006-present eyeo GmbH
#
# Adblock Plus is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# Adblock Plus is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
#
# This file specifies how GitLab should run the tests, linting and other checks
# automatically when merge requests are opened. By default, this will all run
# on GitLab provided "shared runners", without further work. However, the tests
# will run more quickly on a "specific runner" if you'd like to set that up.
#
# If you'd like to provision your own specific runners for your fork of the
# repository, you can use these Ansible roles:
#
# https://gitlab.com/eyeo/devops/ansible-role-adblockplus-builder
# https://gitlab.com/eyeo/devops/ansible-role-gitlab-runner
stages:
- prepare
- build
- test
- download
- scp
.dependencies:
script: &dependencies
# Since we already use the "before_script" in order to setup dependencies
# we must also install other dependencies here, which would have already
# been available on the specific runners. Unfortunately, YAML doesn't
# support proper mutli-inheritance, so we need to fallback to the following
# inline shell script.
- "[ -z $BROWSER_SNAPSHOT_DIR ] || mkdir -p $BROWSER_SNAPSHOT_DIR"
- |
if [[ "$CI_RUNNER_DESCRIPTION" == *gitlab.com ]]; then
apt-get update;
apt-get install -y apt-transport-https python-pip libgtk-3-0 libxt6 \
xvfb libnss3 libxss1 libgconf-2-4 libasound2 nodejs npm;
fi
- mkdir -p .git/info
- pip install --user Jinja2 cryptography fonttools brotli
# This pipeline runs on a custom runner as an unpriviliged user.
# Therefore the pyftsubset executable of the fonttools dependency above is
# installed to `~/.local/bin` and needs to be added to the $PATH variable
# in order to be available.
- export PATH=$PATH:~/.local/bin
- "npm_config_unsafe_perm=true python ensure_dependencies.py"
- "[ -d node_modules ] || npm install"
.pull_cache:
cache:
key: cache_$CI_COMMIT_SHA
paths:
- ./
policy: pull
.test_template:
extends: .pull_cache
stage: test
before_script: *dependencies
variables:
BROWSER_SNAPSHOT_DIR: "/tmp/browser-snapshots/"
retry:
max: 2
when: stuck_or_timeout_failure
except:
- schedules
.test_screenshots_template:
extends: .test_template
artifacts:
paths:
- test/screenshots/
when: on_failure
expire_in: 1 mo
.build:
extends: .pull_cache
before_script: *dependencies
stage: build
only:
- master
except:
- schedules
script:
- python build.py build -t $PLATFORM
artifacts:
paths:
- adblockplusfirefox-*.xpi
- adblockpluschrome-*.zip
- adblockplusedge-*.appx
lint:
extends: .test_template
script:
- npm run lint
build:chrome:
extends: .build
variables:
PLATFORM: chrome
build:gecko:
extends: .build
variables:
PLATFORM: gecko
build:edge:
extends: .build
variables:
PLATFORM: edge
prepare-dependencies:
stage: prepare
script: *dependencies
cache:
key: cache_$CI_COMMIT_SHA
paths:
- ./
policy: push
except:
- schedules
docs:
extends: .test_template
script:
- npm run docs
artifacts:
paths:
- docs/
expire_in: 3 mos
test:firefox:oldest:
extends: .test_screenshots_template
script:
- npm run test-only -- -g 'Firefox \(oldest\)'
test:firefox:latest:
extends: .test_screenshots_template
script:
- npm run test-only -- -g 'Firefox \(latest\)'
test:chromium:oldest:
extends: .test_screenshots_template
script:
- xvfb-run -a npm run test-only -- -g 'Chromium \(oldest\)'
test:chromium:latest:
extends: .test_screenshots_template
script:
- xvfb-run -a npm run test-only -- -g 'Chromium \(latest\)'
.download:
stage: download
script:
- npm install
- npm run archive -- $EXTENSION_ID
artifacts:
paths:
- adblockpluschrome-*.crx
only:
- schedules
download:release:
extends: .download
variables:
EXTENSION_ID: "cfhdojbkjhnklbpkdaibdccddilifddb"
download:devbuild:
extends: .download
variables:
EXTENSION_ID: "ldcecbkkoecffmfljeihcmifjjdoepkn"
.scp:
stage: scp
only:
- schedules
tags:
- protected
script:
- "scp *.crx $DESTINATION"
scp:release:
extends: .scp
dependencies:
- download:release
variables:
DESTINATION: "builds_user@eyeofiles.com:/var/adblockplus/fileserver/builds/releases/"
scp:devbuild:
extends: .scp
dependencies:
- download:devbuild
variables:
DESTINATION: "builds_user@eyeofiles.com:/var/adblockplus/fileserver/builds/devbuilds/adblockpluschrome/"