From f48d66b2b01fef0f16beb35a66f1b4d5771e3b6e Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Mon, 14 Jun 2021 20:57:02 +0200 Subject: [PATCH] tests: fix wpt epoch ci job (#10960) --- .github/workflows/wpt_epoch.yml | 14 +++++++++++--- .gitignore | 4 ++++ .gitmodules | 7 +++---- test_util/wpt | 2 +- tools/wpt.ts | 16 ++++++++-------- tools/wpt/certs/index.txt | 0 tools/wpt/certs/serial | 1 - tools/wpt/config.json | 7 +------ tools/wpt/utils.ts | 1 + 9 files changed, 29 insertions(+), 23 deletions(-) delete mode 100644 tools/wpt/certs/index.txt delete mode 100644 tools/wpt/certs/serial diff --git a/.github/workflows/wpt_epoch.yml b/.github/workflows/wpt_epoch.yml index 992d69d00c..84743c568b 100644 --- a/.github/workflows/wpt_epoch.yml +++ b/.github/workflows/wpt_epoch.yml @@ -19,7 +19,7 @@ jobs: fail-fast: false matrix: deno-version: [v1.x, canary] - os: [macOS-latest, ubuntu-latest-xl, windows-2019] + os: [ubuntu-latest-xl] steps: - name: Clone repository @@ -46,7 +46,12 @@ jobs: - name: Switch WPT submodule to epochs/daily working-directory: test_util/wpt/ - run: git reset origin/epochs/daily --hard + shell: bash + run: | + git remote set-branches origin '*' + git fetch origin + git checkout origin/epochs/daily + git checkout -b epochs/daily - name: Configure hosts file for WPT (unix) if: runner.os != 'Windows' @@ -62,8 +67,11 @@ jobs: 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 + 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 + env: + WPT_FYI_STAGING_USER: ${{ secrets.WPT_FYI_STAGING_USER }} + WPT_FYI_STAGING_PW: ${{ secrets.WPT_FYI_STAGING_PW }} run: | deno run -A ./tools/upload_wptfyi.js wptreport.json --from-raw-file diff --git a/.gitignore b/.gitignore index 0ab773c153..31a0049398 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,7 @@ cli/tests/.test_coverage/ # Flamegraphs /flamebench*.svg /flamegraph*.svg + +# WPT generated cert files +/tools/wpt/certs/index.txt* +/tools/wpt/certs/serial* diff --git a/.gitmodules b/.gitmodules index 8e78a444b3..1967e6cfa5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,11 +2,10 @@ path = third_party url = https://github.com/denoland/deno_third_party.git shallow = true -[submodule "test_util/wpt"] - path = test_util/wpt - url = https://github.com/web-platform-tests/wpt.git - shallow = true [submodule "test_util/std"] path = test_util/std url = https://github.com/denoland/deno_std shallow = true +[submodule "test_util/wpt"] + path = test_util/wpt + url = https://github.com/web-platform-tests/wpt.git diff --git a/test_util/wpt b/test_util/wpt index 146f12e8df..a8e5772a0f 160000 --- a/test_util/wpt +++ b/test_util/wpt @@ -1 +1 @@ -Subproject commit 146f12e8df2cac6b1e60152145124a81dad60d38 +Subproject commit a8e5772a0f1c4d666acc5aee2423c38da7c9a71c diff --git a/tools/wpt.ts b/tools/wpt.ts index 8f82488806..4a4d8cb581 100755 --- a/tools/wpt.ts +++ b/tools/wpt.ts @@ -80,27 +80,27 @@ More details at https://deno.land/manual@main/contributing/web_platform_tests } async function setup() { + const hostsPath = Deno.build.os == "windows" + ? `${Deno.env.get("SystemRoot")}\\System32\\drivers\\etc\\hosts` + : "/etc/hosts"; // TODO(lucacsonato): use this when 1.7.1 is released. // const records = await Deno.resolveDns("web-platform.test", "A"); // const etcHostsConfigured = records[0] == "127.0.0.1"; - const hostsFile = await Deno.readTextFile("/etc/hosts"); + const hostsFile = await Deno.readTextFile(hostsPath); const etcHostsConfigured = hostsFile.includes("web-platform.test"); if (etcHostsConfigured) { - console.log("/etc/hosts is already configured."); + console.log(hostsPath + " is already configured."); } else { const autoConfigure = autoConfig || confirm( - "The WPT require certain entries to be present in your /etc/hosts file. Should these be configured automatically?", + `The WPT require certain entries to be present in your ${hostsPath} file. Should these be configured automatically?`, ); if (autoConfigure) { const proc = runPy(["wpt", "make-hosts-file"], { stdout: "piped" }); const status = await proc.status(); assert(status.success, "wpt make-hosts-file should not fail"); const entries = new TextDecoder().decode(await proc.output()); - const hostsPath = Deno.build.os == "windows" - ? `${Deno.env.get("SystemRoot")}\\System32\\drivers\\etc\\hosts` - : "/etc/hosts"; const file = await Deno.open(hostsPath, { append: true }).catch((err) => { if (err instanceof Deno.errors.PermissionDenied) { throw new Error( @@ -116,9 +116,9 @@ async function setup() { "\n\n# Configured for Web Platform Tests (Deno)\n" + entries, ), ); - console.log("Updated /etc/hosts"); + console.log(`Updated ${hostsPath}`); } else { - console.log("Please configure the /etc/hosts entries manually."); + console.log(`Please configure the ${hostsPath} entries manually.`); if (Deno.build.os == "windows") { console.log("To do this run the following command in PowerShell:"); console.log(""); diff --git a/tools/wpt/certs/index.txt b/tools/wpt/certs/index.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tools/wpt/certs/serial b/tools/wpt/certs/serial deleted file mode 100644 index e457acdd3a..0000000000 --- a/tools/wpt/certs/serial +++ /dev/null @@ -1 +0,0 @@ -026677 \ No newline at end of file diff --git a/tools/wpt/config.json b/tools/wpt/config.json index a27e0d15d2..f146607c16 100644 --- a/tools/wpt/config.json +++ b/tools/wpt/config.json @@ -1,11 +1,6 @@ { "check_subdomains": false, "ssl": { - "type": "openssl", - "openssl": { - "duration": 365, - "force_regenerate": false, - "base_path": "../../tools/wpt/certs" - } + "type": "pregenerated" } } diff --git a/tools/wpt/utils.ts b/tools/wpt/utils.ts index 0eb9a89e70..f1c8488afc 100644 --- a/tools/wpt/utils.ts +++ b/tools/wpt/utils.ts @@ -144,6 +144,7 @@ export async function checkPy3Available() { } export async function cargoBuild() { + if (binary) return; const proc = Deno.run({ cmd: ["cargo", "build", ...(release ? ["--release"] : [])], cwd: ROOT_PATH,