Added CI check to ensure i18n translations are in sync

fixes https://github.com/TryGhost/DevOps/issues/91

- this adds a CI job that will run i18n tests if any of the packages
  that use it have changed
- this helps prevent translations from going out of sync
This commit is contained in:
Daniel Lockyer 2023-10-24 09:07:22 +02:00 committed by Daniel Lockyer
parent 0a2b8cdbd3
commit c5c6f84c7d
2 changed files with 27 additions and 3 deletions

View File

@ -217,6 +217,29 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
job_i18n:
runs-on: ubuntu-latest
needs: [job_get_metadata, job_install_deps]
name: i18n
if: |
needs.job_get_metadata.outputs.changed_comments_ui == 'true'
|| needs.job_get_metadata.outputs.changed_signup_form == 'true'
|| needs.job_get_metadata.outputs.changed_portal == 'true'
|| needs.job_get_metadata.outputs.changed_core == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "18.12.1"
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_install_deps.outputs.dependency_cache_key }}
- name: Run i18n tests
run: yarn nx run @tryghost/i18n:test
job_admin-tests:
runs-on: ubuntu-latest
needs: [job_get_metadata, job_install_deps]
@ -832,11 +855,13 @@ jobs:
job_get_metadata,
job_install_deps,
job_lint,
job_i18n,
job_ghost-cli,
job_admin-tests,
job_unit-tests,
job_database-tests,
job_regression-tests,
job_browser-tests,
job_admin_x_settings,
job_comments_ui,
job_signup_form,

View File

@ -8,9 +8,8 @@
"types": "./build/i18n.d.ts",
"scripts": {
"dev": "echo \"Implement me!\"",
"test:unit:base": "NODE_ENV=testing c8 --include index.js --include lib --check-coverage --100 --reporter text --reporter cobertura -- mocha --reporter dot './test/**/*.test.js'",
"test:unit": "yarn test:unit:base && yarn translate",
"test": "yarn test:unit",
"test:base": "NODE_ENV=testing c8 --include index.js --include lib --check-coverage --100 --reporter text --reporter cobertura -- mocha --reporter dot './test/**/*.test.js'",
"test": "yarn test:base && yarn translate",
"lint:code": "eslint *.js lib/ --ext .js --cache",
"lint": "yarn lint:code && yarn lint:test",
"lint:test": "eslint -c test/.eslintrc.js test/ --ext .js --cache",