def _run_ci_cd(step: config.Config.CI_CD_LITERAL, sdk: Sdk): supported_categories = get_supported_categories(categories_file) examples = find_examples(root_dir, supported_categories, sdk) if step == config.Config.CI_STEP_NAME: _ci_step(examples=examples) if step == config.Config.CD_STEP_NAME: _cd_step(examples=examples)
def cd_step(): """ CD step to save all beam examples/tests/katas and their outputs on the GCS """ setup_logger() root_dir = os.getenv("BEAM_ROOT_DIR") categories_file = os.getenv("BEAM_EXAMPLE_CATEGORIES") supported_categories = get_supported_categories(categories_file) cd_helper = CDHelper() examples = find_examples(root_dir, supported_categories) cd_helper.store_examples(examples)
def ci_step(): """ CI step to verify all beam examples/tests/katas """ setup_logger() root_dir = os.getenv("BEAM_ROOT_DIR") categories_file = os.getenv("BEAM_EXAMPLE_CATEGORIES") supported_categories = get_supported_categories(categories_file) ci_helper = CIHelper() examples = find_examples(root_dir, supported_categories) asyncio.run(ci_helper.verify_examples(examples))
def _run_ci_cd(step: config.Config.CI_CD_LITERAL, sdk: Sdk): supported_categories = get_supported_categories(categories_file) logging.info("Start of searching Playground examples ...") examples = find_examples(root_dir, supported_categories, sdk) logging.info("Finish of searching Playground examples") logging.info("Number of found Playground examples: %s", len(examples)) if step == config.Config.CI_STEP_NAME: logging.info("Start of verification Playground examples ...") _ci_step(examples=examples) logging.info("Finish of verification Playground examples") if step == config.Config.CD_STEP_NAME: logging.info("Start of storing Playground examples ...") _cd_step(examples=examples) logging.info("Finish of storing Playground examples")
def test_get_supported_categories(): result = get_supported_categories("") assert len(result) == 1 assert result[0] == "category"