summaryrefslogtreecommitdiff
path: root/tools/upload_wptfyi.js
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2021-06-14 13:48:57 +0200
committerGitHub <noreply@github.com>2021-06-14 13:48:57 +0200
commitd837445e44c9ed5c29901813d73818f84e97b294 (patch)
treeda40539191c48bee852b7b500f070558db00307e /tools/upload_wptfyi.js
parenta6f1edd9533ae52f6d7c4841c395a34021dbdb71 (diff)
build: add wpt epoch/daily run (#10937)
This adds a daily scheduled CI pipeline that runs WPT tests against the most recent epochs/daily every night. Results are uploaded to wpt.fyi. WPTs are run on all supported platforms, on both stable and canary.
Diffstat (limited to 'tools/upload_wptfyi.js')
-rw-r--r--tools/upload_wptfyi.js23
1 files changed, 19 insertions, 4 deletions
diff --git a/tools/upload_wptfyi.js b/tools/upload_wptfyi.js
index 2eb4dcefa..862523167 100644
--- a/tools/upload_wptfyi.js
+++ b/tools/upload_wptfyi.js
@@ -2,14 +2,28 @@
// passed, will automatically add a status check to the commit with a link to
// the wpt.fyi page.
+import { gzip } from "https://deno.land/x/compress@v0.3.8/gzip/mod.ts";
+
const user = Deno.env.get("WPT_FYI_STAGING_USER");
const password = Deno.env.get("WPT_FYI_STAGING_PW");
-const commit = Deno.args[0];
+const fromRawFile = Deno.args.includes("--from-raw-file");
const form = new FormData();
-form.set("labels", "experimental");
-form.set("result_url", `https://dl.deno.land/wpt/${commit}-wptreport.json.gz`);
+form.set("labels", "master,actions");
+
+if (fromRawFile) {
+ const file = Deno.args[0];
+ const raw = Deno.readFileSync(file);
+ const gzipped = gzip(raw);
+ form.set("result_file", new Blob([gzipped]));
+} else {
+ const commit = Deno.args[0];
+ form.set(
+ "result_url",
+ `https://dl.deno.land/wpt/${commit}-wptreport.json.gz`,
+ );
+}
const basicAuthToken = btoa(`${user}:${password}`);
@@ -30,10 +44,11 @@ if (!resp.ok) {
Deno.exit(1);
}
-if (Deno.args.includes("--ghstatus")) {
+if (!fromRawFile && Deno.args.includes("--ghstatus")) {
const githubToken = Deno.env.get("GITHUB_TOKEN");
const taskId = body.split(" ")[1];
const url = `https://staging.wpt.fyi/results/?run_id=${taskId}`;
+ const commit = Deno.args[0];
const resp = await fetch(
`https://api.github.com/repos/denoland/deno/statuses/${commit}`,
{