-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into update-v7
- Loading branch information
Showing
75 changed files
with
1,925 additions
and
283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,48 @@ | ||
name: Argos CI Screenshots | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
paths: | ||
- '**.js' | ||
- '**.json' | ||
- '**.yml' | ||
- '**.yaml' | ||
- '**.css' | ||
branches: [master] | ||
pull_request: | ||
paths: | ||
- '**.js' | ||
- '**.json' | ||
- '**.yml' | ||
- '**.yaml' | ||
- '**.css' | ||
branches: [master] | ||
|
||
|
||
jobs: | ||
take-screenshots: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
- name: Use Node.js 22.x | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: current | ||
node-version: 22.x | ||
|
||
- name: Install dependencies | ||
run: yarn install | ||
run: npm install | ||
|
||
- name: Install Playwright browsers | ||
run: yarn playwright install --with-deps chromium | ||
- name: Install Playwright Browsers | ||
run: npx playwright install --with-deps chromium | ||
|
||
- name: Build the website | ||
run: yarn docusaurus build | ||
run: npm run build | ||
|
||
- name: Take screenshots with Playwright | ||
run: yarn playwright test | ||
run: npx playwright test | ||
|
||
- name: Upload screenshots to Argos | ||
env: | ||
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }} | ||
run: yarn argos upload ./screenshots | ||
run: npx argos upload ./screenshots |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const cheerio = require("cheerio"); | ||
const fs = require("fs"); | ||
|
||
function extractSitemapPathnames(sitemapPath) { | ||
const sitemap = fs.readFileSync(sitemapPath).toString(); | ||
const $ = cheerio.load(sitemap, { xmlMode: true }); | ||
const urls = []; | ||
$("loc").each(function handleLoc() { | ||
urls.push($(this).text()); | ||
}); | ||
return urls.map((url) => new URL(url).pathname); | ||
} | ||
|
||
// Converts a pathname to a decent screenshot name | ||
function pathnameToArgosName(pathname) { | ||
return pathname.replace(/^\/|\/$/g, "") || "index"; | ||
} | ||
|
||
module.exports = { | ||
extractSitemapPathnames, | ||
pathnameToArgosName, | ||
}; |
Oops, something went wrong.