Skip to content

Commit

Permalink
Issue #1: Initial effort to lift some content out of the Kubernetes c…
Browse files Browse the repository at this point in the history
…ollection.
  • Loading branch information
geerlingguy committed Aug 5, 2020
1 parent 4b87e40 commit 3ed804e
Show file tree
Hide file tree
Showing 27 changed files with 912 additions and 265 deletions.
90 changes: 11 additions & 79 deletions .github/workflows/ansible-test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# README FIRST
# 1. replace "NAMESPACE/COLLECTION_NAME" with the correct name, ie "community/zabbix"
# 1. replace "community/okd" with the correct name, ie "community/zabbix"
# 2. If you don't have unit tests remove that section
# 3. If your collection depends on other collections ensure they are installed, see "Install collection dependencies"
# If you need help please ask in #ansible-devel on Freenode IRC
Expand All @@ -22,9 +22,7 @@ jobs:
strategy:
matrix:
ansible:
# It's important that Sanity is tested against all stable-X.Y branches
# Testing against `devel` may fail as new tests are added.
# - stable-2.9 # Only if your collection supports Ansible 2.9
- stable-2.9
- stable-2.10
- devel
python:
Expand All @@ -35,14 +33,10 @@ jobs:
- python: 3.8 # blocked by ansible/ansible#70155
runs-on: ubuntu-latest
steps:

# ansible-test requires the collection to be in a directory in the form
# .../ansible_collections/NAMESPACE/COLLECTION_NAME/

- name: Check out code
uses: actions/checkout@v2
with:
path: ansible_collections/NAMESPACE/COLLECTION_NAME
path: ansible_collections/community/okd

- name: Set up Python ${{ matrix.ansible }}
uses: actions/setup-python@v2
Expand All @@ -58,83 +52,21 @@ jobs:
# Explicity specify the version of Python we want to test
- name: Run sanity tests
run: ansible-test sanity --docker -v --color --python ${{ matrix.python }}
working-directory: ./ansible_collections/NAMESPACE/COLLECTION_NAME

###
# Unit tests (OPTIONAL)
#
# https://docs.ansible.com/ansible/latest/dev_guide/testing_units.html

units:
runs-on: ubuntu-latest
name: Units (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }})
strategy:
# As soon as the first unit test fails, cancel the others to free up the CI queue
fail-fast: true
matrix:
ansible:
# - stable-2.9 # Only if your collection supports Ansible 2.9
- stable-2.10
- devel
python:
- 2.7
- 3.7
- 3.8
exclude:
- python: 3.8 # blocked by ansible/ansible#70155

steps:
- name: Check out code
uses: actions/checkout@v2
with:
path: ansible_collections/NAMESPACE/COLLECTION_NAME

- name: Set up Python ${{ matrix.ansible }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}

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

# OPTIONAL If your unit test requires Python libraries from other collections
# Install them like this
- name: Install collection dependencies
run: ansible-galaxy collection install ansible.netcommon -p .

# Run the unit tests
- name: Run unit test
run: ansible-test units -v --color --python ${{ matrix.python }} --docker --coverage
working-directory: ./ansible_collections/NAMESPACE/COLLECTION_NAME

# ansible-test support producing code coverage date
- name: Generate coverage report
run: ansible-test coverage xml -v --requirements --group-by command --group-by version
working-directory: ./ansible_collections/NAMESPACE/COLLECTION_NAME

# See the reports at https://codecov.io/gh/ansible_collections/GITHUBORG/REPONAME
- uses: codecov/codecov-action@v1
with:
fail_ci_if_error: false
working-directory: ./ansible_collections/community/okd

###
# Integration tests (RECOMMENDED)
#
# https://docs.ansible.com/ansible/latest/dev_guide/testing_integration.html


# If the application you are testing is available as a docker container and you want to test
# multiple versions see the following for an example:
# https://github.com/ansible-collections/community.zabbix/tree/master/.github/workflows

integration:
runs-on: ubuntu-latest
name: I (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }}})
name: Integration (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }}})
strategy:
fail-fast: false
matrix:
ansible:
# - stable-2.9 # Only if your collection supports Ansible 2.9
- stable-2.9
- stable-2.10
- devel
python:
Expand All @@ -148,7 +80,7 @@ jobs:
- name: Check out code
uses: actions/checkout@v2
with:
path: ansible_collections/NAMESPACE/COLLECTION_NAME
path: ansible_collections/community/okd

- name: Set up Python ${{ matrix.ansible }}
uses: actions/setup-python@v2
Expand All @@ -161,17 +93,17 @@ jobs:
# OPTIONAL If your integration test requires Python libraries or modules from other collections
# Install them like this
- name: Install collection dependencies
run: ansible-galaxy collection install ansible.netcommon -p .
run: ansible-galaxy collection install community.kubernetes -p .

# Run the integration tests
- name: Run integration test
run: ansible-test integration -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker --coverage
working-directory: ./ansible_collections/NAMESPACE/COLLECTION_NAME
working-directory: ./ansible_collections/community/okd

# ansible-test support producing code coverage date
# ansible-test support producing code coverage date
- name: Generate coverage report
run: ansible-test coverage xml -v --requirements --group-by command --group-by version
working-directory: ./ansible_collections/NAMESPACE/COLLECTION_NAME
working-directory: ./ansible_collections/community/okd

# See the reports at https://codecov.io/gh/ansible_collections/GITHUBORG/REPONAME
- uses: codecov/codecov-action@v1
Expand Down
138 changes: 10 additions & 128 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,132 +1,14 @@
/tests/output/
/changelogs/.plugin-cache.yaml

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.retry
.idea
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject
__pycache__/

# mkdocs documentation
/site
# Galaxy artifacts.
*.tar.gz

# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Changelog cache files.
changelogs/.plugin-cache.yaml

# Pyre type checker
.pyre/
# Temporary test files.
tests/output
tests/integration/cloud-config-*
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -671,4 +671,4 @@ into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
<https://www.gnu.org/licenses/why-not-lgpl.html>.
Loading

0 comments on commit 3ed804e

Please sign in to comment.