-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run master commits on Taskcluster #9226
Changes from all commits
056cb10
d282c19
5be6bb5
f3672de
aed9615
e7bae7a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
if [ $1 == "firefox" ]; then | ||
./wpt run firefox --log-tbpl=- --log-tbpl-level=debug --log-wptreport=../artifacts/wpt_report.json --this-chunk=$3 --total-chunks=$4 --test-type=$2 -y --install-browser --no-pause --no-restart-on-unexpected | ||
elif [ $1 == "chrome" ]; then | ||
./wpt run chrome --log-tbpl=- --log-tbpl-level=debug --log-wptreport=../artifacts/wpt_report.json --this-chunk=$3 --total-chunks=$4 --test-type=$2 -y --no-pause --no-restart-on-unexpected | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
import argparse | ||
import copy | ||
import os | ||
import six | ||
|
||
import yaml | ||
|
||
|
||
here = os.path.dirname(__file__) | ||
wpt_root = os.path.abspath(os.path.join(here, os.pardir, os.pardir)) | ||
|
||
|
||
task_template = { | ||
"provisionerId": "{{ taskcluster.docker.provisionerId }}", | ||
"workerType": "{{ taskcluster.docker.workerType }}", | ||
"extra": { | ||
"github": { | ||
"events": ["push"], | ||
"branches": ["master"], | ||
}, | ||
}, | ||
"payload": { | ||
"maxRunTime": 5400, | ||
"image": "harjgam/web-platform-tests:0.6", | ||
"command":[ | ||
"/bin/bash", | ||
"--login", | ||
"-c", | ||
""">- | ||
~/start.sh && | ||
cd /home/test/web-platform-tests && | ||
git fetch {{event.head.repo.url}} && | ||
git config advice.detachedHead false && | ||
git checkout {{event.head.sha}} && | ||
%(command)s"""], | ||
"artifacts": { | ||
"public/results": { | ||
"path": "/home/test/artifacts", | ||
"type": "directory" | ||
} | ||
} | ||
}, | ||
"metadata": { | ||
"name": "wpt-%(browser_name)s-%(suite)s-%(chunk)s", | ||
"description": "", | ||
"owner": "{{ event.head.user.email }}", | ||
"source": "{{ event.head.repo.url }}", | ||
} | ||
} | ||
|
||
|
||
file_template = { | ||
"version": 0, | ||
"tasks": [], | ||
"allowPullRequests": "collaborators" | ||
} | ||
|
||
suites = { | ||
"testharness": {"chunks": 12}, | ||
"reftest": {"chunks": 6}, | ||
"wdspec": {"chunks": 1} | ||
} | ||
|
||
browsers = { | ||
"firefox": {"name": "firefox-nightly"}, | ||
"chrome": {"name": "chrome-dev"} | ||
} | ||
|
||
|
||
def get_parser(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--dest", | ||
action="store", | ||
default=wpt_root, | ||
help="Directory to write the .taskcluster.yml file to") | ||
return parser | ||
|
||
|
||
def fill(template, data): | ||
rv = {} | ||
for key, value in template.iteritems(): | ||
rv[key] = fill_inner(value, data) | ||
return rv | ||
|
||
|
||
def fill_inner(value, data): | ||
if isinstance(value, six.string_types): | ||
return value % data | ||
elif isinstance(value, dict): | ||
return fill(value, data) | ||
elif isinstance(value, list): | ||
return [fill_inner(item, data) for item in value] | ||
elif isinstance(value, (float,) + six.integer_types): | ||
return value | ||
else: | ||
raise ValueError | ||
|
||
|
||
def run(venv, *args, **kwargs): | ||
if not os.path.isdir(kwargs["dest"]): | ||
raise ValueError("Invalid directory %s" % kwargs["dest"]) | ||
|
||
task_config = copy.deepcopy(file_template) | ||
for browser, browser_props in browsers.iteritems(): | ||
for suite, suite_props in suites.iteritems(): | ||
total_chunks = suite_props.get("chunks", 1) | ||
for chunk in six.moves.xrange(1, total_chunks + 1): | ||
data = { | ||
"suite": suite, | ||
"chunk": chunk, | ||
"browser_name": browser_props["name"], | ||
"command": ("./tools/ci/ci_taskcluster.sh %s %s %s %s" % | ||
(browser, suite, chunk, total_chunks)) | ||
} | ||
|
||
task_data = fill(task_template, data) | ||
task_config["tasks"].append(task_data) | ||
|
||
with open(os.path.join(kwargs["dest"], ".taskcluster.yml"), "w") as f: | ||
f.write("""# GENERATED FILE DO NOT EDIT | ||
# To regenerate this file run ./wpt make-tasks | ||
""") | ||
yaml.dump(task_config, f) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
function xvfb_start() { | ||
GEOMETRY="$SCREEN_WIDTH""x""$SCREEN_HEIGHT""x""$SCREEN_DEPTH" | ||
xvfb-run --server-args="-screen 0 $GEOMETRY -ac +extension RANDR" $@ | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
FROM ubuntu:16.04 | ||
|
||
# No interactive frontend during docker build | ||
ENV DEBIAN_FRONTEND=noninteractive \ | ||
DEBCONF_NONINTERACTIVE_SEEN=true | ||
|
||
# General requirements not in the base image | ||
RUN apt-get -qqy update \ | ||
&& apt-get -qqy install \ | ||
bzip2 \ | ||
ca-certificates \ | ||
dbus-x11 \ | ||
gdebi \ | ||
git \ | ||
locales \ | ||
pulseaudio \ | ||
python \ | ||
python-pip \ | ||
tzdata \ | ||
sudo \ | ||
unzip \ | ||
wget \ | ||
xvfb | ||
|
||
# Installing just the deps of firefox and chrome is moderately tricky, so | ||
# just install the default versions of them, and some extra deps we happen | ||
# to know that chrome requires | ||
|
||
RUN apt-get -qqy install \ | ||
firefox \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry I meant everything below could be removed, i.e. just The other packages below are "some extra deps we happen to know that chrome requires" according to the comment above. And since The comment above should also be updated to reflect that we are only installing firefox now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Installing more stuff at build time does have the advantage that we don't do so much work at runtime, so generally it makes more sense to move stuff into the docker build rather than the other way around. In this case we agreed on irc that it doesn't make much difference either way and there are plenty of performance optimisations and potential cleanup left on the table, so it's OK to just merging what we have now. |
||
libnss3-tools \ | ||
fonts-liberation \ | ||
indicator-application \ | ||
libappindicator1 \ | ||
libappindicator3-1 \ | ||
libdbusmenu-gtk3-4 \ | ||
libindicator3-7 \ | ||
libindicator7 | ||
|
||
RUN pip install --upgrade pip | ||
RUN pip install virtualenv | ||
|
||
ENV TZ "UTC" | ||
RUN echo "${TZ}" > /etc/timezone \ | ||
&& dpkg-reconfigure --frontend noninteractive tzdata | ||
|
||
RUN useradd test \ | ||
--shell /bin/bash \ | ||
--create-home \ | ||
&& usermod -a -G sudo test \ | ||
&& echo 'ALL ALL = (ALL) NOPASSWD: ALL' >> /etc/sudoers \ | ||
&& echo 'test:secret' | chpasswd | ||
|
||
ENV SCREEN_WIDTH 1280 | ||
ENV SCREEN_HEIGHT 1024 | ||
ENV SCREEN_DEPTH 24 | ||
ENV DISPLAY :99.0 | ||
|
||
USER test | ||
|
||
WORKDIR /home/test | ||
|
||
COPY .bashrc /home/test/.bashrc | ||
|
||
COPY start.sh /home/test/start.sh | ||
|
||
# Remove information on how to use sudo on login | ||
RUN sudo echo "" | ||
|
||
RUN git clone --depth=1 https://github.com/w3c/web-platform-tests.git | ||
|
||
RUN mkdir -p /home/test/.fonts && \ | ||
cp web-platform-tests/fonts/Ahem.ttf ~/.fonts && \ | ||
fc-cache -f -v | ||
|
||
RUN mkdir -p /home/test/artifacts |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
cd web-platform-tests | ||
git pull --depth=1 | ||
|
||
sudo sh -c './wpt make-hosts-file >> /etc/hosts' | ||
|
||
# Install Chome dev | ||
deb_archive=google-chrome-unstable_current_amd64.deb | ||
wget https://dl.google.com/linux/direct/$deb_archive | ||
|
||
sudo gdebi -n $deb_archive | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Source: https://www.google.com/intl/en/chrome/browser/ Is this relevant given the expected lifespan of the container? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No; any changes only persist for the lifetime of the container, which is just for a single test run. |
||
|
||
sudo Xvfb $DISPLAY -screen 0 ${SCREEN_WIDTH}x${SCREEN_HEIGHT}x${SCREEN_DEPTH} & |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which version of chrome will this be?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on https://tools.taskcluster.net/groups/bLpNdT49RGCR7nEhELQE1A I'm guessing chrome dev, but I can't tell why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It gets installed using apt in
tools/docker/start.sh
, pretty much like we do for travis. This probably isn't the optimal way to do this; the current setup is more of a proof of concept than anything, so I'm sure there are plenty of improvements we can make.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, well as long as it's not just accidentally chrome dev, that's just fine!