from typing import Set
from pathlib import Path
import yaml


def _ci_patterns() -> Set[str]:
    """
    Return the CI patterns given in the CI config file.
    """
    repository_root = Path(__file__).parent.parent
    ci_file = repository_root / '.github' / 'workflows' / 'ci.yml'
    github_workflow_config = yaml.safe_load(ci_file.read_text())
    matrix = github_workflow_config['jobs']['build']['strategy']['matrix']
    ci_pattern_list = matrix['ci_pattern']
    ci_patterns = set(ci_pattern_list)
    assert len(ci_pattern_list) == len(ci_patterns)
    return ci_patterns