Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Commit

Permalink
improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
resmo committed Aug 15, 2020
1 parent a1fb742 commit 2626ac8
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 155 deletions.
163 changes: 25 additions & 138 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,128 +2,18 @@ name: Collection integration

on:
push:
branches:
- master
pull_request:
schedule:
- cron: 31 6 * * 3 # Run weekly
- cron: 31 6 * * * # Run weekly

jobs:
build-collection-artifact:
name: Build collection
runs-on: ${{ matrix.runner-os }}
strategy:
matrix:
runner-os:
- ubuntu-latest
ansible-version:
- git+https://github.com/ansible/ansible.git@devel
runner-python-version:
- 3.8
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.runner-python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.runner-python-version }}
- name: Set up pip cache
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ github.ref }}
- name: Install Ansible ${{ matrix.ansible-version }}
run: >-
python -m
pip
install
--user
${{ matrix.ansible-version }}
- name: Build a collection tarball
run: >-
~/.local/bin/ansible-galaxy
collection
build
--output-path
"${GITHUB_WORKSPACE}/.cache/collection-tarballs"
- name: Store migrated collection artifacts
uses: actions/upload-artifact@v1
with:
name: >-
collection
path: .cache/collection-tarballs

sanity-test-collection-via-containers:
name: Sanity in container via Python ${{ matrix.python-version }}
needs:
- build-collection-artifact
runs-on: ${{ matrix.runner-os }}
strategy:
fail-fast: false
matrix:
runner-os:
- ubuntu-latest
runner-python-version:
- 3.6
ansible-version:
- git+https://github.com/ansible/ansible.git@devel
steps:
- name: Set up Python ${{ matrix.runner-python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.runner-python-version }}
- name: Set up pip cache
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ github.ref }}-sanity-containers
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install Ansible ${{ matrix.ansible-version }}
run: >-
python -m
pip
install
--user
${{ matrix.ansible-version }}
- name: Download migrated collection artifacts
uses: actions/download-artifact@v1
with:
name: >-
collection
path: .cache/collection-tarballs
- name: Install the collection tarball
run: >-
~/.local/bin/ansible-galaxy
collection
install
.cache/collection-tarballs/*.tar.gz
- name: Run collection sanity tests
run: >-
~/.local/bin/ansible-test
sanity
--color
--requirements
--docker
-vvv
working-directory: >-
/home/runner/.ansible/collections/ansible_collections/ngine_io/vultr
integration-test:
name: Integration test using Python ${{ matrix.python-version }}
needs:
- build-collection-artifact
- sanity-test-collection-via-containers
runs-on: ${{ matrix.runner-os }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
runner-os:
- ubuntu-latest
runner-python-version:
- 3.6
ansible-version:
- git+https://github.com/ansible/ansible.git@devel
python-version:
- 3.6
- 2.7
Expand All @@ -132,49 +22,46 @@ jobs:
uses: actions/checkout@v1
with:
path: ansible_collections/ngine_io/vultr
- name: Set up pip cache
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ github.ref }}
- name: Install Ansible ${{ matrix.ansible-version }}
run: >-
python -m
pip
install
--user
${{ matrix.ansible-version }}
- name: Download migrated collection artifacts
uses: actions/download-artifact@v1

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
name: >-
collection
path: .cache/collection-tarballs
- name: Install collection tarball
run: >-
~/.local/bin/ansible-galaxy
collection
install
${GITHUB_WORKSPACE}/.cache/collection-tarballs/*.gz
python-version: ${{ matrix.python-version }}

- name: Install ansible and collection dependencies
run: |
python -m pip install --upgrade pip
pip install ansible
pip install -r requirements.txt
- name: Build and install collection
run: |
ansible-galaxy collection build .
ansible-galaxy collection install *.gz
- name: Add config file
env:
CONFIG_FILE: ${{ secrets.CONFIG_FILE }}
run: |
echo "$CONFIG_FILE" > tests/integration/cloud-config-vultr.ini
- name: Run the tests
run: >-
~/.local/bin/ansible-test
ansible-test
integration
--docker
-v
--diff
--color
--retry-on-error
--python ${{ matrix.python-version }}
--continue-on-error
--coverage
smoke/vultr/
- name: Generate coverage report.
- name: Generate coverage report
run: >-
~/.local/bin/ansible-test
ansible-test
coverage xml
-v
--requirements
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/sanity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Sanity
on:
- pull_request

jobs:
sanity:
name: Sanity (${{ matrix.ansible }})
strategy:
matrix:
ansible:
- stable-2.10
- stable-2.9
- devel
runs-on: ubuntu-latest
steps:

- name: Check out code
uses: actions/checkout@v1
with:
path: ansible_collections/ngine_io/vultr

- name: Set up Python 3.6
uses: actions/setup-python@v1
with:
python-version: 3.6

- name: Install ansible-base (${{ matrix.ansible }})
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check

- name: Run sanity tests
run: ansible-test sanity --docker -v --color
17 changes: 0 additions & 17 deletions tests/sanity/ignore-2.10.txt
Original file line number Diff line number Diff line change
@@ -1,17 +0,0 @@
plugins/modules/vultr_block_storage.py validate-modules:parameter-type-not-in-doc
plugins/modules/vultr_block_storage.py validate-modules:doc-missing-type
plugins/modules/vultr_dns_domain.py validate-modules:doc-missing-type
plugins/modules/vultr_dns_domain_info.py validate-modules:return-syntax-error
plugins/modules/vultr_dns_record.py validate-modules:parameter-type-not-in-doc
plugins/modules/vultr_dns_record.py validate-modules:doc-missing-type
plugins/modules/vultr_firewall_group.py validate-modules:doc-missing-type
plugins/modules/vultr_firewall_group_info.py validate-modules:return-syntax-error
plugins/modules/vultr_firewall_rule.py validate-modules:parameter-type-not-in-doc
plugins/modules/vultr_firewall_rule.py validate-modules:doc-missing-type
plugins/modules/vultr_network.py validate-modules:doc-missing-type
plugins/modules/vultr_network_info.py validate-modules:return-syntax-error
plugins/modules/vultr_region_info.py validate-modules:return-syntax-error
plugins/modules/vultr_server_info.py validate-modules:return-syntax-error
plugins/modules/vultr_startup_script_info.py validate-modules:return-syntax-error
plugins/doc_fragments/vultr.py future-import-boilerplate
plugins/doc_fragments/vultr.py metaclass-boilerplate

0 comments on commit 2626ac8

Please sign in to comment.