Skip to content

Commit

Permalink
Update tests (#310)
Browse files Browse the repository at this point in the history
* Update tests
  • Loading branch information
mamercad authored Aug 11, 2023
1 parent 0ef9c31 commit bc63b0a
Show file tree
Hide file tree
Showing 24 changed files with 2,539 additions and 264 deletions.
60 changes: 8 additions & 52 deletions .github/workflows/ansible-test-integration.yml
Original file line number Diff line number Diff line change
@@ -1,67 +1,23 @@
name: integration

on:
push:
branches:
- main
schedule:
- cron: "10 6 * * *"
branches: [main]
workflow_dispatch:

concurrency:
group: cloud-integration-tests
cancel-in-progress: false
group: ${{ github.workflow }}
cancel-in-progress: true

jobs:
integration:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
timeout-minutes: 40
strategy:
fail-fast: false
max-parallel: 1
matrix:
module:
- digital_ocean_account_info
- digital_ocean_balance_info
- digital_ocean_block_storage
- digital_ocean_cdn_endpoints
- digital_ocean_cdn_endpoints_info
- digital_ocean_certificate
- digital_ocean_certificate_info
- digital_ocean_database
- digital_ocean_database_info
- digital_ocean_domain
- digital_ocean_domain_info
- digital_ocean_domain_record
- digital_ocean_domain_record_info
- digital_ocean_droplet
- digital_ocean_droplet_info
- digital_ocean_firewall
- digital_ocean_firewall_info
- digital_ocean_floating_ip
- digital_ocean_floating_ip_info
- digital_ocean_image_info
- digital_ocean_kubernetes
- digital_ocean_kubernetes_info
- digital_ocean_load_balancer
- digital_ocean_load_balancer_info
- digital_ocean_monitoring_alerts
- digital_ocean_monitoring_alerts_info
- digital_ocean_project
- digital_ocean_project_info
- digital_ocean_region_info
- digital_ocean_size_info
- digital_ocean_snapshot
- digital_ocean_snapshot_info
- digital_ocean_spaces
- digital_ocean_spaces_info
- digital_ocean_sshkey
- digital_ocean_sshkey_info
- digital_ocean_tag
- digital_ocean_tag_info
- digital_ocean_volume_info
- digital_ocean_vpc
- digital_ocean_vpc_info

ansible:
- stable-2.14
steps:
- name: Perform testing
uses: ansible-community/ansible-test-gh-action@release/v1
Expand All @@ -73,8 +29,8 @@ jobs:
./tests/utils/render.sh
tests/integration/integration_config.yml.template
> tests/integration/integration_config.yml
ansible-core-version: ${{ matrix.ansible }}
origin-python-version: 3.9
target: ${{ matrix.module }}
target-python-version: 3.9
testing-type: integration
test-deps: community.general
43 changes: 9 additions & 34 deletions .github/workflows/ansible-test-sanity.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,27 @@
name: sanity

on:
pull_request:
types: [ opened, synchronize, reopened ]
push:
branches: [ main ]
schedule:
- cron: '0 6 * * *'
types: [opened, synchronize, reopened]
workflow_dispatch:

jobs:

sanity_29:
timeout-minutes: 30
name: Sanity (Ⓐ$${{ matrix.ansible }})
strategy:
matrix:
ansible:
- stable-2.9
runs-on: ubuntu-latest
steps:
- name: Perform testing
uses: ansible-community/ansible-test-gh-action@release/v1
with:
ansible-core-version: ${{ matrix.ansible }}
# pre-test-cmd:
python-version: 3.8
target-python-version: 3.8
testing-type: sanity
# test-deps:

sanity:
timeout-minutes: 30
name: Sanity (Ⓐ$${{ matrix.ansible }})
strategy:
fail-fast: false
matrix:
ansible:
- stable-2.10
- stable-2.11
- stable-2.12
- stable-2.13
- devel
runs-on: ubuntu-latest
- stable-2.12
- stable-2.13
- stable-2.14
runs-on: ubuntu-22.04
steps:
- name: Perform testing
uses: ansible-community/ansible-test-gh-action@release/v1
with:
ansible-core-version: ${{ matrix.ansible }}
# pre-test-cmd:
python-version: 3.9
origin-python-version: 3.9
target-python-version: 3.9
testing-type: sanity
# test-deps:
42 changes: 6 additions & 36 deletions .github/workflows/ansible-test-unit.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,27 @@
name: unit
on:
pull_request:
types: [ opened, synchronize, reopened ]
push:
branches: [ main ]
schedule:
- cron: '10 6 * * *'
types: [opened, synchronize, reopened]
workflow_dispatch:

jobs:

units_29:
runs-on: ubuntu-latest
timeout-minutes: 30
name: Units (Ⓐ${{ matrix.ansible }})
strategy:
fail-fast: true
matrix:
ansible:
- stable-2.9
steps:
- name: Perform testing
uses: ansible-community/ansible-test-gh-action@release/v1
with:
ansible-core-version: ${{ matrix.ansible }}
# pre-test-cmd:
python-version: 3.8
target-python-version: 3.8
testing-type: units
test-deps: >-
ansible.netcommon
ansible.utils
community.general
units:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
timeout-minutes: 30
name: Units (Ⓐ${{ matrix.ansible }})
strategy:
fail-fast: true
fail-fast: false
matrix:
ansible:
- stable-2.10
- stable-2.11
- stable-2.12
- stable-2.13
- devel
- stable-2.14
steps:
- name: Perform testing
uses: ansible-community/ansible-test-gh-action@release/v1
with:
ansible-core-version: ${{ matrix.ansible }}
# pre-test-cmd:
python-version: 3.9
origin-python-version: 3.9
target-python-version: 3.9
testing-type: units
test-deps: >-
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ name: black

on:
pull_request:
types: [ opened, synchronize, reopened ]
push:
branches: [ main ]
types: [opened, synchronize, reopened]
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: psf/black@stable
128 changes: 8 additions & 120 deletions .github/workflows/pull-request-integration.yml
Original file line number Diff line number Diff line change
@@ -1,140 +1,28 @@
name: pull-request-integration

on:
pull_request_target:
branches: [main]
pull_request:
types: [opened, synchronize, reopened]
paths:
- plugins/module_utils/**
- plugins/modules/**

concurrency:
group: cloud-integration-tests
group: ${{ github.workflow }}
cancel-in-progress: false

env:
DEFAULT_BRANCH: remotes/origin/main

jobs:
changes:
# Require reviewers for this environment
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
environment: integration
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.head_ref }}

- name: show changes files
run: |
git diff --name-only $DEFAULT_BRANCH
- name: get changed module_utils
id: changed-module-utils
run: |
basenames=()
for file in $(git diff --name-only $DEFAULT_BRANCH | grep 'plugins/module_utils/'); do
basenames+=($(basename $file .py))
done
printf '::set-output name=matrix::%s\n' $(printf '%s\n' "${basenames[@]}" | jq -R . | jq -sc .)
- name: get changed modules
id: changed-modules
run: |
basenames=()
for file in $(git diff --name-only $DEFAULT_BRANCH | grep 'plugins/modules/'); do
basenames+=($(basename $file .py))
done
printf '::set-output name=matrix::%s\n' $(printf '%s\n' "${basenames[@]}" | jq -R . | jq -sc .)
outputs:
module-utils-matrix: ${{ steps.changed-module-utils.outputs.matrix }}
module-matrix: ${{ steps.changed-modules.outputs.matrix }}

test-module-utils:
environment: integration
runs-on: ubuntu-latest
timeout-minutes: 120
needs: [changes]
if: ${{ needs.changes.outputs.module-utils-matrix != '[""]' }}
strategy:
fail-fast: false
max-parallel: 1
matrix:
module:
- digital_ocean_account_info
- digital_ocean_balance_info
- digital_ocean_block_storage
- digital_ocean_cdn_endpoints
- digital_ocean_cdn_endpoints_info
- digital_ocean_certificate
- digital_ocean_certificate_info
- digital_ocean_database
- digital_ocean_database_info
- digital_ocean_domain
- digital_ocean_domain_info
- digital_ocean_domain_record
- digital_ocean_domain_record_info
- digital_ocean_droplet
- digital_ocean_droplet_info
- digital_ocean_firewall
- digital_ocean_firewall_info
- digital_ocean_floating_ip
- digital_ocean_floating_ip_info
- digital_ocean_image_info
- digital_ocean_kubernetes
- digital_ocean_kubernetes_info
- digital_ocean_load_balancer
- digital_ocean_load_balancer_info
- digital_ocean_monitoring_alerts
- digital_ocean_monitoring_alerts_info
- digital_ocean_project
- digital_ocean_project_info
- digital_ocean_region_info
- digital_ocean_size_info
- digital_ocean_snapshot
- digital_ocean_snapshot_info
- digital_ocean_spaces
- digital_ocean_spaces_info
- digital_ocean_sshkey
- digital_ocean_sshkey_info
- digital_ocean_tag
- digital_ocean_tag_info
- digital_ocean_volume_info
- digital_ocean_vpc
- digital_ocean_vpc_info
steps:
- name: Perform testing (all modules)
uses: ansible-community/ansible-test-gh-action@release/v1
with:
git-checkout-ref: ${{ github.event.pull_request.head.sha }}
pre-test-cmd: >-
DO_API_KEY=${{ secrets.DO_API_KEY }}
AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}
./tests/utils/render.sh
tests/integration/integration_config.yml.template
> tests/integration/integration_config.yml
origin-python-version: 3.9
target-python-version: 3.9
testing-type: integration
test-deps: community.general
target: ${{ matrix.module }}

test-modules:
integration:
environment: integration
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
timeout-minutes: 40
needs: [changes]
if: ${{ needs.changes.outputs.module-utils-matrix == '[""]' && needs.changes.outputs.module-matrix != '[""]' }}
strategy:
fail-fast: false
matrix:
module: ${{ fromJSON(needs.changes.outputs.module-matrix) }}
ansible:
- stable-2.14
steps:
- name: Perform testing (changed module)
- name: Perform testing
uses: ansible-community/ansible-test-gh-action@release/v1
with:
git-checkout-ref: ${{ github.event.pull_request.head.sha }}
Expand All @@ -145,8 +33,8 @@ jobs:
./tests/utils/render.sh
tests/integration/integration_config.yml.template
> tests/integration/integration_config.yml
ansible-core-version: ${{ matrix.ansible }}
origin-python-version: 3.9
target-python-version: 3.9
testing-type: integration
test-deps: community.general
target: ${{ matrix.module }}
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python 3.9.16
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@Akasurde @bmildren @danxg87 @geerlingguy @mamercad @mpontillo @tparker00
Loading

0 comments on commit bc63b0a

Please sign in to comment.