Skip to content

Commit

Permalink
[stable-6] Add sanity, linters, changelog, and units workflows (#1874)
Browse files Browse the repository at this point in the history
* Add sanity, linters, changelog, and units workflows

* Add sanity, linters, changelog and units workflows

Signed-off-by: Alina Buzachis <[email protected]>

* Delete black.yml

Signed-off-by: Alina Buzachis <[email protected]>

* Update references

Signed-off-by: Alina Buzachis <[email protected]>

* Remove linters job

Signed-off-by: Alina Buzachis <[email protected]>

* Add missing tox.ini file

Signed-off-by: Alina Buzachis <[email protected]>

* Apply black on plugins/modules/cloudfront_distribution.py

Signed-off-by: Alina Buzachis <[email protected]>

* Update tox.ini

Signed-off-by: Alina Buzachis <[email protected]>

* Fix units

Signed-off-by: Alina Buzachis <[email protected]>

---------

Signed-off-by: Alina Buzachis <[email protected]>

* Update amazon.aws dependency version

Signed-off-by: Alina Buzachis <[email protected]>

* Fix test-requirements.txt

Signed-off-by: Alina Buzachis <[email protected]>

---------

Signed-off-by: Alina Buzachis <[email protected]>
  • Loading branch information
alinabuzachis authored Jul 6, 2023
1 parent ef67faa commit dec8ed5
Show file tree
Hide file tree
Showing 21 changed files with 263 additions and 256 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/all_green_ckeck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: all_green

concurrency:
group: ${{ github.head_ref }}
cancel-in-progress: true

on: # yamllint disable-line rule:truthy
pull_request:
types:
- opened
- reopened
- labeled
- unlabeled
- synchronize
branches:
- main
- 'stable-*'
tags:
- '*'

jobs:
changelog-and-linters:
uses: ./.github/workflows/changelog_and_linters.yml # use the callable changelog_and_linters job to run tests
sanity:
uses: ./.github/workflows/sanity.yml # use the callable sanity job to run tests
units:
uses: ./.github/workflows/units.yml # use the callable units job to run tests
all_green:
if: ${{ always() }}
needs:
- changelog-and-linters
- sanity
- units
runs-on: ubuntu-latest
steps:
- run: >-
python -c "assert set([
'${{ needs.changelog-and-linters.result }}',
'${{ needs.sanity.result }}',
'${{ needs.units.result }}'
]) == {'success'}"
10 changes: 10 additions & 0 deletions .github/workflows/changelog_and_linters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: changelog

on: [workflow_call] # allow this workflow to be called from other workflows

jobs:
changelog:
uses: ansible-network/github_actions/.github/workflows/changelog.yml@main
linters:
uses: ansible-network/github_actions/.github/workflows/tox-linters.yml@main
50 changes: 0 additions & 50 deletions .github/workflows/darker-pr.yml

This file was deleted.

12 changes: 12 additions & 0 deletions .github/workflows/galaxy-importer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Galaxy Importer
on:
push:
branches:
- main
- stable-*
pull_request:
schedule:
- cron: '0 13 * * *'
jobs:
importer:
uses: ansible-network/github_actions/.github/workflows/galaxy_importer.yml@main
64 changes: 64 additions & 0 deletions .github/workflows/sanity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
name: sanity tests

on: [workflow_call] # allow this workflow to be called from other workflows

jobs:
sanity:
uses: ansible-network/github_actions/.github/workflows/sanity.yml@main
with:
matrix_include: "[]"
matrix_exclude: >-
[
{
"ansible-version": "stable-2.9"
},
{
"ansible-version": "stable-2.12",
"python-version": "3.7"
},
{
"ansible-version": "stable-2.12",
"python-version": "3.11"
},
{
"ansible-version": "stable-2.13",
"python-version": "3.7"
},
{
"ansible-version": "stable-2.13",
"python-version": "3.11"
},
{
"ansible-version": "stable-2.14",
"python-version": "3.7"
},
{
"ansible-version": "stable-2.14",
"python-version": "3.8"
},
{
"ansible-version": "stable-2.15",
"python-version": "3.7"
},
{
"ansible-version": "stable-2.15",
"python-version": "3.8"
},
{
"ansible-version": "milestone",
"python-version": "3.7"
},
{
"ansible-version": "milestone",
"python-version": "3.8"
},
{
"ansible-version": "devel",
"python-version": "3.7"
},
{
"ansible-version": "devel",
"python-version": "3.8"
}
]
64 changes: 64 additions & 0 deletions .github/workflows/units.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
name: unit tests

on: [workflow_call] # allow this workflow to be called from other workflows

jobs:
unit-source:
uses: ansible-network/github_actions/.github/workflows/unit_source.yml@main
with:
matrix_exclude: >-
[
{
"python-version": "3.11"
},
{
"ansible-version": "stable-2.12",
"python-version": "3.7"
},
{
"ansible-version": "stable-2.13",
"python-version": "3.7"
},
{
"ansible-version": "stable-2.12",
"python-version": "3.8"
},
{
"ansible-version": "stable-2.13",
"python-version": "3.8"
},
{
"ansible-version": "stable-2.14",
"python-version": "3.7"
},
{
"ansible-version": "stable-2.14",
"python-version": "3.8"
},
{
"ansible-version": "stable-2.15",
"python-version": "3.7"
},
{
"ansible-version": "stable-2.15",
"python-version": "3.8"
},
{
"ansible-version": "milestone",
"python-version": "3.7"
},
{
"ansible-version": "milestone",
"python-version": "3.8"
},
{
"ansible-version": "devel",
"python-version": "3.7"
},
{
"ansible-version": "devel",
"python-version": "3.8"
}
]
collection_pre_install: ''
2 changes: 1 addition & 1 deletion .github/workflows/update-variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ on:

jobs:
update-variables:
uses: abikouo/github_actions/.github/workflows/update_aws_variables.yml@automate_aws_user_agent_variable
uses: ansible-network/github_actions/.github/workflows/update_aws_variables.yml@main
3 changes: 3 additions & 0 deletions changelogs/fragments/20230613-black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
trivial:
- "Format using black."
- "Remove Python < 3.6 compatibility code for unit tests."
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description: null
license_file: COPYING
tags: [community, aws, cloud, amazon]
dependencies:
amazon.aws: '>=6.0.0'
amazon.aws: '>=6.2.0'
repository: https://github.com/ansible-collections/community.aws
documentation: https://ansible-collections.github.io/community.aws/branch/stable-6/collections/community/aws/index.html
homepage: https://github.com/ansible-collections/community.aws
Expand Down
4 changes: 3 additions & 1 deletion plugins/modules/cloudfront_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -2219,7 +2219,9 @@ def validate_common_distribution_parameters(
config["aliases"] = ansible_list_to_cloudfront_list(aliases)
if logging is not None:
config["logging"] = self.validate_logging(logging)
config["enabled"] = enabled if enabled is not None else config.get("enabled", self.__default_distribution_enabled)
config["enabled"] = (
enabled if enabled is not None else config.get("enabled", self.__default_distribution_enabled)
)
if price_class is not None:
self.validate_attribute_with_allowed_values(price_class, "price_class", self.__valid_price_classes)
config["price_class"] = price_class
Expand Down
1 change: 1 addition & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pytest
pytest-forked
pytest-mock
pytest-xdist
pytest-ansible ; python_version >= '3.8'

# Needed for ansible.utils.ipaddr in tests
netaddr
Expand Down
Loading

0 comments on commit dec8ed5

Please sign in to comment.