Compare commits
10
Commits
0e39c20ef3
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ab973ff67 | ||
|
|
4bd7a68864 | ||
|
|
30032fd42d | ||
|
|
f915c30f02 | ||
|
|
754283d95e | ||
|
|
e8cd615d83 | ||
|
|
c721cc6b5b | ||
|
|
619d29b12e | ||
|
|
d77f096932 | ||
|
|
07935271cb |
No files matched your search
+6
-1
@@ -8,6 +8,10 @@
|
|||||||
"require_manual_registration" : false,
|
"require_manual_registration" : false,
|
||||||
"balance_engine_throughputs" : true,
|
"balance_engine_throughputs" : true,
|
||||||
|
|
||||||
|
"gitea_hosts" : [
|
||||||
|
"https://gitea.rektdie.com"
|
||||||
|
],
|
||||||
|
|
||||||
"books" : [
|
"books" : [
|
||||||
"2moves_v1.epd",
|
"2moves_v1.epd",
|
||||||
"3moves_FRC.epd",
|
"3moves_FRC.epd",
|
||||||
@@ -33,6 +37,7 @@
|
|||||||
"Prelude",
|
"Prelude",
|
||||||
"Simpler",
|
"Simpler",
|
||||||
"Stormphrax",
|
"Stormphrax",
|
||||||
"Impact"
|
"Impact",
|
||||||
|
"Rigby"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
{
|
||||||
|
"private" : false,
|
||||||
|
"nps" : 780000,
|
||||||
|
"source" : "https://gitea.rektdie.com/rektdie/Rigby",
|
||||||
|
|
||||||
|
"build" : {
|
||||||
|
"path" : "",
|
||||||
|
"compilers" : ["clang++"],
|
||||||
|
"cpuflags" : [],
|
||||||
|
"systems" : ["Linux", "Windows", "Darwin"]
|
||||||
|
},
|
||||||
|
|
||||||
|
"test_presets" : {
|
||||||
|
|
||||||
|
"default" : {
|
||||||
|
"base_branch" : "main",
|
||||||
|
"book_name" : "UHO_Lichess_4852_v1.epd",
|
||||||
|
"test_bounds" : "[0.00, 5.00]",
|
||||||
|
"test_confidence" : "[0.05, 0.05]",
|
||||||
|
"win_adj" : "movecount=3 score=400",
|
||||||
|
"draw_adj" : "movenumber=40 movecount=8 score=10"
|
||||||
|
},
|
||||||
|
|
||||||
|
"STC" : {
|
||||||
|
"both_options" : "Threads=1 Hash=64",
|
||||||
|
"both_time_control" : "8.0+0.08",
|
||||||
|
"workload_size" : 32
|
||||||
|
},
|
||||||
|
|
||||||
|
"LTC" : {
|
||||||
|
"both_options" : "Threads=1 Hash=256",
|
||||||
|
"both_time_control" : "40.0+0.4",
|
||||||
|
"workload_size" : 8
|
||||||
|
},
|
||||||
|
|
||||||
|
"Non-Regression STC" : {
|
||||||
|
"test_bounds" : "[-5.00, 0.00]",
|
||||||
|
"both_options" : "Threads=1 Hash=64",
|
||||||
|
"both_time_control" : "8.0+0.08",
|
||||||
|
"workload_size" : 32
|
||||||
|
},
|
||||||
|
|
||||||
|
"Non-Regression LTC" : {
|
||||||
|
"test_bounds" : "[-5.00, 0.00]",
|
||||||
|
"both_options" : "Threads=1 Hash=256",
|
||||||
|
"both_time_control" : "40.0+0.4",
|
||||||
|
"workload_size" : 8
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"tune_presets" : {
|
||||||
|
|
||||||
|
"default" : {
|
||||||
|
"book_name" : "UHO_Lichess_4852_v1.epd",
|
||||||
|
"win_adj" : "movecount=3 score=400",
|
||||||
|
"draw_adj" : "movenumber=40 movecount=8 score=10"
|
||||||
|
},
|
||||||
|
|
||||||
|
"STC" : {
|
||||||
|
"dev_options" : "Threads=1 Hash=64",
|
||||||
|
"dev_time_control" : "8.0+0.08"
|
||||||
|
},
|
||||||
|
|
||||||
|
"LTC" : {
|
||||||
|
"dev_options" : "Threads=1 Hash=256",
|
||||||
|
"dev_time_control" : "40.0+0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"datagen_presets" : {
|
||||||
|
|
||||||
|
"default" : {
|
||||||
|
"win_adj" : "None",
|
||||||
|
"draw_adj" : "None",
|
||||||
|
"workload_size" : 128
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
-1
@@ -25,7 +25,7 @@ import traceback
|
|||||||
|
|
||||||
from OpenSite.settings import PROJECT_PATH
|
from OpenSite.settings import PROJECT_PATH
|
||||||
|
|
||||||
OPENBENCH_STATIC_VERSION = 'v4'
|
OPENBENCH_STATIC_VERSION = 'v5'
|
||||||
|
|
||||||
OPENBENCH_CONFIG = None # Initialized by OpenBench/apps.py
|
OPENBENCH_CONFIG = None # Initialized by OpenBench/apps.py
|
||||||
|
|
||||||
@@ -101,6 +101,11 @@ def verify_general_config(conf):
|
|||||||
assert type(conf.get("require_manual_registration") == bool)
|
assert type(conf.get("require_manual_registration") == bool)
|
||||||
assert type(conf.get("balance_engine_throughputs" ) == bool)
|
assert type(conf.get("balance_engine_throughputs" ) == bool)
|
||||||
|
|
||||||
|
# Optional: Gitea servers that may serve engine sources, e.g. "https://gitea.example.com"
|
||||||
|
hosts = conf.get("gitea_hosts", [])
|
||||||
|
assert type(hosts) == list
|
||||||
|
assert all(type(x) == str and x.startswith('https://') and x.count('/') == 2 for x in hosts)
|
||||||
|
|
||||||
def verify_engine_basics(conf):
|
def verify_engine_basics(conf):
|
||||||
|
|
||||||
assert type(conf.get('private')) == bool
|
assert type(conf.get('private')) == bool
|
||||||
|
|||||||
@@ -0,0 +1,214 @@
|
|||||||
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||||
|
# #
|
||||||
|
# OpenBench is a chess engine testing framework authored by Andrew Grant. #
|
||||||
|
# <https://github.com/AndyGrant/OpenBench> <andrew@grantnet.us> #
|
||||||
|
# #
|
||||||
|
# OpenBench is free software: you can redistribute it and/or modify #
|
||||||
|
# it under the terms of the GNU General Public License as published by #
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or #
|
||||||
|
# (at your option) any later version. #
|
||||||
|
# #
|
||||||
|
# OpenBench 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 this program. If not, see <http://www.gnu.org/licenses/>. #
|
||||||
|
# #
|
||||||
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||||
|
|
||||||
|
# Everything OpenBench needs to know about where engine sources live.
|
||||||
|
#
|
||||||
|
# Sources can be on Github, or on a Gitea server listed under "gitea_hosts" in
|
||||||
|
# Config/config.json.
|
||||||
|
#
|
||||||
|
# Workers download sources with a plain GET and no credentials. Github archives
|
||||||
|
# are public, so workers fetch them directly. For Gitea there are two modes:
|
||||||
|
#
|
||||||
|
# - Without a token, the repository must be readable anonymously (public, and
|
||||||
|
# REQUIRE_SIGNIN_VIEW off on the Gitea server). The API is called without
|
||||||
|
# credentials and workers get the plain archive link, exactly like Github.
|
||||||
|
#
|
||||||
|
# - With an API token in Config/credentials.gitea, private repositories and
|
||||||
|
# servers that require a login work too. The token is never sent to any other
|
||||||
|
# host. Workers cannot log in, so the server hands them a signed link to
|
||||||
|
# /giteaSource/, which fetches the archive with the token and passes it on.
|
||||||
|
#
|
||||||
|
# The links are signed with the Gitea token itself, not Django's SECRET_KEY:
|
||||||
|
# settings.py is part of the public repository, and a forged link would let
|
||||||
|
# anyone read every repository the token can see. Replacing the token
|
||||||
|
# invalidates the source links of tests created before.
|
||||||
|
|
||||||
|
import hashlib
|
||||||
|
import hmac
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import urllib.parse
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
|
import OpenBench.config
|
||||||
|
|
||||||
|
from OpenSite.settings import PROJECT_PATH
|
||||||
|
|
||||||
|
GITHUB_PREFIX = 'https://github.com/'
|
||||||
|
GITHUB_PATTERN = r'^https:\/\/github\.com\/[A-Za-z0-9-]+\/[A-Za-z0-9_.-]+\/?$'
|
||||||
|
REPO_TAIL = r'\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+\/?$'
|
||||||
|
REQUEST_TIMEOUT = 30
|
||||||
|
|
||||||
|
def gitea_hosts():
|
||||||
|
return [host.rstrip('/') for host in OpenBench.config.OPENBENCH_CONFIG.get('gitea_hosts', [])]
|
||||||
|
|
||||||
|
def repo_prefixes():
|
||||||
|
return [GITHUB_PREFIX] + ['%s/' % (host) for host in gitea_hosts()]
|
||||||
|
|
||||||
|
def gitea_host(repo):
|
||||||
|
for host in gitea_hosts():
|
||||||
|
if repo.startswith(host + '/'):
|
||||||
|
return host
|
||||||
|
return None
|
||||||
|
|
||||||
|
def is_gitea(repo):
|
||||||
|
return gitea_host(repo) is not None
|
||||||
|
|
||||||
|
def is_valid_repo(repo):
|
||||||
|
|
||||||
|
if re.match(GITHUB_PATTERN, repo):
|
||||||
|
return True
|
||||||
|
|
||||||
|
host = gitea_host(repo)
|
||||||
|
return bool(host and re.match(REPO_TAIL, repo[len(host):]))
|
||||||
|
|
||||||
|
def owner_and_name(repo):
|
||||||
|
host = gitea_host(repo) or GITHUB_PREFIX.rstrip('/')
|
||||||
|
owner, name = repo[len(host):].strip('/').split('/')[:2]
|
||||||
|
return owner, name
|
||||||
|
|
||||||
|
def api_base(repo):
|
||||||
|
|
||||||
|
if (host := gitea_host(repo)):
|
||||||
|
return '%s/api/v1/repos/%s/%s' % ((host,) + owner_and_name(repo))
|
||||||
|
|
||||||
|
return repo.rstrip('/').replace('github.com', 'api.github.com/repos')
|
||||||
|
|
||||||
|
def read_gitea_token():
|
||||||
|
path = os.path.join(PROJECT_PATH, 'Config', 'credentials.gitea')
|
||||||
|
if os.path.exists(path):
|
||||||
|
with open(path) as fin:
|
||||||
|
return fin.readline().strip() or None
|
||||||
|
|
||||||
|
def gitea_headers():
|
||||||
|
token = read_gitea_token()
|
||||||
|
return { 'Authorization' : 'token %s' % (token) } if token else {}
|
||||||
|
|
||||||
|
def api_headers(engine, repo):
|
||||||
|
|
||||||
|
if is_gitea(repo):
|
||||||
|
return gitea_headers()
|
||||||
|
|
||||||
|
import OpenBench.utils
|
||||||
|
return OpenBench.utils.read_git_credentials(engine) or {}
|
||||||
|
|
||||||
|
def fetch_commit(repo, ref, headers):
|
||||||
|
|
||||||
|
# Returns { 'sha', 'tree', 'message' } for a branch, tag, or commit sha.
|
||||||
|
# Raises when the reference cannot be resolved.
|
||||||
|
|
||||||
|
base = api_base(repo)
|
||||||
|
bysha = bool(re.search('^[0-9a-fA-F]{40}$', ref))
|
||||||
|
|
||||||
|
if is_gitea(repo):
|
||||||
|
# One endpoint resolves branches, tags and commit shas alike
|
||||||
|
params = { 'sha' : ref, 'limit' : 1, 'stat' : 'false', 'verification' : 'false', 'files' : 'false' }
|
||||||
|
data = requests.get(base + '/commits', params=params, headers=headers, timeout=REQUEST_TIMEOUT).json()
|
||||||
|
data = data[0]
|
||||||
|
|
||||||
|
else:
|
||||||
|
# Lookup branch or commit sha, but will fail for tags
|
||||||
|
url = '%s/%s/%s' % (base, 'commits' if bysha else 'branches', ref)
|
||||||
|
data = requests.get(url, headers=headers, timeout=REQUEST_TIMEOUT).json()
|
||||||
|
|
||||||
|
# Check to see if the branch name was actually a tag name
|
||||||
|
if not bysha and 'commit' not in data:
|
||||||
|
url = '%s/commits/%s' % (base, ref)
|
||||||
|
data = requests.get(url, headers=headers, timeout=REQUEST_TIMEOUT).json()
|
||||||
|
|
||||||
|
# Actual branches have to go one layer deeper
|
||||||
|
elif not bysha: data = data['commit']
|
||||||
|
|
||||||
|
# A lookup by sha must land on exactly that commit
|
||||||
|
if bysha and data['sha'].lower() != ref.lower():
|
||||||
|
raise ValueError('%s resolved to %s' % (ref, data['sha']))
|
||||||
|
|
||||||
|
return {
|
||||||
|
'sha' : data['sha'],
|
||||||
|
'tree' : (data['commit'].get('tree') or {}).get('sha'),
|
||||||
|
'message' : data['commit']['message'],
|
||||||
|
}
|
||||||
|
|
||||||
|
def commits_ahead(repo, dev_sha, base_sha, headers):
|
||||||
|
|
||||||
|
# Number of commits on base_sha that dev_sha does not have
|
||||||
|
base = api_base(repo)
|
||||||
|
|
||||||
|
if is_gitea(repo):
|
||||||
|
url = '%s/compare/%s...%s' % (base, dev_sha, base_sha)
|
||||||
|
params = { 'verification' : 'false', 'files' : 'false' }
|
||||||
|
return int(requests.get(url, params=params, headers=headers, timeout=REQUEST_TIMEOUT).json().get('total_commits', 0))
|
||||||
|
|
||||||
|
url = '%s/compare/%s...%s' % (base, dev_sha, base_sha)
|
||||||
|
return int(requests.get(url, headers=headers, timeout=REQUEST_TIMEOUT).json().get('ahead_by', 0))
|
||||||
|
|
||||||
|
def compare_url(repo, base_sha, dev_sha):
|
||||||
|
|
||||||
|
repo = repo.rstrip('/')
|
||||||
|
|
||||||
|
if is_gitea(repo):
|
||||||
|
return '%s/compare/%s...%s' % (repo, base_sha, dev_sha)
|
||||||
|
|
||||||
|
return '%s/compare/%s..%s' % (repo, base_sha, dev_sha)
|
||||||
|
|
||||||
|
def source_signature(repo, sha):
|
||||||
|
|
||||||
|
# Without a token there is nothing secret to sign with, and nothing to fetch with
|
||||||
|
if not (key := read_gitea_token()):
|
||||||
|
return None
|
||||||
|
|
||||||
|
message = ('openbench-gitea-source\n%s\n%s' % (repo.rstrip('/'), sha.lower())).encode('utf-8')
|
||||||
|
return hmac.new(key.encode('utf-8'), message, hashlib.sha256).hexdigest()
|
||||||
|
|
||||||
|
def source_url(request, repo, commit):
|
||||||
|
|
||||||
|
# Github serves archives by tree sha, so identical trees share one download
|
||||||
|
if not is_gitea(repo):
|
||||||
|
return '%s/archive/%s.zip' % (repo.rstrip('/'), commit['tree'])
|
||||||
|
|
||||||
|
# Without a token the repository is public: workers download it directly.
|
||||||
|
# Gitea archives are addressed by commit, not by tree.
|
||||||
|
if not read_gitea_token():
|
||||||
|
return '%s/archive/%s.zip' % (repo.rstrip('/'), commit['sha'])
|
||||||
|
|
||||||
|
query = urllib.parse.urlencode({
|
||||||
|
'repo' : repo.rstrip('/'),
|
||||||
|
'sha' : commit['sha'],
|
||||||
|
'sig' : source_signature(repo, commit['sha']),
|
||||||
|
})
|
||||||
|
|
||||||
|
return request.build_absolute_uri('/giteaSource/?%s' % (query))
|
||||||
|
|
||||||
|
def verify_source_request(repo, sha, sig):
|
||||||
|
|
||||||
|
if not (is_valid_repo(repo) and is_gitea(repo) and re.match('^[0-9a-fA-F]{40}$', sha or '')):
|
||||||
|
return False
|
||||||
|
|
||||||
|
expected = source_signature(repo, sha)
|
||||||
|
return bool(expected) and hmac.compare_digest(expected, sig or '')
|
||||||
|
|
||||||
|
def open_gitea_archive(repo, sha):
|
||||||
|
|
||||||
|
# Streams the .zip for one commit from the Gitea API
|
||||||
|
url = '%s/archive/%s.zip' % (api_base(repo), sha)
|
||||||
|
response = requests.get(url, headers=gitea_headers(), stream=True, timeout=REQUEST_TIMEOUT)
|
||||||
|
response.raise_for_status()
|
||||||
|
return response
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
import django.http
|
||||||
|
|
||||||
|
# Public pages worth listing for search engines. The API, the client
|
||||||
|
# endpoints, the account pages and the creation forms are left out on purpose.
|
||||||
|
PUBLIC_PATHS = [
|
||||||
|
'/',
|
||||||
|
'/index/',
|
||||||
|
'/greens/',
|
||||||
|
'/users/',
|
||||||
|
'/events/',
|
||||||
|
'/machines/',
|
||||||
|
'/networks/',
|
||||||
|
]
|
||||||
|
|
||||||
|
# Prefixes that crawlers have no business visiting
|
||||||
|
DISALLOWED_PREFIXES = [
|
||||||
|
'/api/',
|
||||||
|
'/client',
|
||||||
|
'/scripts/',
|
||||||
|
'/login/',
|
||||||
|
'/register/',
|
||||||
|
'/logout/',
|
||||||
|
'/profile',
|
||||||
|
'/newTest/',
|
||||||
|
'/newTune/',
|
||||||
|
'/newDatagen/',
|
||||||
|
'/newNetwork/',
|
||||||
|
]
|
||||||
|
|
||||||
|
def robots_txt(request):
|
||||||
|
|
||||||
|
lines = ['User-agent: *']
|
||||||
|
lines += ['Disallow: {}'.format(prefix) for prefix in DISALLOWED_PREFIXES]
|
||||||
|
lines += ['', 'Sitemap: {}'.format(request.build_absolute_uri('/sitemap.xml'))]
|
||||||
|
|
||||||
|
return django.http.HttpResponse('\n'.join(lines) + '\n', content_type='text/plain')
|
||||||
|
|
||||||
|
def sitemap_xml(request):
|
||||||
|
|
||||||
|
entries = ''.join(
|
||||||
|
'<url><loc>{}</loc></url>'.format(request.build_absolute_uri(path))
|
||||||
|
for path in PUBLIC_PATHS
|
||||||
|
)
|
||||||
|
|
||||||
|
body = (
|
||||||
|
'<?xml version="1.0" encoding="UTF-8"?>\n'
|
||||||
|
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">{}</urlset>\n'
|
||||||
|
).format(entries)
|
||||||
|
|
||||||
|
return django.http.HttpResponse(body, content_type='application/xml')
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
function enforce_default_text(id, text) {
|
function enforce_default_text(id, text) {
|
||||||
|
|
||||||
|
// `text` may be a list of accepted prefixes; the first one is the default.
|
||||||
|
var prefixes = Array.isArray(text) ? text : [text];
|
||||||
|
text = prefixes[0];
|
||||||
|
|
||||||
window.addEventListener('DOMContentLoaded', function() {
|
window.addEventListener('DOMContentLoaded', function() {
|
||||||
|
|
||||||
var field = document.getElementById(id);
|
var field = document.getElementById(id);
|
||||||
@@ -9,7 +13,8 @@ function enforce_default_text(id, text) {
|
|||||||
|
|
||||||
field.addEventListener('input', function() {
|
field.addEventListener('input', function() {
|
||||||
|
|
||||||
if (field.value.startsWith(text) || field.value === text)
|
// Accept any allowed prefix, and anything still being typed towards one
|
||||||
|
if (prefixes.some(function(p) { return field.value.startsWith(p) || p.startsWith(field.value); }))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (field.value.endsWith('/'))
|
if (field.value.endsWith('/'))
|
||||||
|
|||||||
+21
-130
@@ -1,133 +1,24 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<svg
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 250 250" width="250" height="250">
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
<title>OpenBench</title>
|
||||||
xmlns:cc="http://creativecommons.org/ns#"
|
<defs>
|
||||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
<clipPath id="tile">
|
||||||
xmlns:svg="http://www.w3.org/2000/svg"
|
<rect width="250" height="250" rx="48"/>
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
</clipPath>
|
||||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
||||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
||||||
width="250mm"
|
|
||||||
height="250mm"
|
|
||||||
viewBox="0 0 250 250"
|
|
||||||
version="1.1"
|
|
||||||
id="svg8"
|
|
||||||
inkscape:version="1.0 (4035a4f, 2020-05-01)"
|
|
||||||
sodipodi:docname="logo.svg">
|
|
||||||
<defs
|
|
||||||
id="defs2">
|
|
||||||
<inkscape:perspective
|
|
||||||
sodipodi:type="inkscape:persp3d"
|
|
||||||
inkscape:vp_x="-192.73904 : 85.416586 : 1"
|
|
||||||
inkscape:vp_y="0 : 999.99996 : 0"
|
|
||||||
inkscape:vp_z="210 : 101.5 : 1"
|
|
||||||
inkscape:persp3d-origin="105 : 51.999997 : 1"
|
|
||||||
id="perspective857" />
|
|
||||||
<rect
|
|
||||||
x="191.06123"
|
|
||||||
y="167.60974"
|
|
||||||
width="9.3152771"
|
|
||||||
height="28.649736"
|
|
||||||
id="rect853" />
|
|
||||||
<rect
|
|
||||||
x="120.10982"
|
|
||||||
y="27.845661"
|
|
||||||
width="83.140968"
|
|
||||||
height="150.35945"
|
|
||||||
id="rect24" />
|
|
||||||
<rect
|
|
||||||
x="113.84743"
|
|
||||||
y="28.873098"
|
|
||||||
width="68.721581"
|
|
||||||
height="89.834076"
|
|
||||||
id="rect18" />
|
|
||||||
<rect
|
|
||||||
x="37.502277"
|
|
||||||
y="98.018333"
|
|
||||||
width="79.874741"
|
|
||||||
height="106.64691"
|
|
||||||
id="rect12" />
|
|
||||||
</defs>
|
</defs>
|
||||||
<sodipodi:namedview
|
|
||||||
id="base"
|
<!-- Board: graphite base, accent-green and surface-grey squares -->
|
||||||
pagecolor="#ffffff"
|
<g clip-path="url(#tile)">
|
||||||
bordercolor="#666666"
|
<rect width="250" height="250" fill="#14161A"/>
|
||||||
borderopacity="1.0"
|
<rect x="0" y="0" width="125" height="125" fill="#4F8160"/>
|
||||||
inkscape:pageopacity="0.0"
|
<rect x="125" y="125" width="125" height="125" fill="#4F8160"/>
|
||||||
inkscape:pageshadow="2"
|
<rect x="125" y="0" width="125" height="125" fill="#23272D"/>
|
||||||
inkscape:zoom="1"
|
<rect x="0" y="125" width="125" height="125" fill="#23272D"/>
|
||||||
inkscape:cx="509.11884"
|
|
||||||
inkscape:cy="432.95515"
|
|
||||||
inkscape:document-units="mm"
|
|
||||||
inkscape:current-layer="layer1"
|
|
||||||
inkscape:document-rotation="0"
|
|
||||||
showgrid="false"
|
|
||||||
fit-margin-top="0"
|
|
||||||
fit-margin-left="0"
|
|
||||||
fit-margin-right="0"
|
|
||||||
fit-margin-bottom="0"
|
|
||||||
inkscape:snap-bbox="false"
|
|
||||||
inkscape:window-width="1853"
|
|
||||||
inkscape:window-height="1025"
|
|
||||||
inkscape:window-x="67"
|
|
||||||
inkscape:window-y="27"
|
|
||||||
inkscape:window-maximized="1" />
|
|
||||||
<metadata
|
|
||||||
id="metadata5">
|
|
||||||
<rdf:RDF>
|
|
||||||
<cc:Work
|
|
||||||
rdf:about="">
|
|
||||||
<dc:format>image/svg+xml</dc:format>
|
|
||||||
<dc:type
|
|
||||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
||||||
<dc:title></dc:title>
|
|
||||||
</cc:Work>
|
|
||||||
</rdf:RDF>
|
|
||||||
</metadata>
|
|
||||||
<g
|
|
||||||
inkscape:label="Layer 1"
|
|
||||||
inkscape:groupmode="layer"
|
|
||||||
id="layer1"
|
|
||||||
transform="translate(16.1122,-26.054426)">
|
|
||||||
<rect
|
|
||||||
style="fill:#94e196;fill-opacity:1;stroke-width:0.264583"
|
|
||||||
id="rect873"
|
|
||||||
width="250"
|
|
||||||
height="250"
|
|
||||||
x="-16.1122"
|
|
||||||
y="26.054426" />
|
|
||||||
<g
|
|
||||||
id="g949">
|
|
||||||
<rect
|
|
||||||
y="26.054426"
|
|
||||||
x="-16.1122"
|
|
||||||
height="125"
|
|
||||||
width="125"
|
|
||||||
id="rect875"
|
|
||||||
style="fill:#118c40;fill-opacity:1;stroke-width:0.264583" />
|
|
||||||
<rect
|
|
||||||
style="fill:#118c40;fill-opacity:1;stroke-width:0.264583"
|
|
||||||
id="rect875-3"
|
|
||||||
width="125"
|
|
||||||
height="125"
|
|
||||||
x="108.88778"
|
|
||||||
y="151.05443" />
|
|
||||||
</g>
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
id="text16"
|
|
||||||
style="font-style:normal;font-weight:normal;font-size:10.5833px;line-height:1.25;font-family:sans-serif;white-space:pre;shape-inside:url(#rect18);fill:#000000;fill-opacity:1;stroke:none;" />
|
|
||||||
<path
|
|
||||||
id="path860"
|
|
||||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:88.1944px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';white-space:pre;fill:#0d0208;fill-opacity:1;stroke:none;stroke-width:3.24563"
|
|
||||||
d="m 108.88778,78.418988 q -23.454412,0 -36.380997,19.056735 -12.926584,19.056717 -12.926584,53.651967 0,34.4487 12.926584,53.50539 12.926585,19.05675 36.380997,19.05675 23.5877,0 36.51428,-19.05675 12.92658,-19.05669 12.92658,-53.50539 0,-34.59525 -12.92658,-53.651967 -12.92658,-19.056735 -36.51428,-19.056735 z m 0,-40.898628 q 47.97497,0 75.16077,30.197581 27.18582,30.197552 27.18582,83.409749 0,53.06564 -27.18582,83.26322 -27.1858,30.19758 -75.16077,30.19758 -47.841678,0 -75.16075,-30.19758 Q 6.5412263,204.19333 6.5412263,151.12769 6.5412263,97.915493 33.72703,67.717941 61.046102,37.52036 108.88778,37.52036 Z" />
|
|
||||||
<path
|
|
||||||
id="path863"
|
|
||||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:105.833px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';white-space:pre;fill:#008f11;fill-opacity:1;stroke:none;stroke-width:2.06305"
|
|
||||||
d="m -87.315338,146.28255 q 9.70158,0 14.71229,-4.26443 5.0107,-4.26443 5.0107,-12.58006 0,-8.20903 -5.0107,-12.47346 -5.01071,-4.37104 -14.71229,-4.37104 h -22.708072 v 33.68899 z m 1.38594,69.6168 q 12.36685,0 18.55028,-5.22393 6.29004,-5.22391 6.29004,-15.77838 0,-10.34124 -6.18344,-15.45855 -6.18341,-5.22393 -18.65688,-5.22393 h -24.094012 v 41.68479 z m 38.16665,-57.24996 q 13.21974,3.83799 20.46925,14.17923 7.24954,10.34124 7.24954,25.37335 0,23.02791 -15.56518,34.32866 -15.56515,11.30073 -47.33515,11.30073 H -151.06855 V 84.661543 h 61.621012 q 33.15594,0 47.97482,10.02141 14.92551,10.021417 14.92551,32.089837 0,11.62057 -5.43715,19.82959 -5.43714,8.10242 -15.77839,12.04701 z" />
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
id="text851"
|
|
||||||
style="font-style:normal;font-weight:normal;font-size:10.5833px;line-height:1.25;font-family:sans-serif;white-space:pre;shape-inside:url(#rect853);fill:#000000;fill-opacity:1;stroke:none;" />
|
|
||||||
</g>
|
</g>
|
||||||
|
|
||||||
|
<!-- Thin rim so the tile stays defined on dark browser chrome -->
|
||||||
|
<rect x="1.5" y="1.5" width="247" height="247" rx="46.5" fill="none" stroke="#3A3F48" stroke-width="3"/>
|
||||||
|
|
||||||
|
<!-- O, in the theme's bone text colour -->
|
||||||
|
<circle cx="125" cy="125" r="62" fill="none" stroke="#EDEAE3" stroke-width="32"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 1008 B |
@@ -22,6 +22,7 @@ import html
|
|||||||
import json
|
import json
|
||||||
import re, django
|
import re, django
|
||||||
import OpenBench.config, OpenBench.utils, OpenBench.stats, OpenBench.models
|
import OpenBench.config, OpenBench.utils, OpenBench.stats, OpenBench.models
|
||||||
|
import OpenBench.git_hosts
|
||||||
|
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
|
|
||||||
@@ -53,14 +54,17 @@ def gitDiffLink(test):
|
|||||||
|
|
||||||
if test.dev_engine in engines and engines[test.dev_engine]['private']:
|
if test.dev_engine in engines and engines[test.dev_engine]['private']:
|
||||||
repo = OpenBench.config.OPENBENCH_CONFIG['engines'][test.dev_engine]['source']
|
repo = OpenBench.config.OPENBENCH_CONFIG['engines'][test.dev_engine]['source']
|
||||||
|
elif OpenBench.git_hosts.is_gitea(test.dev_repo):
|
||||||
|
repo = test.dev_repo # Gitea sources point at this server's /giteaSource/
|
||||||
else:
|
else:
|
||||||
repo = OpenBench.utils.path_join(*test.dev.source.split('/')[:-2])
|
repo = OpenBench.utils.path_join(*test.dev.source.split('/')[:-2])
|
||||||
|
|
||||||
if test.test_mode == 'SPSA':
|
if test.test_mode == 'SPSA':
|
||||||
|
if OpenBench.git_hosts.is_gitea(repo):
|
||||||
|
return OpenBench.utils.path_join(repo, 'commit', test.dev.sha)
|
||||||
return OpenBench.utils.path_join(repo, 'compare', test.dev.sha[:8])
|
return OpenBench.utils.path_join(repo, 'compare', test.dev.sha[:8])
|
||||||
|
|
||||||
return OpenBench.utils.path_join(repo, 'compare',
|
return OpenBench.git_hosts.compare_url(repo, test.base.sha[:8], test.dev.sha[:8])
|
||||||
'{0}..{1}'.format( test.base.sha[:8], test.dev.sha[:8]))
|
|
||||||
|
|
||||||
def shortStatBlock(test):
|
def shortStatBlock(test):
|
||||||
|
|
||||||
|
|||||||
+6
-1
@@ -18,10 +18,14 @@
|
|||||||
# #
|
# #
|
||||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||||
|
|
||||||
import django.urls, OpenBench.views
|
import django.urls, OpenBench.views, OpenBench.seo
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
|
||||||
|
# Files for search engines
|
||||||
|
django.urls.path(r'robots.txt', OpenBench.seo.robots_txt),
|
||||||
|
django.urls.path(r'sitemap.xml', OpenBench.seo.sitemap_xml),
|
||||||
|
|
||||||
# Links for account management
|
# Links for account management
|
||||||
django.urls.path(r'register/', OpenBench.views.register),
|
django.urls.path(r'register/', OpenBench.views.register),
|
||||||
django.urls.path(r'login/', OpenBench.views.login),
|
django.urls.path(r'login/', OpenBench.views.login),
|
||||||
@@ -79,6 +83,7 @@ urlpatterns = [
|
|||||||
django.urls.path(r'clientWorkerInfo/', OpenBench.views.client_worker_info),
|
django.urls.path(r'clientWorkerInfo/', OpenBench.views.client_worker_info),
|
||||||
django.urls.path(r'clientGetWorkload/', OpenBench.views.client_get_workload),
|
django.urls.path(r'clientGetWorkload/', OpenBench.views.client_get_workload),
|
||||||
django.urls.path(r'clientGetNetwork/<str:engine>/<str:name>/', OpenBench.views.client_get_network),
|
django.urls.path(r'clientGetNetwork/<str:engine>/<str:name>/', OpenBench.views.client_get_network),
|
||||||
|
django.urls.path(r'giteaSource/', OpenBench.views.gitea_source),
|
||||||
django.urls.path(r'clientBenchError/', OpenBench.views.client_bench_error),
|
django.urls.path(r'clientBenchError/', OpenBench.views.client_bench_error),
|
||||||
django.urls.path(r'clientSubmitNPS/', OpenBench.views.client_submit_nps),
|
django.urls.path(r'clientSubmitNPS/', OpenBench.views.client_submit_nps),
|
||||||
django.urls.path(r'clientSubmitError/', OpenBench.views.client_submit_error),
|
django.urls.path(r'clientSubmitError/', OpenBench.views.client_submit_error),
|
||||||
|
|||||||
+4
-8
@@ -436,16 +436,12 @@ def branch_is_out_of_date(test):
|
|||||||
if test.dev_engine != test.base_engine:
|
if test.dev_engine != test.base_engine:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Format the request to the Github endpoint
|
import OpenBench.git_hosts
|
||||||
base = 'https://api.github.com/repos/'
|
|
||||||
base = test.dev_repo.replace('github.com', 'api.github.com/repos')
|
|
||||||
url = path_join(base, 'compare', '%s...%s' % (test.dev.sha, test.base.sha))
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Out of date if ahead_by is non-zero
|
# Out of date if the base has commits that the dev branch lacks
|
||||||
headers = read_git_credentials(test.dev_engine)
|
headers = OpenBench.git_hosts.api_headers(test.dev_engine, test.dev_repo)
|
||||||
data = requests.get(url, headers=headers).json()
|
return OpenBench.git_hosts.commits_ahead(test.dev_repo, test.dev.sha, test.base.sha, headers) > 0
|
||||||
return data.get('ahead_by', 0) > 0
|
|
||||||
|
|
||||||
except:
|
except:
|
||||||
# If something went wrong, just ignore it
|
# If something went wrong, just ignore it
|
||||||
|
|||||||
+29
-3
@@ -25,6 +25,7 @@ import django.shortcuts
|
|||||||
import django.contrib.auth
|
import django.contrib.auth
|
||||||
|
|
||||||
import OpenBench.config
|
import OpenBench.config
|
||||||
|
import OpenBench.git_hosts
|
||||||
import OpenBench.utils
|
import OpenBench.utils
|
||||||
import OpenBench.uiutils
|
import OpenBench.uiutils
|
||||||
|
|
||||||
@@ -232,7 +233,10 @@ def profile_config(request):
|
|||||||
|
|
||||||
for (engine, current_repo) in profile.repos.items():
|
for (engine, current_repo) in profile.repos.items():
|
||||||
repo_name = request.POST.get('engine-repo-%s' % (engine), '').removesuffix('/')
|
repo_name = request.POST.get('engine-repo-%s' % (engine), '').removesuffix('/')
|
||||||
repo = 'https://github.com/%s' % (repo_name)
|
repo = repo_name if repo_name.startswith('https://') else 'https://github.com/%s' % (repo_name)
|
||||||
|
|
||||||
|
if repo_name and not OpenBench.git_hosts.is_valid_repo(repo):
|
||||||
|
return redirect(request, '/profile/', error='Repositories must be on Github or a configured Gitea server')
|
||||||
|
|
||||||
if repo != current_repo and repo_name:
|
if repo != current_repo and repo_name:
|
||||||
changes += 'Updated Engine: %s to use %s\n' % (engine, repo)
|
changes += 'Updated Engine: %s to use %s\n' % (engine, repo)
|
||||||
@@ -246,8 +250,8 @@ def profile_config(request):
|
|||||||
|
|
||||||
if engine_name != 'None' and engine_repo:
|
if engine_name != 'None' and engine_repo:
|
||||||
|
|
||||||
if not engine_repo.startswith('https://github.com/'):
|
if not OpenBench.git_hosts.is_valid_repo(engine_repo):
|
||||||
return redirect(request, '/profile/', error='Repositories must be on Github')
|
return redirect(request, '/profile/', error='Repositories must be on Github or a configured Gitea server')
|
||||||
|
|
||||||
if not profile.engine:
|
if not profile.engine:
|
||||||
profile.engine = engine_name
|
profile.engine = engine_name
|
||||||
@@ -802,6 +806,28 @@ def client_worker_info(request):
|
|||||||
# Pass back the Machine Id, and Secret Token for this session
|
# Pass back the Machine Id, and Secret Token for this session
|
||||||
return JsonResponse({ 'machine_id' : machine.id, 'secret' : machine.secret })
|
return JsonResponse({ 'machine_id' : machine.id, 'secret' : machine.secret })
|
||||||
|
|
||||||
|
def gitea_source(request):
|
||||||
|
|
||||||
|
# Workers download sources with a plain GET. The link carries a signature
|
||||||
|
# made at test creation, so only repo/sha pairs this server handed out work.
|
||||||
|
repo = request.GET.get('repo', '')
|
||||||
|
sha = request.GET.get('sha' , '')
|
||||||
|
sig = request.GET.get('sig' , '')
|
||||||
|
|
||||||
|
if not OpenBench.git_hosts.verify_source_request(repo, sha, sig):
|
||||||
|
return django.http.HttpResponseForbidden('Invalid source link')
|
||||||
|
|
||||||
|
try:
|
||||||
|
upstream = OpenBench.git_hosts.open_gitea_archive(repo, sha)
|
||||||
|
except Exception:
|
||||||
|
import traceback; traceback.print_exc()
|
||||||
|
return HttpResponse('Unable to fetch the source archive', status=502)
|
||||||
|
|
||||||
|
owner, name = OpenBench.git_hosts.owner_and_name(repo)
|
||||||
|
response = django.http.StreamingHttpResponse(upstream.iter_content(chunk_size=1 << 16), content_type='application/zip')
|
||||||
|
response['Content-Disposition'] = 'attachment; filename="%s-%s.zip"' % (name, sha[:8])
|
||||||
|
return response
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def client_get_network(request, engine, name):
|
def client_get_network(request, engine, name):
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ import requests
|
|||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
import OpenBench.config
|
import OpenBench.config
|
||||||
|
import OpenBench.git_hosts
|
||||||
import OpenBench.utils
|
import OpenBench.utils
|
||||||
|
|
||||||
from OpenBench.models import *
|
from OpenBench.models import *
|
||||||
@@ -245,9 +246,10 @@ def verify_draw_adj(errors, request, field):
|
|||||||
except: errors.append('Invalid Draw Adjudication Setting. Try "None"?')
|
except: errors.append('Invalid Draw Adjudication Setting. Try "None"?')
|
||||||
|
|
||||||
def verify_github_repo(errors, request, field):
|
def verify_github_repo(errors, request, field):
|
||||||
pattern = r'^https:\/\/github\.com\/[A-Za-z0-9-]+\/[A-Za-z0-9_.-]+\/?$'
|
try: assert OpenBench.git_hosts.is_valid_repo(request.POST[field])
|
||||||
try: assert re.match(pattern, request.POST[field])
|
except:
|
||||||
except: errors.append('Sources must be found on https://github.com/<User>/<Repo>')
|
hosts = ', '.join('%s<User>/<Repo>' % (prefix) for prefix in OpenBench.git_hosts.repo_prefixes())
|
||||||
|
errors.append('Sources must be found on %s' % (hosts))
|
||||||
|
|
||||||
def verify_network(errors, request, field, field_name, engine_field):
|
def verify_network(errors, request, field, field_name, engine_field):
|
||||||
try:
|
try:
|
||||||
@@ -353,19 +355,26 @@ def collect_github_info(errors, request, field):
|
|||||||
|
|
||||||
# Get branch name / commit sha / tag, and the API path for it
|
# Get branch name / commit sha / tag, and the API path for it
|
||||||
branch = request.POST['{0}_branch'.format(field)]
|
branch = request.POST['{0}_branch'.format(field)]
|
||||||
bysha = bool(re.search('^[0-9a-fA-F]{40}$', branch))
|
|
||||||
|
|
||||||
# All API requests will share this common path. Some engines are private.
|
# All API requests will share this common path. Some engines are private.
|
||||||
base = request.POST['%s_repo' % (field)].replace('github.com', 'api.github.com/repos')
|
repo = request.POST['%s_repo' % (field)]
|
||||||
|
base = OpenBench.git_hosts.api_base(repo)
|
||||||
engine = request.POST['%s_engine' % (field)]
|
engine = request.POST['%s_engine' % (field)]
|
||||||
private = OpenBench.config.OPENBENCH_CONFIG['engines'][engine]['private']
|
private = OpenBench.config.OPENBENCH_CONFIG['engines'][engine]['private']
|
||||||
|
gitea = OpenBench.git_hosts.is_gitea(repo)
|
||||||
headers = {}
|
headers = {}
|
||||||
|
|
||||||
## Step 1: Verify the target of the API requests
|
## Step 1: Verify the target of the API requests
|
||||||
## [A] We will not attempt to reach any site other than api.github.com
|
## [A] We will not attempt to reach any site other than api.github.com,
|
||||||
|
## or a Gitea server listed under "gitea_hosts" in the config
|
||||||
## [B] Private engines may only use their main repo for sources of tests
|
## [B] Private engines may only use their main repo for sources of tests
|
||||||
## [C] Determine which, if any, credentials we want to pass along
|
## [C] Determine which, if any, credentials we want to pass along
|
||||||
|
|
||||||
|
# Private engines rely on Github Actions artifacts, which Gitea does not offer
|
||||||
|
if private and gitea:
|
||||||
|
errors.append('Private engines must be hosted on Github')
|
||||||
|
return (None, None)
|
||||||
|
|
||||||
# Private engines must have a token stored in credentials.enginename
|
# Private engines must have a token stored in credentials.enginename
|
||||||
if private and not (headers := OpenBench.utils.read_git_credentials(engine)):
|
if private and not (headers := OpenBench.utils.read_git_credentials(engine)):
|
||||||
errors.append('Server does not have access tokens for this engine')
|
errors.append('Server does not have access tokens for this engine')
|
||||||
@@ -377,59 +386,51 @@ def collect_github_info(errors, request, field):
|
|||||||
return (None, None)
|
return (None, None)
|
||||||
|
|
||||||
# Avoid leaking our credentials to other websites
|
# Avoid leaking our credentials to other websites
|
||||||
if not base.startswith('https://api.github.com/'):
|
if not OpenBench.git_hosts.is_valid_repo(repo):
|
||||||
errors.append('OpenBench may only reach Github\'s API')
|
errors.append('OpenBench may only reach Github\'s API or a configured Gitea server')
|
||||||
return (None, None)
|
return (None, None)
|
||||||
|
|
||||||
## Step 2: Connect to the Github API for the given Branch or Commit SHA.
|
# Gitea servers get their own token if there is one, and nothing else.
|
||||||
|
# Without a token the repository has to be readable anonymously.
|
||||||
|
if gitea:
|
||||||
|
headers = OpenBench.git_hosts.gitea_headers()
|
||||||
|
|
||||||
|
## Step 2: Connect to the Github or Gitea API for the given Branch or Commit SHA.
|
||||||
## [A] We will attempt to parse the most recent commit message for a
|
## [A] We will attempt to parse the most recent commit message for a
|
||||||
## bench, unless one was supplied.
|
## bench, unless one was supplied.
|
||||||
## [B] We will translate any branch name into a commit SHA for later use,
|
## [B] We will translate any branch name into a commit SHA for later use,
|
||||||
## so we may compare branches and generate diff URLs
|
## so we may compare branches and generate diff URLs
|
||||||
## [C] If the engine is public, we will construct the URL to download the
|
## [C] If the engine is public, we will construct the URL to download the
|
||||||
## source code from Github into a .zip file.
|
## source code into a .zip file. Gitea sources go through this server.
|
||||||
## [D] If the engine is private, we will carry onto Step 3.
|
## [D] If the engine is private, we will carry onto Step 3.
|
||||||
|
|
||||||
try: # Fetch data from the Github API
|
try: # Resolve the branch, tag, or commit sha
|
||||||
|
commit = OpenBench.git_hosts.fetch_commit(repo, branch, headers)
|
||||||
# Lookup branch or commit sha, but will fail for tags
|
assert commit['message'] is not None and commit['sha']
|
||||||
url = OpenBench.utils.path_join(base, 'commits' if bysha else 'branches', branch)
|
assert private or commit['tree']
|
||||||
data = requests.get(url, headers=headers).json()
|
|
||||||
|
|
||||||
# Check to see if the branch name was actually a tag name
|
|
||||||
if not bysha and 'commit' not in data:
|
|
||||||
url = OpenBench.utils.path_join(base, 'commits', branch)
|
|
||||||
data = requests.get(url, headers=headers).json()
|
|
||||||
|
|
||||||
# Actual branches have to go one layer deeper
|
|
||||||
elif not bysha: data = data['commit']
|
|
||||||
|
|
||||||
# Check that all the data we need going forward is present
|
|
||||||
assert 'message' in data['commit'] and 'sha' in data
|
|
||||||
assert private or 'sha' in data['commit']['tree']
|
|
||||||
|
|
||||||
except: # Unable to find for whatever reason
|
except: # Unable to find for whatever reason
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
errors.append('%s could not be found' % (branch or 'Branch'))
|
hint = ' (no Gitea token on the server, so the repository must be public)' if gitea and not headers else ''
|
||||||
|
errors.append('%s could not be found%s' % (branch or 'Branch', hint))
|
||||||
return (None, None)
|
return (None, None)
|
||||||
|
|
||||||
# Extract the bench from the web form, or from the commit message
|
# Extract the bench from the web form, or from the commit message
|
||||||
if not (bench := determine_bench(request, field, data['commit']['message'])):
|
if not (bench := determine_bench(request, field, commit['message'])):
|
||||||
errors.append('Unable to parse a Bench for %s' % (branch))
|
errors.append('Unable to parse a Bench for %s' % (branch))
|
||||||
return (None, None)
|
return (None, None)
|
||||||
|
|
||||||
# Public Engines: Construct the .zip download and return everything
|
# Public Engines: Construct the .zip download and return everything
|
||||||
if not private:
|
if not private:
|
||||||
treeurl = data['commit']['tree']['sha'] + '.zip'
|
source = OpenBench.git_hosts.source_url(request, repo, commit)
|
||||||
source = OpenBench.utils.path_join(request.POST['%s_repo' % (field)], 'archive', treeurl)
|
return (source, branch, commit['sha'], bench), True
|
||||||
return (source, branch, data['sha'], bench), True
|
|
||||||
|
|
||||||
## Step 3: Construct the URL for the API request to list all Artifacts
|
## Step 3: Construct the URL for the API request to list all Artifacts
|
||||||
## [A] OpenBench artifacts are always run via a file named openbench.yml
|
## [A] OpenBench artifacts are always run via a file named openbench.yml
|
||||||
## [B] These should contain combinations for windows/linux, avx2/avx512, popcnt/pext
|
## [B] These should contain combinations for windows/linux, avx2/avx512, popcnt/pext
|
||||||
## [C] If those artifacts are not found, we flag the test as awaiting, and try later.
|
## [C] If those artifacts are not found, we flag the test as awaiting, and try later.
|
||||||
|
|
||||||
url, has_all = fetch_artifact_url(base, engine, headers, data['sha'])
|
url, has_all = fetch_artifact_url(base, engine, headers, commit['sha'])
|
||||||
return (url, branch, data['sha'], bench), has_all
|
return (url, branch, data['sha'], bench), has_all
|
||||||
|
|
||||||
def requests_illegal_fork(request, field):
|
def requests_illegal_fork(request, field):
|
||||||
|
|||||||
@@ -27,7 +27,21 @@
|
|||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
|
||||||
|
|
||||||
<title>RektBench</title>
|
<title>{% block title %}RektBench - Distributed SPRT Testing for Chess Engines{% endblock %}</title>
|
||||||
|
<meta name="description" content="{% block description %}RektBench is a distributed SPRT testing framework for chess engines: live tests, results, networks and worker machines.{% endblock %}">
|
||||||
|
<meta name="robots" content="{% block robots %}index, follow{% endblock %}">
|
||||||
|
<link rel="canonical" href="{{ request.scheme }}://{{ request.get_host }}{{ request.path }}">
|
||||||
|
|
||||||
|
<meta property="og:site_name" content="RektBench">
|
||||||
|
<meta property="og:type" content="website">
|
||||||
|
<meta property="og:title" content="RektBench">
|
||||||
|
<meta property="og:description" content="Distributed SPRT testing framework for chess engines.">
|
||||||
|
<meta property="og:url" content="{{ request.scheme }}://{{ request.get_host }}{{ request.path }}">
|
||||||
|
<meta name="twitter:card" content="summary">
|
||||||
|
|
||||||
|
<script type="application/ld+json">
|
||||||
|
{"@context": "https://schema.org", "@type": "WebSite", "name": "RektBench", "alternateName": "Rekt Bench", "url": "{{ request.scheme }}://{{ request.get_host }}/"}
|
||||||
|
</script>
|
||||||
|
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -15,8 +15,8 @@
|
|||||||
document.addEventListener(
|
document.addEventListener(
|
||||||
'DOMContentLoaded', function () {
|
'DOMContentLoaded', function () {
|
||||||
change_engine('{{ profile.engine }}', 'dev', '{{workload}}');
|
change_engine('{{ profile.engine }}', 'dev', '{{workload}}');
|
||||||
enforce_default_text('dev_repo', 'https://github.com/');
|
enforce_default_text('dev_repo', ['https://github.com/'{% for host in config.gitea_hosts %}, '{{host}}/'{% endfor %}]);
|
||||||
enforce_default_text('base_repo', 'https://github.com/');
|
enforce_default_text('base_repo', ['https://github.com/'{% for host in config.gitea_hosts %}, '{{host}}/'{% endfor %}]);
|
||||||
}, false
|
}, false
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<script src="{% static 'default_text.js' %}?{{ static_version }}"></script>
|
<script src="{% static 'default_text.js' %}?{{ static_version }}"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
enforce_default_text('new-engine-repo', 'https://github.com/');
|
enforce_default_text('new-engine-repo', ['https://github.com/'{% for host in config.gitea_hosts %}, '{{host}}/'{% endfor %}]);
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user