From 8cc2b4214d8f1ceb6db2eb344c134f952d999365 Mon Sep 17 00:00:00 2001 From: Oliver Shi Date: Mon, 31 Jan 2022 12:20:28 -0500 Subject: [PATCH] add call_misc_tests GH workflow (#1660) Also fixes a bug in the translation test bash script, where a non-zero exit code would only be returned if the LAST .po file in the for loop had a msgcmp error. J=SLAP-1815 TEST=manual,auto tested using https://github.com/yext/answers-search-ui/pull/1659 tests run in a support branch tests fail if any of the translations in a pot file are missing, in either the last po file or a different one short circuits if pot file is not up to date --- .circleci/config.yml | 2 +- .../run_translation_verification.sh | 17 +++++++++++------ .github/workflows/build_and_deploy.yml | 4 ++++ .github/workflows/build_and_deploy_i18n.yml | 6 ++++++ .github/workflows/miscellaneous_tests.yml | 19 +++++++++++++++++++ 5 files changed, 41 insertions(+), 7 deletions(-) rename {.circleci => .github}/run_translation_verification.sh (77%) create mode 100644 .github/workflows/miscellaneous_tests.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index cad2c8e57..89f8d141c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -147,7 +147,7 @@ jobs: name: Verify translation files command: | sudo apt-get install -qq gettext - ./.circleci/run_translation_verification.sh + ./.github/run_translation_verification.sh # deploys assets to an uncached folder in the S3 bucket named by branch deploy_branch: docker: diff --git a/.circleci/run_translation_verification.sh b/.github/run_translation_verification.sh similarity index 77% rename from .circleci/run_translation_verification.sh rename to .github/run_translation_verification.sh index aeea97903..48ab8b5cb 100755 --- a/.circleci/run_translation_verification.sh +++ b/.github/run_translation_verification.sh @@ -16,14 +16,19 @@ fi # Verify that translations are present for all languages cd conf/i18n/translations -if [[ $CIRCLE_BRANCH == release/* - || $CIRCLE_BRANCH == hotfix/* - || $CIRCLE_BRANCH == master - || $CIRCLE_BRANCH == support/* ]] + +exit_code=0 +if [[ $GITHUB_REF_NAME == release/* + || $GITHUB_REF_NAME == hotfix/* + || $GITHUB_REF_NAME == master + || $GITHUB_REF_NAME == support/* ]] then for po_file in *.po - do msgcmp $po_file messages.pot + do + msgcmp $po_file messages.pot || exit_code=1 done else echo "Skipping the verification that all translations are present" -fi \ No newline at end of file +fi + +exit $exit_code diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 55ac0ff13..d3edbf90f 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -17,6 +17,9 @@ jobs: call_unit_test: uses: ./.github/workflows/unit_test.yml needs: call_build + + call_misc_tests: + uses: ./.github/workflows/miscellaneous_tests.yml call_format_branch_name: uses: ./.github/workflows/format_branch_name.yml @@ -33,6 +36,7 @@ jobs: - call_unit_test - call_format_branch_name - call_acceptance + - call_misc_tests uses: ./.github/workflows/deploy.yml with: directory: dev/${{ needs.call_format_branch_name.outputs.formatted_branch }} diff --git a/.github/workflows/build_and_deploy_i18n.yml b/.github/workflows/build_and_deploy_i18n.yml index eaa006ecd..63e9d5b16 100644 --- a/.github/workflows/build_and_deploy_i18n.yml +++ b/.github/workflows/build_and_deploy_i18n.yml @@ -18,6 +18,9 @@ jobs: call_unit_test: uses: ./.github/workflows/unit_test.yml needs: call_build + + call_misc_tests: + uses: ./.github/workflows/miscellaneous_tests.yml call_format_branch_name: uses: ./.github/workflows/format_branch_name.yml @@ -35,6 +38,7 @@ jobs: - call_unit_test - call_format_branch_name - call_acceptance + - call_misc_tests uses: ./.github/workflows/deploy.yml with: directory: dev/${{ needs.call_format_branch_name.outputs.formatted_branch }} @@ -48,6 +52,7 @@ jobs: - call_unit_test - call_format_branch_name - call_acceptance + - call_misc_tests uses: ./.github/workflows/deploy.yml with: directory: canary/latest @@ -61,6 +66,7 @@ jobs: - call_unit_test - call_format_branch_name - call_acceptance + - call_misc_tests uses: ./.github/workflows/deploy.yml with: directory: canary/${{ github.sha }} diff --git a/.github/workflows/miscellaneous_tests.yml b/.github/workflows/miscellaneous_tests.yml new file mode 100644 index 000000000..2cd346a6c --- /dev/null +++ b/.github/workflows/miscellaneous_tests.yml @@ -0,0 +1,19 @@ +name: Run miscellaneous tests + +on: + workflow_call: + +jobs: + translation_test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js 14 + uses: actions/setup-node@v2 + with: + node-version: 14 + cache: 'npm' + - run: npm ci + - run: sudo apt-get install -qq gettext + - run: ./.github/run_translation_verification.sh \ No newline at end of file