summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yml17
-rw-r--r--tools/upload_wptfyi.js60
2 files changed, 76 insertions, 1 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index b86d54d68..b64b45ef6 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -308,6 +308,7 @@ jobs:
run: |
deno run --unstable --allow-write --allow-read --allow-net --allow-env --allow-run ./tools/wpt.ts setup
deno run --unstable --allow-write --allow-read --allow-net --allow-env --allow-run ./tools/wpt.ts run --quiet --release --json=wpt.json --wptreport=wptreport.json
+ gzip ./wptreport.json
- name: Upload wpt results to dl.deno.land
if: |
@@ -318,10 +319,24 @@ jobs:
github.ref == 'refs/heads/main'
run: |
gsutil cp ./wpt.json gs://dl.deno.land/wpt/$(git rev-parse HEAD).json
- gsutil cp ./wptreport.json gs://dl.deno.land/wpt/$(git rev-parse HEAD)-wptreport.json
+ gsutil cp ./wptreport.json.gz gs://dl.deno.land/wpt/$(git rev-parse HEAD)-wptreport.json.gz
echo $(git rev-parse HEAD) > wpt-latest.txt
gsutil cp wpt-latest.txt gs://dl.deno.land/wpt-latest.txt
+ - name: Upload wpt results to wpt.fyi
+ if: |
+ runner.os == 'Linux' &&
+ matrix.kind == 'test' &&
+ matrix.profile == 'release' &&
+ github.repository == 'denoland/deno' &&
+ github.ref == 'refs/heads/main'
+ env:
+ WPT_FYI_STAGING_USER: ${{ secrets.WPT_FYI_STAGING_USER }}
+ WPT_FYI_STAGING_PW: ${{ secrets.WPT_FYI_STAGING_PW }}
+ GITHUB_TOKEN: ${{ secrets.DENOBOT_PAT }}
+ run: |
+ deno run -A ./tools/upload_wptfyi.js $(git rev-parse HEAD) --ghstatus
+
- name: Run web platform tests (debug)
if: startsWith(matrix.os, 'ubuntu') && matrix.kind == 'test' && matrix.profile == 'debug'
run: |
diff --git a/tools/upload_wptfyi.js b/tools/upload_wptfyi.js
new file mode 100644
index 000000000..2eb4dcefa
--- /dev/null
+++ b/tools/upload_wptfyi.js
@@ -0,0 +1,60 @@
+// This script pushes new WPT results to wpt.fyi. When the `--ghstatus` flag is
+// passed, will automatically add a status check to the commit with a link to
+// the wpt.fyi page.
+
+const user = Deno.env.get("WPT_FYI_STAGING_USER");
+const password = Deno.env.get("WPT_FYI_STAGING_PW");
+
+const commit = Deno.args[0];
+
+const form = new FormData();
+form.set("labels", "experimental");
+form.set("result_url", `https://dl.deno.land/wpt/${commit}-wptreport.json.gz`);
+
+const basicAuthToken = btoa(`${user}:${password}`);
+
+const resp = await fetch("https://staging.wpt.fyi/api/results/upload", {
+ method: "POST",
+ body: form,
+ headers: {
+ authorization: `Basic ${basicAuthToken}`,
+ },
+});
+
+console.log(resp.status);
+console.log(resp.headers);
+const body = await resp.text();
+console.log(body);
+
+if (!resp.ok) {
+ Deno.exit(1);
+}
+
+if (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 resp = await fetch(
+ `https://api.github.com/repos/denoland/deno/statuses/${commit}`,
+ {
+ method: "POST",
+ body: JSON.stringify({
+ state: "success",
+ target_url: url,
+ context: "wpt.fyi",
+ description: "View WPT results on wpt.fyi",
+ }),
+ headers: {
+ authorization: `Bearer ${githubToken}`,
+ },
+ },
+ );
+ console.log(resp.status);
+ console.log(resp.headers);
+ const body2 = await resp.text();
+ console.log(body2);
+
+ if (!resp.ok) {
+ Deno.exit(1);
+ }
+}