-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
21 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,36 +4,25 @@ jobs: | |
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
- name: OPA Test | ||
uses: petroprotsakh/[email protected] | ||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup OPA | ||
uses: open-policy-agent/setup-opa@v2 | ||
with: | ||
options: -v | ||
tests: | | ||
cost | ||
external_data | ||
aws/enforce_aws_resource.rego;aws/enforce_aws_resource_test.rego;aws/enforce_aws_resource_mock.json | ||
aws/enforce_aws_iam_and_workspace.rego;aws/enforce_aws_iam_and_workspace_test.rego;aws/enforce_aws_iam_and_workspace_mock.json | ||
aws/enforce_s3_buckets_encryption.rego;aws/enforce_s3_buckets_encryption_test.rego;aws/enforce_s3_buckets_encryption_mock.json | ||
aws/enforce_kms_key_names.rego;aws/enforce_kms_key_names.test.rego;aws/enforce_kms_key_names.mock.json | ||
aws/enforce_iam_instance_profiles.rego;aws/enforce_iam_instance_profiles.test.rego;aws/enforce_iam_instance_profiles.mock.json | ||
aws/enforce_ebs_del_on_term.rego;aws/enforce_ebs_del_on_term.test.rego;aws/enforce_ebs_del_on_term.mock.json | ||
aws/enforce_instance_subnet.rego;aws/enforce_instance_subnet.test.rego;aws/enforce_instance_subnet.mock.json | ||
aws/enforce_lb_subnets.rego;aws/enforce_lb_subnets.test.rego;aws/enforce_lb_subnets.mock.json | ||
aws/enforce_rds_subnets.rego;aws/enforce_rds_subnets.test.rego;aws/enforce_rds_subnets.mock.json | ||
management/denied_provisioners.rego;management/denied_provisioners_test.rego;management/denied_provisioners_mock.json | ||
management/enforce_ami_owners.rego;management/enforce_ami_owners_test.rego;management/enforce_ami_owners_mock.json | ||
management/instance_types.rego;management/instance_types_test.rego;management/instance_types_mock.json | ||
management/resource_tags.rego;management/resource_tags_test.rego;management/resource_tags_mock.json | ||
management/whitelist_ami.rego;management/whitelist_ami_test.rego;management/whitelist_ami_mock.json | ||
management/workspace_name.rego;management/workspace_name_test.rego;management/workspace_name_mock.json | ||
management/workspace_destroy.rego;management/workspace_destroy_test.rego;management/workspace_destroy_mock.json | ||
management/pull_requests.rego;management/pull_requests_test.rego;management/pull_requests_mock.json | ||
management/workspace_tags.rego;management/workspace_tags_test.rego;management/workspace_tags_mock.json | ||
management/workspace_environment_type.rego;management/workspace_environment_type_еуіе.rego;management/workspace_environment_type_mock.json | ||
modules/pin_module_version.rego;modules/pin_module_version_test.rego;modules/pin_module_version_mock.json; | ||
modules/required_modules.rego;modules/required_modules_test.rego;modules/required_modules_mock.json; | ||
placement | ||
providers | ||
user | ||
version: latest | ||
|
||
- name: Run OPA Tests | ||
run: | | ||
dirs=$(find . -type f -name '*.rego' -exec dirname {} \; | sort -u) | ||
echo "Directories to be tested:" | ||
for dir in $dirs; do | ||
echo "$dir" | ||
done | ||
for dir in $dirs; do | ||
echo "Running tests in $dir" | ||
if ! opa test $dir/ -v --format pretty; then | ||
echo "Tests failed in $dir" | ||
exit 1 | ||
fi | ||
done |