forked from adblockplus/adblockpluschrome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
140 lines (125 loc) · 3.71 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
# 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
.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;
curl -sL https://deb.nodesource.com/setup_8.x | bash -;
apt-get update -y;
apt-get install -y nodejs;
fi
- mkdir -p .git/info
- pip install --user Jinja2 cryptography
- "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
.build:
extends: .pull_cache
before_script: *dependencies
stage: build
only:
- master
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
docs:
extends: .test_template
script:
- npm run docs
artifacts:
paths:
- docs/
test:firefox:oldest:
extends: .test_template
script:
- npm run test-only -- -g 'Firefox \(oldest\)'
test:firefox:latest:
extends: .test_template
script:
- npm run test-only -- -g 'Firefox \(latest\)'
test:chromium:oldest:
extends: .test_template
script:
- xvfb-run -a npm run test-only -- -g 'Chromium \(oldest\)'
test:chromium:latest:
extends: .test_template
script:
- xvfb-run -a npm run test-only -- -g 'Chromium \(latest\)'