Skip to content

Commit 2b662d5

Browse files
committed
Initial commit
1 parent a76410e commit 2b662d5

File tree

14 files changed

+579
-859
lines changed

14 files changed

+579
-859
lines changed

.github/workflows/ansible-test.yml

Lines changed: 134 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# README FIRST
2-
# 1. replace "NAMESPACE/COLLECTION_NAME" with the correct name, ie "community/zabbix"
2+
# 1. replace "community/molecule" with the correct name, ie "community/zabbix"
33
# 2. If you don't have unit tests remove that section
44
# 3. If your collection depends on other collections ensure they are installed, see "Install collection dependencies"
55
# If you need help please ask in #ansible-devel on Freenode IRC
66

77
name: CI
88
on:
9-
# Run CI against all pushes (direct commits) and Pull Requests
10-
- push
11-
- pull_request
9+
# Run CI against all pushes (direct commits) and Pull Requests
10+
- push
11+
- pull_request
1212

1313
jobs:
1414

15-
###
16-
# Sanity tests (REQUIRED)
17-
#
18-
# https://docs.ansible.com/ansible/latest/dev_guide/testing_sanity.html
15+
###
16+
# Sanity tests (REQUIRED)
17+
#
18+
# https://docs.ansible.com/ansible/latest/dev_guide/testing_sanity.html
1919

2020
sanity:
2121
name: Sanity (Ⓐ${{ matrix.ansible }})
@@ -24,19 +24,19 @@ jobs:
2424
ansible:
2525
# It's important that Sanity is tested against all stable-X.Y branches
2626
# Testing against `devel` may fail as new tests are added.
27-
# - stable-2.9 # Only if your collection supports Ansible 2.9
27+
# - stable-2.9 # Only if your collection supports Ansible 2.9
2828
- stable-2.10
2929
- devel
3030
runs-on: ubuntu-latest
3131
steps:
3232

3333
# ansible-test requires the collection to be in a directory in the form
34-
# .../ansible_collections/NAMESPACE/COLLECTION_NAME/
34+
# .../ansible_collections/community/molecule/
3535

3636
- name: Check out code
3737
uses: actions/checkout@v2
3838
with:
39-
path: ansible_collections/NAMESPACE/COLLECTION_NAME
39+
path: ansible_collections/community/molecule
4040

