Consolidate Docs #3013
Workflow file for this run
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
name: Playwright Tests | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
permissions: | |
contents: read | |
jobs: | |
playwright: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@v2 | |
with: | |
egress-policy: audit | |
- name: Remove all fonts | |
run: rm -rf /usr/share/fonts | |
- uses: actions/checkout@v4 | |
- name: Install CJK fonts | |
uses: awalsh128/cache-apt-pkgs-action@a6c3917cc929dd0345bfb2d3feaf9101823370ad # v1.4.2 | |
with: | |
packages: fonts-ipafont-mincho | |
execute_install_scripts: true | |
- uses: actions/setup-node@v4 | |
with: | |
cache: "npm" | |
node-version-file: "package.json" | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Cache playwright browsers | |
id: cache-playwright | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/ms-playwright | |
key: cache-playwright-${{ hashFiles('package-lock.json') }} # playwright version is included in package-lock, so this serves as a reasonable cache key | |
- if: ${{ steps.cache-playwright.outputs.cache-hit != 'true' }} | |
name: Install Playwright Browsers | |
run: npx playwright install chromium | |
- name: Grab latest dictionaries from dictionaries branch | |
uses: actions/checkout@v4 | |
with: | |
repository: yomidevs/yomitan # so that this works on forks | |
ref: dictionaries | |
path: dictionaries | |
- name: Grab latest screenshots from master branch | |
uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # pin@v2 | |
continue-on-error: true | |
id: master-screenshots | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
repo: yomidevs/yomitan # so that this works on forks | |
name: playwright-screenshots | |
branch: master | |
workflow: playwright.yml | |
workflow_conclusion: success | |
path: test/playwright/__screenshots__/ | |
- name: "[PR] Generate new screenshots & compare against master" | |
id: playwright | |
run: | | |
npx playwright test 2>&1 | tee ./playwright-output || true | |
continue-on-error: true | |
if: github.event_name == 'pull_request' && steps.master-screenshots.outcome != 'failure' | |
- name: "[Push] Generate new authoritative screenshots for master" | |
id: playwright-master | |
run: npx playwright test -u | |
if: github.event_name == 'push' | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: playwright-screenshots | |
path: test/playwright/__screenshots__/ | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
- name: "[PR] Store steps.master-screenshots.outcome in a file" | |
run: echo ${{ steps.master-screenshots.outcome }} > ./master-screenshots-outcome | |
if: github.event_name == 'pull_request' | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: master-screenshots-outcome | |
path: master-screenshots-outcome | |
if: github.event_name == 'pull_request' | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: playwright-output | |
path: playwright-output | |
if: github.event_name == 'pull_request' |