From a3f69824760432cbebd1e1330b45dda3267e9ee4 Mon Sep 17 00:00:00 2001 From: dsotirakis Date: Wed, 10 Nov 2021 14:35:03 +0200 Subject: [PATCH] Merge test a11y steps on starlark files --- .drone.yml | 4 ++-- scripts/drone/pipelines/main.star | 2 +- scripts/drone/pipelines/pr.star | 4 ++-- scripts/drone/steps/lib.star | 38 ++++++++++++------------------- 4 files changed, 19 insertions(+), 29 deletions(-) diff --git a/.drone.yml b/.drone.yml index 95b3fef16bd..19d7fb99299 100644 --- a/.drone.yml +++ b/.drone.yml @@ -222,7 +222,7 @@ steps: PORT: 3001 failure: ignore image: buildkite/puppeteer - name: test-a11y-frontend-pr + name: test-a11y-frontend - commands: - ./scripts/ci-reference-docs-lint.sh ci depends_on: @@ -3430,6 +3430,6 @@ kind: secret name: drone_token --- kind: signature -hmac: 21ecb408dfa778e70baa888dc5a3dc6f049aac7784ad0d7605b021cf27b02cd5 +hmac: a1688fa08e5fd63309dd999be0542addea3a4e3ada2dbd1239a955ba3cac1c7e ... diff --git a/scripts/drone/pipelines/main.star b/scripts/drone/pipelines/main.star index e741a767832..70cc840b94f 100644 --- a/scripts/drone/pipelines/main.star +++ b/scripts/drone/pipelines/main.star @@ -86,7 +86,7 @@ def get_steps(edition, is_downstream=False): e2e_tests_step(edition=edition), build_storybook_step(edition=edition, ver_mode=ver_mode), publish_storybook_step(edition=edition, ver_mode=ver_mode), - test_a11y_frontend_step(edition=edition), + test_a11y_frontend_step(ver_mode=ver_mode, edition=edition), frontend_metrics_step(edition=edition), build_frontend_docs_step(edition=edition), copy_packages_for_docker_step(), diff --git a/scripts/drone/pipelines/pr.star b/scripts/drone/pipelines/pr.star index f5519773509..fd838951a2b 100644 --- a/scripts/drone/pipelines/pr.star +++ b/scripts/drone/pipelines/pr.star @@ -25,7 +25,7 @@ load( 'benchmark_ldap_step', 'validate_scuemata_step', 'ensure_cuetsified_step', - 'test_a11y_frontend_step_pr', + 'test_a11y_frontend_step', ) load( @@ -79,7 +79,7 @@ def pr_pipelines(edition): e2e_tests_server_step(edition=edition), e2e_tests_step(edition=edition), build_storybook_step(edition=edition, ver_mode=ver_mode), - test_a11y_frontend_step_pr(edition=edition), + test_a11y_frontend_step(ver_mode=ver_mode, edition=edition), build_frontend_docs_step(edition=edition), build_docs_website_step(), copy_packages_for_docker_step(), diff --git a/scripts/drone/steps/lib.star b/scripts/drone/steps/lib.star index d427733fe20..4015b57f96c 100644 --- a/scripts/drone/steps/lib.star +++ b/scripts/drone/steps/lib.star @@ -422,7 +422,19 @@ def lint_frontend_step(): ], } -def test_a11y_frontend_step(edition, port=3001): +def test_a11y_frontend_step(ver_mode, edition, port=3001): + commands = [ + 'yarn wait-on http://$HOST:$PORT', + ] + if ver_mode == 'pr': + commands.extend([ + 'yarn run test:accessibility-pr', + ]) + else: + commands.extend([ + 'yarn run test:accessibility --json > pa11y-ci-results.json', + ]) + return { 'name': 'test-a11y-frontend' + enterprise2_suffix(edition), 'image': 'buildkite/puppeteer', @@ -435,29 +447,7 @@ def test_a11y_frontend_step(edition, port=3001): 'PORT': port, }, 'failure': 'ignore', - 'commands': [ - 'yarn wait-on http://$HOST:$PORT', - 'yarn run test:accessibility --json > pa11y-ci-results.json', - ], - } - -def test_a11y_frontend_step_pr(edition, port=3001): - return { - 'name': 'test-a11y-frontend-pr' + enterprise2_suffix(edition), - 'image': 'buildkite/puppeteer', - 'depends_on': [ - 'end-to-end-tests-server' + enterprise2_suffix(edition), - ], - 'environment': { - 'GRAFANA_MISC_STATS_API_KEY': from_secret('grafana_misc_stats_api_key'), - 'HOST': 'end-to-end-tests-server' + enterprise2_suffix(edition), - 'PORT': port, - }, - 'failure': 'ignore', - 'commands': [ - 'yarn wait-on http://$HOST:$PORT', - 'yarn run test:accessibility-pr', - ], + 'commands': commands, } def frontend_metrics_step(edition):