4141
- name: Set up Python
4242
uses: actions/setup-python@v2
@@ -54,132 +54,126 @@ jobs:
5454
# and all python versions ansible supports.
5555
- name: Run sanity tests
5656
run: ansible-test sanity --docker -v --color
57-
working-directory: ./ansible_collections/NAMESPACE/COLLECTION_NAME
58-
59-
###
60-
# Unit tests (OPTIONAL)
61-
#
62-
# https://docs.ansible.com/ansible/latest/dev_guide/testing_units.html
63-
64-
units:
65-
runs-on: ubuntu-latest
66-
name: Units (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }})
67-
strategy:
68-
# As soon as the first unit test fails, cancel the others to free up the CI queue
69-
fail-fast: true
70-
matrix:
71-
ansible:
72-
# - stable-2.9 # Only if your collection supports Ansible 2.9
73-
- stable-2.10
74-
- devel
75-
python:
76-
- 2.6
77-
- 2.7
78-
- 3.5
79-
- 3.6
80-
- 3.7
81-
- 3.8
82-
- 3.9
83-
exclude:
84-
- ansible: stable-2.9
85-
python: 3.9
86-
87-
steps:
88-
- name: Check out code
89-
uses: actions/checkout@v2
90-
with:
91-
path: ansible_collections/NAMESPACE/COLLECTION_NAME
92-
93-
- name: Set up Python ${{ matrix.ansible }}
94-
uses: actions/setup-python@v2
95-
with:
96-
python-version: ${{ matrix.python }}
97-
98-
- name: Install ansible-base (${{ matrix.ansible }})
99-
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check
100-
101-
# OPTIONAL If your unit test requires Python libraries from other collections
102-
# Install them like this
103-
- name: Install collection dependencies
104-
run: ansible-galaxy collection install ansible.netcommon -p .
105-
106-
# Run the unit tests
107-
- name: Run unit test
108-
run: ansible-test units -v --color --python ${{ matrix.python }} --docker --coverage
109-
working-directory: ./ansible_collections/NAMESPACE/COLLECTION_NAME
110-
111-
# ansible-test support producing code coverage date
112-
- name: Generate coverage report
113-
run: ansible-test coverage xml -v --requirements --group-by command --group-by version
114-
working-directory: ./ansible_collections/NAMESPACE/COLLECTION_NAME
115-
116-
# See the reports at https://codecov.io/gh/ansible_collections/GITHUBORG/REPONAME
117-
- uses: codecov/codecov-action@v1
118-
with:
119-
fail_ci_if_error: false
120-
121-
###
122-
# Integration tests (RECOMMENDED)
123-
#
124-
# https://docs.ansible.com/ansible/latest/dev_guide/testing_integration.html
125-
126-
127-
# If the application you are testing is available as a docker container and you want to test
128-
# multiple versions see the following for an example:
129-
# https://github.com/ansible-collections/community.zabbix/tree/master/.github/workflows
130-
131-
integration:
132-
runs-on: ubuntu-latest
133-
name: I (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }}})
134-
strategy:
135-
fail-fast: false
136-
matrix:
137-
ansible:
138-
# - stable-2.9 # Only if your collection supports Ansible 2.9
139-
- stable-2.10
140-
- devel
141-
python:
142-
- 2.6
143-
- 2.7
144-
- 3.5
145-
- 3.6
146-
- 3.7
147-
- 3.8
148-
- 3.9
149-
exclude:
150-
- ansible: stable-2.9
151-
python: 3.9
152-
153-
steps:
154-
- name: Check out code
155-
uses: actions/checkout@v2
156-
with:
157-
path: ansible_collections/NAMESPACE/COLLECTION_NAME
158-
159-
- name: Set up Python ${{ matrix.ansible }}
160-
uses: actions/setup-python@v2
161-
with:
162-
python-version: ${{ matrix.python }}
163-
164-
- name: Install ansible-base (${{ matrix.ansible }})
165-
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check
166-
167-
# OPTIONAL If your integration test requires Python libraries or modules from other collections
168-
# Install them like this
169-
- name: Install collection dependencies
170-
run: ansible-galaxy collection install ansible.netcommon -p .
171-
172-
# Run the integration tests
173-
- name: Run integration test
174-
run: ansible-test integration -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker --coverage
175-
working-directory: ./ansible_collections/NAMESPACE/COLLECTION_NAME
176-
177-
# ansible-test support producing code coverage date
178-
- name: Generate coverage report
179-
run: ansible-test coverage xml -v --requirements --group-by command --group-by version
180-
working-directory: ./ansible_collections/NAMESPACE/COLLECTION_NAME
181-
182-
# See the reports at https://codecov.io/gh/ansible_collections/GITHUBORG/REPONAME
183-
- uses: codecov/codecov-action@v1
184-
with:
185-
fail_ci_if_error: false
57+
working-directory: ./ansible_collections/community/molecule
58+
59+
###
60+
# Unit tests (OPTIONAL)
61+
#
62+
# https://docs.ansible.com/ansible/latest/dev_guide/testing_units.html
63+
64+
# units:
65+
# runs-on: ubuntu-latest
66+
# name: Units (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }})
67+
# strategy:
68+
# # As soon as the first unit test fails, cancel the others to free up the CI queue
69+
# fail-fast: true
70+
# matrix:
71+
# ansible:
72+
# - stable-2.9 # Only if your collection supports Ansible 2.9
73+
# - stable-2.10
74+
# - devel
75+
# python:
76+
# - 3.6
77+
# - 3.7
78+
# - 3.8
79+
# - 3.9
80+
# exclude:
81+
# - ansible: stable-2.9
82+
# python: 3.9
83+
84+
# steps:
85+
# - name: Check out code
86+
# uses: actions/checkout@v2
87+
# with:
88+
# path: ansible_collections/community/molecule
89+
90+
# - name: Set up Python ${{ matrix.ansible }}
91+
# uses: actions/setup-python@v2
92+
# with:
93+
# python-version: ${{ matrix.python }}
94+
95+
# - name: Install ansible-base (${{ matrix.ansible }})
96+
# run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check
97+
98+
# # OPTIONAL If your unit test requires Python libraries from other collections
99+
# # Install them like this
100+
# - name: Install collection dependencies
101+
# run: ansible-galaxy collection install ansible.netcommon -p .
102+
103+
# # Run the unit tests
104+
# - name: Run unit test
105+
# run: ansible-test units -v --color --python ${{ matrix.python }} --docker --coverage
106+
# working-directory: ./ansible_collections/community/molecule
107+
108+
# # ansible-test support producing code coverage date
109+
# - name: Generate coverage report
110+
# run: ansible-test coverage xml -v --requirements --group-by command --group-by version
111+
# working-directory: ./ansible_collections/community/molecule
112+
113+
# # See the reports at https://codecov.io/gh/ansible_collections/GITHUBORG/REPONAME
114+
# - uses: codecov/codecov-action@v1
115+
# with:
116+
# fail_ci_if_error: false
117+
118+
###
119+
# Integration tests (RECOMMENDED)
120+
#
121+
# https://docs.ansible.com/ansible/latest/dev_guide/testing_integration.html
122+
123+
124+
# If the application you are testing is available as a docker container and you want to test
125+
# multiple versions see the following for an example:
126+
# https://github.com/ansible-collections/community.zabbix/tree/master/.github/workflows
127+
128+
# integration:
129+
# runs-on: ubuntu-latest
130+
# name: I (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }}})
131+
# strategy:
132+
# fail-fast: false
133+
# matrix:
134+
# ansible:
135+
# - stable-2.9 # Only if your collection supports Ansible 2.9
136+
# - stable-2.10
137+
# - devel
138+
# python:
139+
# - 3.6
140+
# - 3.7
141+
# - 3.8
142+
# - 3.9
143+
# exclude:
144+
# - ansible: stable-2.9
145+
# python: 3.9
146+
147+
# steps:
148+
# - name: Check out code
149+
# uses: actions/checkout@v2
150+
# with:
151+
# path: ansible_collections/community/molecule
152+
153+
# - name: Set up Python ${{ matrix.ansible }}
154+
# uses: actions/setup-python@v2
155+
# with:
156+
# python-version: ${{ matrix.python }}
157+
158+
# - name: Install ansible-base (${{ matrix.ansible }})
159+
# run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check
160+
161+
# # OPTIONAL If your integration test requires Python libraries or modules from other collections
162+
# # Install them like this
163+
# # - name: Install collection dependencies
164+
# # run: ansible-galaxy collection install ansible.netcommon -p .
165+
166+
# # Run the integration tests
167+
# - name: Run integration test
168+
# run: ansible-test integration -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker --coverage
169+
# working-directory: ./ansible_collections/community/molecule
170+
171+
# # ansible-test support producing code coverage date
172+
# - name: Generate coverage report
173+
# run: ansible-test coverage xml -v --requirements --group-by command --group-by version
174+
# working-directory: ./ansible_collections/community/molecule
175+
176+
# # See the reports at https://codecov.io/gh/ansible_collections/GITHUBORG/REPONAME
177+
# - uses: codecov/codecov-action@v1
178+
# with:
179+
# fail_ci_if_error: false

