From c5c6f84c7d37e57dec4eb314333a28fd605e1142 Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Tue, 24 Oct 2023 09:07:22 +0200 Subject: [PATCH] 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 --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ ghost/i18n/package.json | 5 ++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6bb0d8c18d..e0c15fd52e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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, diff --git a/ghost/i18n/package.json b/ghost/i18n/package.json index f66aac820b..ff2e037184 100644 --- a/ghost/i18n/package.json +++ b/ghost/i18n/package.json @@ -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",