summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Casonato <lucacasonato@yahoo.com>2021-06-03 01:12:28 +0200
committerGitHub <noreply@github.com>2021-06-03 01:12:28 +0200
commitb2a4c2e4f650f84a4f22c655a6b504b00fe0f72f (patch)
tree6e2a3dc4629533198c3e3a41e9e1b1fea52c9d75
parentb4ae243da8846d7ba0a5dd63942f90c857b744ca (diff)
build: collect wpt results as json (#10823)
-rw-r--r--.github/workflows/ci.yml14
-rwxr-xr-xtools/wpt.ts18
-rw-r--r--tools/wpt/utils.ts3
3 files changed, 31 insertions, 4 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 406d1bf2e..9826293bd 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -316,7 +316,19 @@ jobs:
if: startsWith(matrix.os, 'ubuntu') && matrix.kind == 'test' && matrix.profile == 'release'
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
+ deno run --unstable --allow-write --allow-read --allow-net --allow-env --allow-run ./tools/wpt.ts run --quiet --release --json=wpt.json
+
+ - name: Upload wpt results to dl.deno.land
+ if: |
+ runner.os == 'Linux' &&
+ matrix.kind == 'test' &&
+ matrix.profile == 'release' &&
+ github.repository == 'denoland/deno' &&
+ github.ref == 'refs/heads/main'
+ run: |
+ gsutil cp ./wpt.json gs://dl.deno.land/wpt/$(git rev-parse HEAD).json
+ echo $(git rev-parse HEAD) > wpt-latest.txt
+ gsutil cp wpt-latest.txt gs://dl.deno.land/wpt-latest.txt
- name: Run web platform tests (debug)
if: startsWith(matrix.os, 'ubuntu') && matrix.kind == 'test' && matrix.profile == 'debug'
diff --git a/tools/wpt.ts b/tools/wpt.ts
index 13f8b6467..203b198d1 100755
--- a/tools/wpt.ts
+++ b/tools/wpt.ts
@@ -165,7 +165,7 @@ async function run() {
const result = await runSingleTest(
test.url,
test.options,
- json ? () => {} : createReportTestCase(test.expectation),
+ createReportTestCase(test.expectation),
);
results.push({ test, result });
reportVariation(result, test.expectation);
@@ -175,7 +175,21 @@ async function run() {
});
if (json) {
- await Deno.writeTextFile(json, JSON.stringify(results));
+ const minifiedResults = [];
+ for (const result of results) {
+ const minified = {
+ file: result.test.path,
+ name:
+ Object.fromEntries(result.test.options.script_metadata ?? []).title ??
+ null,
+ cases: result.result.cases.map((case_) => ({
+ name: case_.name,
+ passed: case_.passed,
+ })),
+ };
+ minifiedResults.push(minified);
+ }
+ await Deno.writeTextFile(json, JSON.stringify(minifiedResults));
}
const code = reportFinal(results);
Deno.exit(code);
diff --git a/tools/wpt/utils.ts b/tools/wpt/utils.ts
index 6d982068b..cb454300b 100644
--- a/tools/wpt/utils.ts
+++ b/tools/wpt/utils.ts
@@ -38,7 +38,8 @@ export type ManifestTestVariation = [
options: ManifestTestOptions,
];
export interface ManifestTestOptions {
- name?: string;
+ // deno-lint-ignore camelcase
+ script_metadata: [string, string][];
}
const MANIFEST_PATH = join(ROOT_PATH, "./tools/wpt/manifest.json");