.github/workflows/tox.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: tox
2+
3+
on:
4+
create: # is used for publishing to PyPI and TestPyPI
5+
tags: # any tag regardless of its name, no branches
6+
push: # only publishes pushes to the main branch to TestPyPI
7+
branches: # any integration branch but not tag
8+
- "master"
9+
tags-ignore:
10+
- "**"
11+
pull_request:
12+
schedule:
13+
- cron: 1 0 * * * # Run daily at 0:01 UTC
14+
15+
jobs:
16+
build:
17+
name: ${{ matrix.tox_env }}
18+
runs-on: ubuntu-latest
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
include:
23+
- tox_env: lint
24+
25+
steps:
26+
- uses: actions/checkout@v1
27+
- name: Find python version
28+
id: py_ver
29+
shell: python
30+
if: ${{ contains(matrix.tox_env, 'py') }}
31+
run: |
32+
v = '${{ matrix.tox_env }}'.split('-')[0].lstrip('py')
33+
print('::set-output name=version::{0}.{1}'.format(v[0],v[1:]))
34+
# Even our lint and other envs need access to tox
35+
- name: Install a default Python
36+
uses: actions/setup-python@v2
37+
if: ${{ ! contains(matrix.tox_env, 'py') }}
38+
# Be sure to install the version of python needed by a specific test, if necessary
39+
- name: Set up Python version
40+
uses: actions/setup-python@v2
41+
if: ${{ contains(matrix.tox_env, 'py') }}
42+
with:
43+
python-version: ${{ steps.py_ver.outputs.version }}
44+
- name: Install dependencies
45+
run: |
46+
python -m pip install -U pip
47+
pip install tox
48+
- name: Run tox -e ${{ matrix.tox_env }}
49+
run: |
50+
echo "${{ matrix.PREFIX }} tox -e ${{ matrix.tox_env }}"
51+
${{ matrix.PREFIX }} tox -e ${{ matrix.tox_env }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,6 @@ dmypy.json
130130

131131
# Pyre type checker
132132
.pyre/
133+
134+
# Other
135+
*.tar.gz

0 commit comments

Comments
 (0)