Initial cleanup.

This commit is contained in:
Felix Fontein 2020-10-26 14:33:47 +01:00
parent cfde9713bd
commit 1b9c46fbe5
15 changed files with 351 additions and 100 deletions

View file

@ -1,20 +1,11 @@
# README FIRST
# 1. replace "NAMESPACE" and "COLLECTION_NAME" with the correct name in the env section (e.g. with 'community' and 'mycollection')
# 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
name: CI
on:
# Run CI against all pushes (direct commits, also merged PRs), Pull Requests
push:
pull_request:
# Uncomment the following two lines to run CI once per day (at 06:00 UTC)
# schedule:
# - cron: '0 6 * * *'
env:
NAMESPACE: NAMESPACE
COLLECTION_NAME: COLLECTION_NAME
# Run CI once per day (at 06:00 UTC)
schedule:
- cron: '0 6 * * *'
jobs:
@ -30,19 +21,19 @@ jobs:
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
runs-on: ubuntu-latest
steps:
# ansible-test requires the collection to be in a directory in the form
# .../ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/
# .../ansible_collections/community/routeros/
- name: Check out code
uses: actions/checkout@v2
with:
path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
path: ansible_collections/community/routeros
- name: Set up Python
uses: actions/setup-python@v2
@ -55,12 +46,15 @@ jobs:
- name: Install ansible-base (${{ matrix.ansible }})
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check
- name: Install collection dependencies
run: ansible-galaxy collection install ansible.netcommon -p .
# run ansible-test sanity inside of Docker.
# The docker container has all the pinned dependencies that are required
# and all python versions ansible supports.
- name: Run sanity tests
run: ansible-test sanity --docker -v --color
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
working-directory: ./ansible_collections/community/routeros
###
# Unit tests (OPTIONAL)
@ -75,7 +69,7 @@ jobs:
fail-fast: true
matrix:
ansible:
# - stable-2.9 # Only if your collection supports Ansible 2.9
- stable-2.9
- stable-2.10
- devel
python:
@ -94,32 +88,30 @@ jobs:
- name: Check out code
uses: actions/checkout@v2
with:
path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
path: ansible_collections/community/routeros
- name: Set up Python ${{ matrix.ansible }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
python-version: 3.8
- 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/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
working-directory: ./ansible_collections/community/routeros
# 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/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
working-directory: ./ansible_collections/community/routeros
# See the reports at https://codecov.io/gh/ansible_collections/GITHUBORG/REPONAME
# See the reports at https://codecov.io/gh/ansible_collections/ansible-collections/community.routeros
- uses: codecov/codecov-action@v1
with:
fail_ci_if_error: false
@ -134,58 +126,56 @@ jobs:
# 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 }}})
strategy:
fail-fast: false
matrix:
ansible:
# - stable-2.9 # Only if your collection supports Ansible 2.9
- stable-2.10
- devel
python:
- 2.6
- 2.7
- 3.5
- 3.6
- 3.7
- 3.8
- 3.9
exclude:
- ansible: stable-2.9
python: 3.9
steps:
- name: Check out code
uses: actions/checkout@v2
with:
path: ansible_collections/${{env.NAMESPACE}}/${{env.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 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 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/${{env.NAMESPACE}}/${{env.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/${{env.NAMESPACE}}/${{env.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
# integration:
# runs-on: ubuntu-latest
# name: I (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }}})
# strategy:
# fail-fast: false
# matrix:
# ansible:
# - stable-2.9
# - stable-2.10
# - devel
# python:
# - 2.6
# - 2.7
# - 3.5
# - 3.6
# - 3.7
# - 3.8
# - 3.9
# exclude:
# - ansible: stable-2.9
# python: 3.9
#
# steps:
# - name: Check out code
# uses: actions/checkout@v2
# with:
# path: ansible_collections/community/routeros
#
# - name: Set up Python ${{ matrix.ansible }}
# uses: actions/setup-python@v2
# with:
# python-version: 3.8
#
# - name: Install ansible-base (${{ matrix.ansible }})
# run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check
#
# - name: Install collection dependencies
# run: ansible-galaxy collection install ansible.netcommon -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/community/routeros
#
# # 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/community/routeros
#
# # See the reports at https://codecov.io/gh/ansible_collections/ansible-collections/community.routeros
# - uses: codecov/codecov-action@v1
# with:
# fail_ci_if_error: false