Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infrastructure: Automatically update coverage and quality report on merge #2122

Merged
merged 5 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
24 changes: 24 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ on:
- ".github/workflows/examples.yml"
- "content/**/examples/**"
- "scripts/reference-tables.*"
- "scripts/coverage-report.*"
- "coverage/**"
pull_request:
paths:
- "package*.json"
- ".github/workflows/examples.yml"
- "content/**/examples/**"
- "scripts/reference-tables.*"
- "scripts/coverage-report.*"
- "coverage/**"

jobs:
examples:
Expand All @@ -36,3 +40,23 @@ jobs:

- name: Ensure no git changes
run: git diff --exit-code

coverage:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
cache: npm

- name: Install dependencies
run: npm ci

- name: Generate coverage files
run: npm run coverage-report

- name: Ensure no git changes
run: git diff --exit-code
597 changes: 322 additions & 275 deletions content/about/coverage-and-quality/coverage-and-quality-report.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content/about/coverage-and-quality/prop-coverage.csv
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"aria-flowto","0","0"
"aria-grabbed","0","0"
"aria-haspopup","0","9","Example: Date Picker Combobox","Example: Editable Combobox with Grid Popup","Example: (Deprecated) Collapsible Dropdown Listbox","Example: Actions Menu Button Using aria-activedescendant","Example: Actions Menu Button Using element.focus()","Example: Navigation Menu Button","Example: Editor Menubar","Example: Navigation Menubar","Example: Toolbar"
"aria-hidden","0","13","Example: Button (IDL Version)","Example: Editor Menubar","Example: Horizontal Multi-Thumb Slider","Example: Color Viewer Slider","Example: Rating Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider","Example: Date Picker Spin Button","Example: Switch Using HTML Button","Example: Switch Using HTML Checkbox Input","Example: Switch","Example: Sortable Table","Example: Toolbar"
"aria-hidden","0","16","Example: Button (IDL Version)","Example: Listbox with Grouped Options","Example: Listboxes with Rearrangeable Options","Example: Scrollable Listbox","Example: Editor Menubar","Example: Horizontal Multi-Thumb Slider","Example: Color Viewer Slider","Example: Rating Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider","Example: Date Picker Spin Button","Example: Switch Using HTML Button","Example: Switch Using HTML Checkbox Input","Example: Switch","Example: Sortable Table","Example: Toolbar"
"aria-invalid","0","0"
"aria-keyshortcuts","0","0"
"aria-label","1","18","Guidance: Naming with a String Attribute Via aria-label","Example: Breadcrumb","Example: Auto-Rotating Image Carousel with Buttons for Slide Control","Example: Auto-Rotating Image Carousel with Tabs for Slide Control","Example: Editable Combobox With Both List and Inline Autocomplete","Example: Editable Combobox With List Autocomplete","Example: Editable Combobox without Autocomplete","Example: Date Picker Combobox","Example: Date Picker Dialog","Example: Link","Example: Editor Menubar","Example: Navigation Menubar","Example: Rating Radio Group","Example: Horizontal Multi-Thumb Slider","Example: Date Picker Spin Button","Example: Table","Example: Toolbar","Example: Treegrid Email Inbox","Example: Navigation Treeview"
Expand Down
2 changes: 1 addition & 1 deletion content/about/coverage-and-quality/role-coverage.csv
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"meter","2","1","Guidance: Meter Pattern","Guidance: Range properties with meter","Example: Meter"
"navigation","5","3","Guidance: Fundamental Keyboard Navigation Conventions","Guidance: Keyboard Navigation Between Components (The Tab Sequence)","Guidance: Keyboard Navigation Inside Components","Guidance: Ensure Basic Access Via Navigation","Guidance: Navigation","Example: Navigation Menubar","Example: Navigation Treeview","Example: Navigation Landmark"
"none","0","7","Example: Navigation Menu Button","Example: Navigation Menubar","Example: Rating Radio Group","Example: Horizontal Multi-Thumb Slider","Example: Media Seek Slider","Example: Vertical Temperature Slider","Example: Navigation Treeview"
"note","0","0"
"note","37","0","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note","Guidance: Note"
"option","0","8","Example: Editable Combobox With Both List and Inline Autocomplete","Example: Editable Combobox With List Autocomplete","Example: Editable Combobox without Autocomplete","Example: Select-Only Combobox","Example: (Deprecated) Collapsible Dropdown Listbox","Example: Listbox with Grouped Options","Example: Listboxes with Rearrangeable Options","Example: Scrollable Listbox"
"paragraph","0","0"
"presentation","5","0","Guidance: Hiding Semantics with the presentation Role","Guidance: Common Uses of Role presentation","Guidance: Effects of Role presentation","Guidance: Conditions That Cause Role presentation to be Ignored","Guidance: Example Demonstrating Effects of the presentation Role"
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"lint:html": "npm run htmlhint && npm run vnu-jar",
"lint:spelling": "cspell \"**/*.*\"",
"link-checker": "node ./scripts/link-checker.js",
"coverage-report": "node scripts/coverage-report.js",
"reference-tables": "node scripts/reference-tables.js",
"regression": "ava --timeout=1m",
"regression-report": "node test/util/report",
Expand Down Expand Up @@ -68,7 +69,9 @@
],
"content/patterns/**/examples/*.html": [
"npm run reference-tables",
"git add content/index/index.html"
"git add content/index/index.html",
"npm run coverage-report",
"git add coverage/"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@howard-e are these explicit git add still ok with the new lint-staged?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those should be fine

]
},
"ava": {
Expand Down
14 changes: 14 additions & 0 deletions scripts/coverage-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -1138,12 +1138,26 @@ $('#example_summary_prototype').html(countPrototype);
$('#example_summary_mouse').html(countMouse);
$('#example_summary_pointer').html(countPointer);

// Create a new Date object
var currentDate = new Date();

// Format the date as a string
const formattedDate = currentDate.toLocaleDateString('en-US', {
day: 'numeric',
month: 'long',
year: 'numeric',
});

// cheerio seems to fold the doctype lines despite the template
const result = $.html()
.replace('<!DOCTYPE html>', '<!DOCTYPE html>\n')
.replace(
'<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">',
'<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">\n'
)
.replace(
'<p>Page last updated: </p>',
`<p> Page last updated: ${formattedDate}</p>`
ariellalgilmore marked this conversation as resolved.
Show resolved Hide resolved
);

fs.writeFile(coverageReportPath, result, function (err) {
Expand Down
1 change: 1 addition & 0 deletions scripts/coverage-report.template
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<body>
<main>
<h1>Coverage and Quality Reports</h1>
<p>Page last updated: </p>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As shown on the landed commit, adding a stamp will continually fail the diff, except for things landed on the same day as the last time this was updated

<section>
<h2>About These Reports</h2>
<p>
Expand Down
Loading