refactor: minor updates to the WordPress plugin #1243
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: Run tests | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
- push | |
- workflow_call | |
jobs: | |
test-suites: | |
runs-on: ubuntu-latest | |
# Stop the occasional rogue instance before the 6h GitHub limit | |
timeout-minutes: 15 | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Use Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install everything | |
run: npm install | |
- name: Always test with the latest browserslist db | |
run: | | |
npx update-browserslist-db@latest | |
- name: Ng test for studio-web | |
run: | | |
npx nx build web-component | |
npx nx test:once studio-web | |
- name: Cypress run for web-component | |
uses: cypress-io/github-action@v6 | |
with: | |
install: false | |
start: | | |
npx nx serve web-component | |
npx nx serve-test-data web-component | |
wait-on: sleep 15 # there is no reliable URL to wait for... | |
command: npx nx test:once web-component | |
- name: Check that i18n and l10n are up to date | |
run: | | |
npx nx extract-i18n studio-web | |
if diff -w <(git show HEAD:packages/studio-web/src/i18n/messages.json | sort) <(sort < packages/studio-web/src/i18n/messages.json); then echo OK: The i18n database is up to date.; else echo ERROR: The i18n database is out of date.; npx nx check-l10n studio-web || echo ERROR: The l10n databases are also out of date.; false; fi | |
if npx nx check-l10n studio-web; then echo OK: The l10n databases are up to date.; else echo ERROR: An l10n database is out of date.; false; fi | |
- name: make sure the WP plugin zip file is in sync | |
run: | | |
cd packages/web-component/wordpress-plugin | |
unzip -d extract read-along-web-app-loader.zip | |
if ! diff --exclude=js -qr read-along-web-app-loader extract/read-along-web-app-loader; then \ | |
echo The zipped WordPress plugin packages/web-component/wordpress-plugin/read-along-web-app-loader.zip is out of date.; \ | |
false; \ | |
fi | |
- name: make sure bundling works | |
shell: bash | |
run: | | |
npx nx bundle web-component | |
git status | |
git diff --word-diff=porcelain --word-diff-regex=... --color | perl -ple 's/^(\x1b[^ -+]{0,6})? (.{81,})$/$1 . " " . substr($2, 0, 40) . " [... " . (length($2)-80) . " bytes ...] " . substr($2, -40)/ex' |