Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/update-wpt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# web-platform-tests/wpt is too large to reasonably include as a
# submodule, so we vendor just a small part of it and keep it updated
# here.

name: Update web-platform-tests

on:
schedule:
- cron: 5 3 * * *
workflow_dispatch:

jobs:
update-wpt:
runs-on: ubuntu-slim

permissions:
contents: write
pull-requests: write

steps:
- uses: actions/checkout@v7
- id: update
run: |
sha="$(gh api 'repos/web-platform-tests/wpt/commits?path=html/syntax/parsing/resources&per_page=1' | jq -r .[0].sha)"
echo "sha=$sha" >>"$GITHUB_OUTPUT"
if ! grep -Fxq "$sha" rcdom/data/test/wpt-commit.txt; then
git fetch --depth=1 https://github.com/web-platform-tests/wpt.git "$sha"
rm -r rcdom/wpt-tree-construction-tests
mkdir rcdom/wpt-tree-construction-tests
git cat-file blob FETCH_HEAD:LICENSE.md >rcdom/wpt-tree-construction-tests/LICENSE.md
git archive FETCH_HEAD:html/syntax/parsing/resources | tar -C rcdom/wpt-tree-construction-tests -x
echo "$sha" >rcdom/data/test/wpt-commit.txt
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: |
Update tree construction tests from web-platform-tests/wpt

https://github.com/web-platform-tests/wpt/commits/${{ steps.update.outputs.sha }}/html/syntax/parsing/resources
branch: update-wpt
title: Update tree construction tests from web-platform-tests/wpt
body: |
https://github.com/web-platform-tests/wpt/commits/${{ steps.update.outputs.sha }}/html/syntax/parsing/resources
1 change: 1 addition & 0 deletions rcdom/data/test/wpt-commit.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
31d1feb70e2d02f25ae26254caba19c8de0b56e0
10 changes: 9 additions & 1 deletion rcdom/tests/html-tree-builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,17 @@ fn tests(src_dir: &Path, ignores: &HashSet<String>) -> Vec<Test> {

foreach_html5lib_test(
src_dir,
"html5lib-tests/tree-construction",
"wpt-tree-construction-tests",
OsStr::new("dat"),
|path, file| {
if path
.file_name()
.is_some_and(|name| name.to_string_lossy().starts_with("scripted_"))
{
// Skip tests that require running JavaScript.
return;
}

let buf = io::BufReader::new(file);
let lines = buf.lines().map(|res| res.expect("couldn't read"));
let data = parse_tests(lines);
Expand Down
11 changes: 11 additions & 0 deletions rcdom/wpt-tree-construction-tests/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# The 3-Clause BSD License

Copyright © web-platform-tests contributors

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Loading
Loading