1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-03 12:58:54 -05:00

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.
This commit is contained in:
Luca Casonato 2021-06-14 13:48:57 +02:00 committed by GitHub
parent a6f1edd953
commit d837445e44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 99 additions and 13 deletions

69
.github/workflows/wpt_epoch.yml vendored Normal file
View file

@ -0,0 +1,69 @@
# This CI job runs every night and tests all versions of Deno (canary and latest
# stable) across all OSes we support against the `epochs/daily` branch of WPT.
name: wpt_epoch
on:
schedule:
# Every night at 0:30 UTC. This is 20 minutes after `epochs/daily` branch is
# triggered to be created in WPT repo.
- cron: 30 0 * * *
workflow_dispatch:
jobs:
wpt:
name: wpt / ${{ matrix.os }} / ${{ matrix.deno-version }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
deno-version: [v1.x, canary]
os: [macOS-latest, ubuntu-latest-xl, windows-2019]
steps:
- name: Clone repository
uses: actions/checkout@v2
with:
submodules: true
persist-credentials: false
- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: ${{ matrix.deno-version }}
- name: Install Python
uses: actions/setup-python@v1
with:
python-version: "3.8"
architecture: x64
- name: Log versions
run: |
python --version
deno --version
- name: Switch WPT submodule to epochs/daily
working-directory: test_util/wpt/
run: git reset origin/epochs/daily --hard
- name: Configure hosts file for WPT (unix)
if: runner.os != 'Windows'
working-directory: test_util/wpt/
run: ./wpt make-hosts-file | sudo tee -a /etc/hosts
- name: Configure hosts file for WPT (windows)
if: runner.os == 'Windows'
working-directory: test_util/wpt/
run: python wpt make-hosts-file | Out-File $env:SystemRoot\System32\drivers\etc\hosts -Encoding ascii -Append
- name: Run web platform tests
shell: bash
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 --binary=(which deno) --quiet --release --json=wpt.json --wptreport=wptreport.json || true
- name: Upload wpt results to wpt.fyi
run: |
deno run -A ./tools/upload_wptfyi.js wptreport.json --from-raw-file

View file

@ -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}`,
{

View file

@ -1,6 +1,6 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
import { delay, join, readLines, ROOT_PATH, toFileUrl } from "../util.js";
import { assert, ManifestTestOptions, release, runPy } from "./utils.ts";
import { assert, denoBinary, ManifestTestOptions, runPy } from "./utils.ts";
import { DOMParser } from "https://deno.land/x/deno_dom@v0.1.3-alpha2/deno-dom-wasm.ts";
export async function runWithTestUtil<T>(
@ -88,7 +88,7 @@ export async function runSingleTest(
const proc = Deno.run({
cmd: [
join(ROOT_PATH, `./target/${release ? "release" : "debug"}/deno`),
denoBinary(),
"run",
"-A",
"--unstable",

View file

@ -12,13 +12,19 @@ export const {
rebuild,
["--"]: rest,
["auto-config"]: autoConfig,
binary,
} = parse(Deno.args, {
"--": true,
boolean: ["quiet", "release", "no-interactive"],
string: ["json", "wptreport"],
string: ["json", "wptreport", "binary"],
});
/// PAGE ROOT
export function denoBinary() {
if (binary) {
return binary;
}
return join(ROOT_PATH, `./target/${release ? "release" : "debug"}/deno`);
}
/// WPT TEST MANIFEST
@ -164,11 +170,7 @@ export async function generateRunInfo(): Promise<unknown> {
const revision = (new TextDecoder().decode(await proc.output())).trim();
proc.close();
const proc2 = Deno.run({
cmd: [
join(ROOT_PATH, `./target/${release ? "release" : "debug"}/deno`),
"eval",
"console.log(JSON.stringify(Deno.version))",
],
cmd: [denoBinary(), "eval", "console.log(JSON.stringify(Deno.version))"],
cwd: join(ROOT_PATH, "test_util", "wpt"),
stdout: "piped",
});