{"id":18913541,"url":"https://github.com/complianceascode/content-test-filtering","last_synced_at":"2025-04-15T08:30:52.086Z","repository":{"id":38302523,"uuid":"221662051","full_name":"ComplianceAsCode/content-test-filtering","owner":"ComplianceAsCode","description":"System for Automatic Filtering of Tests for ComplianceAsCode project","archived":false,"fork":false,"pushed_at":"2024-12-06T09:06:45.000Z","size":202,"stargazers_count":8,"open_issues_count":9,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-28T18:50:40.229Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ComplianceAsCode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-14T09:43:20.000Z","updated_at":"2024-12-06T09:06:50.000Z","dependencies_parsed_at":"2023-11-08T11:33:43.827Z","dependency_job_id":"1dcc488a-f9b8-4b33-9d89-8f917b880f0e","html_url":"https://github.com/ComplianceAsCode/content-test-filtering","commit_stats":null,"previous_names":["ComplianceAsCode/content-test-filtering"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ComplianceAsCode%2Fcontent-test-filtering","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ComplianceAsCode%2Fcontent-test-filtering/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ComplianceAsCode%2Fcontent-test-filtering/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ComplianceAsCode%2Fcontent-test-filtering/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ComplianceAsCode","download_url":"https://codeload.github.com/ComplianceAsCode/content-test-filtering/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249035297,"owners_count":21202052,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T10:08:13.308Z","updated_at":"2025-04-15T08:30:51.823Z","avatar_url":"https://github.com/ComplianceAsCode.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# content-test-filtering\nAutomatic tests filtering for [ComplianceAsCode/content project](https://github.com/ComplianceAsCode/content/).\n\nThe project analyses changed files, then based on changes decides what has been affected, and at the end selects what should be tested.\n\n## Requirements\n-  Python 3.4 or newer\n-  Git 1.7 or newer\n-  GitPython (Python package)\n-  PyYAML (Python package)\n-  DeepDiff (Python package)\n-  Jinja2 (Python package)\n-  xmldiff (Python package)\n\n## Installation\nFedora/RHEL:\n```\nyum install python3 git\npip3 install gitpython PyYAML deepdiff Jinja2 xmldiff\ngit clone https://github.com/mildas/content-test-filtering\n```\n\n**WARNING:** For analysis of Jinja files, ComplianceAsCode dependencies are required. See [ComplianceAsCode Developer Guide](https://github.com/ComplianceAsCode/content/blob/master/docs/manual/developer_guide.adoc)\n\n## Usage\nHow to obtain changes:\n-  **Pull request number** - get changes from a [ComplianceAsCode/content PR](https://github.com/ComplianceAsCode/content/pulls)\n-  **Branch name** - name of a branch\n```\npositional arguments:\n  {pr,branch}  Subcommands: pr, branch\n    pr         Compare base against selected pull request\n    branch     Compare base against selected branch\n```\n\nBoth options have common optional arguments:\n```\n  -h, --help            show this help message and exit\n  --base BASE_BRANCH    Base branch against which we want to compare, default is \"master\" branch\n  --repository REPOSITORY_PATH\n                        Path to ComplianceAsCode repository. If not provided, the repository will be cloned into\n                        /tmp folder.\n  --remote_repo REMOTE_REPO\n                        Remote repository for pulling, updating and finding branches (Pull requests). Default is\n                        https://github.com/ComplianceAsCode/content.\n  --local               Do not pull from remote, use local branches. Mainly for testing purposes.\n  --verbose             Increase verbose level of logging to DEBUG level. Default level is INFO\n  --output-tests        Output only list of tests. Completely turns off all other outputs.\n  --output-format {raw,markdown}\n                        Output format.\n  --output {commands,json}\n                        Output from the tool.\n  --profile             Print only profile tests.\n  --rule                Print only rule tests.\n```\n\n### Remote vs local analysis\nBy default, changes are obtained from remote repository. When no optional arguments are passed, [ComplianceAsCode/content repository](https://github.com/ComplianceAsCode/content/) is clonned, branch with changes fetched, and then localy analysed.\n\nTo disable clonning of the repository and fetch only changes, `--repository` is needed.\nTo perform local changes analysis, `branch` (Pull Request numbering is unknown in local repository), `--local` (disable branch fetching), and `--repository` (path to local repository) arguments must be used.\n\n### Output format\nBy default, the project prints human-readable output with identified rule and profile changes and with recommended tests to execute. Github comments support Markdown format, and so to make the output nice for comments, using `--output-format markdown` argument outputs it in the format.\n\nFor machine-readble output, use `--output json` argument. It outputs separate output for profile changes and for rule related changes:\n- profile changes - `profile` and `product` keys\n- rule changes - `rule`, `product`, `bash`, and `ansible` keys\n\n## Tests\nTests are located in `tests/` directory and are using [BATS](https://github.com/bats-core/bats-core).\n\nFor each script with tests, testing repository is prepared.\nFor each test scenario, setup and clean up phase are done. The setup phase creates temporary file for changes, and clean up puts the repository to previous state.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomplianceascode%2Fcontent-test-filtering","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcomplianceascode%2Fcontent-test-filtering","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomplianceascode%2Fcontent-test-filtering/lists"}