mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Update web-platform-tests to revision 3bfdeb8976fc51748935c8d1f1014dfba8e08dfb
This commit is contained in:
parent
fcd6beb608
commit
cb63cfd5c7
185 changed files with 3083 additions and 1074 deletions
11
tests/wpt/web-platform-tests/tools/ci/action_manifest_build.sh
Executable file
11
tests/wpt/web-platform-tests/tools/ci/action_manifest_build.sh
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
mkdir -p ~/meta
|
||||
|
||||
WPT_MANIFEST_FILE=~/meta/MANIFEST.json
|
||||
|
||||
./wpt manifest -p $WPT_MANIFEST_FILE
|
||||
gzip -k -f --best $WPT_MANIFEST_FILE
|
||||
bzip2 -k -f --best $WPT_MANIFEST_FILE
|
||||
zstd -k -f --ultra -22 $WPT_MANIFEST_FILE
|
|
@ -12,6 +12,7 @@ jobs:
|
|||
pool:
|
||||
vmImage: 'ubuntu-16.04'
|
||||
steps:
|
||||
- checkout: none
|
||||
- script: curl -f -s -S -d "artifact=${{ parameters.artifactName }}" -X POST https://wpt.fyi/api/checks/azure/$(Build.BuildId)
|
||||
displayName: 'Invoke wpt.fyi hook'
|
||||
- script: curl -f -s -S -d "artifact=${{ parameters.artifactName }}" -X POST https://staging.wpt.fyi/api/checks/azure/$(Build.BuildId)
|
||||
|
|
|
@ -1,9 +1,19 @@
|
|||
parameters:
|
||||
channel: preview
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
# This is equivalent to `Homebrew/homebrew-cask-versions/safari-technology-preview`,
|
||||
# but the raw URL is used to bypass caching.
|
||||
HOMEBREW_NO_AUTO_UPDATE=1 brew cask install https://raw.githubusercontent.com/Homebrew/homebrew-cask-versions/master/Casks/safari-technology-preview.rb
|
||||
# https://web-platform-tests.org/running-tests/safari.html
|
||||
sudo "/Applications/Safari Technology Preview.app/Contents/MacOS/safaridriver" --enable
|
||||
defaults write com.apple.Safari WebKitJavaScriptCanOpenWindowsAutomatically 1
|
||||
displayName: 'Install Safari Technology Preview'
|
||||
- ${{ if eq(parameters.channel, 'preview') }}:
|
||||
- script: |
|
||||
# This is equivalent to `Homebrew/homebrew-cask-versions/safari-technology-preview`,
|
||||
# but the raw URL is used to bypass caching.
|
||||
HOMEBREW_NO_AUTO_UPDATE=1 brew cask install https://raw.githubusercontent.com/Homebrew/homebrew-cask-versions/master/Casks/safari-technology-preview.rb
|
||||
# https://web-platform-tests.org/running-tests/safari.html
|
||||
sudo "/Applications/Safari Technology Preview.app/Contents/MacOS/safaridriver" --enable
|
||||
defaults write com.apple.Safari WebKitJavaScriptCanOpenWindowsAutomatically 1
|
||||
displayName: 'Install Safari Technology Preview'
|
||||
- ${{ if eq(parameters.channel, 'stable') }}:
|
||||
- script: |
|
||||
# https://web-platform-tests.org/running-tests/safari.html
|
||||
sudo safaridriver --enable
|
||||
defaults write com.apple.Safari WebKitJavaScriptCanOpenWindowsAutomatically 1
|
||||
displayName: 'Configure Safari'
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
export GITHUB_PULL_REQUEST=$TRAVIS_PULL_REQUEST
|
||||
export GITHUB_BRANCH=$TRAVIS_BRANCH
|
||||
|
||||
if [[ $RUN_JOB -eq 1 ]] || ./wpt test-jobs --includes $JOB; then
|
||||
export RUN_JOB=1
|
||||
git submodule update --init --recursive 1>&2
|
||||
export DISPLAY=:99.0
|
||||
sh -e /etc/init.d/xvfb start 1>&2
|
||||
# For uploading the manifest
|
||||
export WPT_MANIFEST_FILE=$HOME/meta/MANIFEST-$(git rev-parse HEAD).json
|
||||
else
|
||||
export RUN_JOB=0
|
||||
fi
|
|
@ -1,14 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
SCRIPT_DIR=$(cd $(dirname "$0") && pwd -P)
|
||||
WPT_ROOT=$SCRIPT_DIR/../..
|
||||
cd $WPT_ROOT
|
||||
|
||||
mkdir -p ~/meta
|
||||
|
||||
python tools/ci/tag_master.py
|
||||
./wpt manifest -p ~/meta/MANIFEST.json
|
||||
cp ~/meta/MANIFEST.json $WPT_MANIFEST_FILE
|
||||
# Force overwrite of any existing file
|
||||
gzip -f $WPT_MANIFEST_FILE
|
|
@ -1,11 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
SCRIPT_DIR=$(cd $(dirname "$0") && pwd -P)
|
||||
WPT_ROOT=$SCRIPT_DIR/../..
|
||||
cd $WPT_ROOT
|
||||
|
||||
if [[ $RUN_JOB -eq 1 ]]; then
|
||||
pip install -U setuptools
|
||||
pip install -U requests
|
||||
fi
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
SCRIPT_DIR=$(cd $(dirname "$0") && pwd -P)
|
||||
WPT_ROOT=$SCRIPT_DIR/../..
|
||||
cd $WPT_ROOT
|
||||
|
||||
if [[ $RUN_JOB -eq 1 ]]; then
|
||||
$SCRIPT
|
||||
fi
|
|
@ -117,7 +117,7 @@ def make_hosts_file():
|
|||
|
||||
|
||||
def checkout_revision(rev):
|
||||
subprocess.check_call(["git", "checkout", "-q", rev])
|
||||
subprocess.check_call(["git", "checkout", "--quiet", rev])
|
||||
|
||||
|
||||
def install_chrome(channel):
|
||||
|
@ -135,8 +135,8 @@ def install_chrome(channel):
|
|||
with open(dest, "w") as f:
|
||||
f.write(resp.read())
|
||||
|
||||
subprocess.check_call(["sudo", "apt-get", "-qqy", "update"])
|
||||
subprocess.check_call(["sudo", "gdebi", "-n", "/tmp/%s" % deb_archive])
|
||||
run(["sudo", "apt-get", "-qqy", "update"])
|
||||
run(["sudo", "gdebi", "-qn", "/tmp/%s" % deb_archive])
|
||||
|
||||
|
||||
def start_xvfb():
|
||||
|
@ -191,9 +191,9 @@ def set_variables(event):
|
|||
|
||||
|
||||
def include_job(job):
|
||||
# Special case things that unconditionally run on master
|
||||
# Special case things that unconditionally run on pushes,
|
||||
# assuming a higher layer is filtering the required list of branches
|
||||
if (os.environ["GITHUB_PULL_REQUEST"] == "false" and
|
||||
os.environ["GITHUB_BRANCH"] == "master" and
|
||||
job == "run-all"):
|
||||
return True
|
||||
|
||||
|
@ -221,6 +221,27 @@ def setup_environment(args):
|
|||
checkout_revision(args.checkout)
|
||||
|
||||
|
||||
def setup_repository():
|
||||
if os.environ.get("GITHUB_PULL_REQUEST", "false") != "false":
|
||||
parents = run(["git", "show", "--format=%P", "task_head"], return_stdout=True).strip().split()
|
||||
if len(parents) == 2:
|
||||
base_head = parents[0]
|
||||
pr_head = parents[1]
|
||||
|
||||
run(["git", "branch", "base_head", base_head])
|
||||
run(["git", "branch", "pr_head", pr_head])
|
||||
else:
|
||||
print("ERROR: Pull request HEAD wasn't a 2-parent merge commit; "
|
||||
"expected to test the merge of PR into the base")
|
||||
sys.exit(1)
|
||||
|
||||
branch = os.environ.get("GITHUB_BRANCH")
|
||||
if branch:
|
||||
# Ensure that the remote base branch exists
|
||||
# TODO: move this somewhere earlier in the task
|
||||
run(["git", "fetch", "--quiet", "origin", "%s:%s" % (branch, branch)])
|
||||
|
||||
|
||||
def main():
|
||||
args = get_parser().parse_args()
|
||||
try:
|
||||
|
@ -233,11 +254,7 @@ def main():
|
|||
if event:
|
||||
set_variables(event)
|
||||
|
||||
if os.environ.get("GITHUB_BRANCH"):
|
||||
# Ensure that the remote base branch exists
|
||||
# TODO: move this somewhere earlier in the task
|
||||
run(["git", "fetch", "origin", "%s:%s" % (os.environ["GITHUB_BRANCH"],
|
||||
os.environ["GITHUB_BRANCH"])])
|
||||
setup_repository()
|
||||
|
||||
extra_jobs = get_extra_jobs(event)
|
||||
|
||||
|
@ -260,7 +277,7 @@ def main():
|
|||
setup_environment(args)
|
||||
os.chdir(root)
|
||||
cmd = [args.script] + args.script_args
|
||||
print(cmd)
|
||||
print(" ".join(cmd))
|
||||
sys.exit(subprocess.call(cmd))
|
||||
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
# Contents of this script superceeded by tools/ci/run_tc.py
|
|
@ -1,9 +1,9 @@
|
|||
import base64
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import urllib2
|
||||
|
||||
import requests
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
wpt_root = os.path.abspath(os.path.join(here, os.pardir, os.pardir))
|
||||
|
@ -17,26 +17,54 @@ logging.basicConfig(level=logging.INFO)
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def get_pr(owner, repo, sha):
|
||||
url = ("https://api.github.com/search/issues?q=type:pr+is:merged+repo:%s/%s+sha:%s" %
|
||||
(owner, repo, sha))
|
||||
def request(url, desc, data=None, json_data=None, params=None, headers=None):
|
||||
github_token = os.environ.get("GITHUB_TOKEN")
|
||||
default_headers = {
|
||||
"Authorization": "token %s" % github_token,
|
||||
"Accept": "application/vnd.github.machine-man-preview+json"
|
||||
}
|
||||
|
||||
_headers = default_headers
|
||||
if headers is not None:
|
||||
_headers.update(headers)
|
||||
|
||||
kwargs = {"params": params,
|
||||
"headers": _headers}
|
||||
try:
|
||||
resp = urllib2.urlopen(url)
|
||||
body = resp.read()
|
||||
logger.info("Loading URL %s" % url)
|
||||
if json_data is not None or data is not None:
|
||||
method = requests.post
|
||||
kwargs["json"] = json_data
|
||||
kwargs["data"] = data
|
||||
else:
|
||||
method = requests.get
|
||||
|
||||
resp = method(url, **kwargs)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
return None
|
||||
|
||||
if resp.code != 200:
|
||||
logger.error("Got HTTP status %s. Response:" % resp.code)
|
||||
logger.error(body)
|
||||
logger.error("%s failed:\n%s" % (desc, e))
|
||||
return None
|
||||
|
||||
try:
|
||||
data = json.loads(body)
|
||||
resp.raise_for_status()
|
||||
except requests.HTTPError:
|
||||
logger.error("%s failed: Got HTTP status %s. Response:" %
|
||||
(desc, resp.status_code))
|
||||
logger.error(resp.text)
|
||||
return None
|
||||
|
||||
try:
|
||||
return resp.json()
|
||||
except ValueError:
|
||||
logger.error("Failed to read response as JSON:")
|
||||
logger.error(body)
|
||||
logger.error("%s failed: Returned data was not JSON Response:" %
|
||||
(desc, resp.status_code))
|
||||
logger.error(resp.text)
|
||||
|
||||
|
||||
def get_pr(owner, repo, sha):
|
||||
data = request("https://api.github.com/search/issues?q=type:pr+is:merged+repo:%s/%s+sha:%s" %
|
||||
(owner, repo, sha), "Getting PR")
|
||||
if data is None:
|
||||
return None
|
||||
|
||||
items = data["items"]
|
||||
|
@ -52,50 +80,98 @@ def get_pr(owner, repo, sha):
|
|||
|
||||
|
||||
def tag(owner, repo, sha, tag):
|
||||
data = json.dumps({"ref": "refs/tags/%s" % tag,
|
||||
"sha": sha})
|
||||
try:
|
||||
url = "https://api.github.com/repos/%s/%s/git/refs" % (owner, repo)
|
||||
req = urllib2.Request(url, data=data)
|
||||
data = {"ref": "refs/tags/%s" % tag,
|
||||
"sha": sha}
|
||||
url = "https://api.github.com/repos/%s/%s/git/refs" % (owner, repo)
|
||||
|
||||
base64string = base64.b64encode(os.environ["GH_TOKEN"])
|
||||
req.add_header("Authorization", "Basic %s" % base64string)
|
||||
|
||||
opener = urllib2.build_opener(urllib2.HTTPSHandler())
|
||||
|
||||
resp = opener.open(req)
|
||||
except Exception as e:
|
||||
logger.error("Tag creation failed:\n%s" % e)
|
||||
return False
|
||||
|
||||
if resp.code != 201:
|
||||
logger.error("Got HTTP status %s. Response:" % resp.code)
|
||||
logger.error(resp.read())
|
||||
resp_data = request(url, "Tag creation", json_data=data)
|
||||
if not resp_data:
|
||||
return False
|
||||
|
||||
logger.info("Tagged %s as %s" % (sha, tag))
|
||||
return True
|
||||
|
||||
|
||||
def main():
|
||||
owner, repo = os.environ["TRAVIS_REPO_SLUG"].split("/", 1)
|
||||
if os.environ["TRAVIS_PULL_REQUEST"] != "false":
|
||||
def create_release(owner, repo, sha, tag, summary, body):
|
||||
if body:
|
||||
body = "%s\n%s" % (summary, body)
|
||||
else:
|
||||
body = summary
|
||||
|
||||
create_url = "https://api.github.com/repos/%s/%s/releases" % (owner, repo)
|
||||
create_data = {"tag_name": tag,
|
||||
"name": tag,
|
||||
"body": body}
|
||||
create_data = request(create_url, "Release creation", json_data=create_data)
|
||||
if not create_data:
|
||||
return False
|
||||
|
||||
# Upload URL contains '{?name,label}' at the end which we want to remove
|
||||
upload_url = create_data["upload_url"].split("{", 1)[0]
|
||||
|
||||
success = True
|
||||
|
||||
upload_exts = [".gz", ".bz2", ".zst"]
|
||||
for upload_ext in upload_exts:
|
||||
upload_filename = "MANIFEST-%s.json%s" % (sha, upload_ext)
|
||||
params = {"name": upload_filename,
|
||||
"label": "MANIFEST.json%s" % upload_ext}
|
||||
|
||||
with open(os.path.expanduser("~/meta/MANIFEST.json%s" % upload_ext), "rb") as f:
|
||||
upload_data = f.read()
|
||||
|
||||
logger.info("Uploading %s bytes" % len(upload_data))
|
||||
|
||||
upload_resp = request(upload_url, "Manifest upload", data=upload_data, params=params,
|
||||
headers={'Content-Type': 'application/octet-stream'})
|
||||
if not upload_resp:
|
||||
success = False
|
||||
|
||||
return success
|
||||
|
||||
|
||||
def should_run_action():
|
||||
with open(os.environ["GITHUB_EVENT_PATH"]) as f:
|
||||
event = json.load(f)
|
||||
logger.info(json.dumps(event, indent=2))
|
||||
|
||||
if "pull_request" in event:
|
||||
logger.info("Not tagging for PR")
|
||||
return False
|
||||
if event.get("ref") != "refs/heads/master":
|
||||
logger.info("Not tagging for ref %s" % event.get("ref"))
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def main():
|
||||
repo_key = "GITHUB_REPOSITORY"
|
||||
|
||||
if not should_run_action():
|
||||
return
|
||||
if os.environ["TRAVIS_BRANCH"] != "master":
|
||||
logger.info("Not tagging for non-master branch")
|
||||
return
|
||||
|
||||
owner, repo = os.environ[repo_key].split("/", 1)
|
||||
|
||||
git = get_git_cmd(wpt_root)
|
||||
head_rev = git("rev-parse", "HEAD")
|
||||
|
||||
pr = get_pr(owner, repo, head_rev)
|
||||
if pr is None:
|
||||
sys.exit(1)
|
||||
tagged = tag(owner, repo, head_rev, "merge_pr_%s" % pr)
|
||||
# This should only really happen during testing
|
||||
tag_name = "merge_commit_%s" % head_rev
|
||||
else:
|
||||
tag_name = "merge_pr_%s" % pr
|
||||
|
||||
tagged = tag(owner, repo, head_rev, tag_name)
|
||||
if not tagged:
|
||||
sys.exit(1)
|
||||
|
||||
summary = git("show", "--no-patch", '--format="%s"', "HEAD")
|
||||
body = git("show", "--no-patch", '--format="%b"', "HEAD")
|
||||
|
||||
if not create_release(owner, repo, head_rev, tag_name, summary, body):
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue