Skip to content

Commit c66a75d

Browse files
committed
Add pipeline tests, gitignore, requirements.txt and issues templates.
1 parent 5b36a5f commit c66a75d

File tree

7 files changed

+753
-0
lines changed

7 files changed

+753
-0
lines changed

.github/ISSUE_TEMPLATE/Bug_Report.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
name: 🐛 Bug Report
3+
about: If something isn't working as expected 🤔.
4+
labels: bug
5+
---
6+
7+
<!--- Please keep this note for the community --->
8+
9+
### Community Note
10+
11+
* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
12+
* Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
13+
* If you are interested in working on this issue or have submitted a pull request, please leave a comment
14+
15+
<!--- Thank you for keeping this note for the community --->
16+
17+
### Description
18+
<!--- Please specify additional labels in the labels section if applicable to the issue.
19+
Possible additional labels: documentation/question --->
20+
21+
<!--- Please leave a helpful description of the feature request here. --->
22+
23+
* xxxx
24+
25+
### Affected Module Name(s):
26+
27+
<!--- Please list the affected module name(s). --->
28+
29+
* nd_XXXXX
30+
31+
### ND version and ND Platform
32+
33+
* V x.x.x and Physical/OVA/Cloud-AWS/Cloud-Azure/SaaS/all.
34+
35+
36+
### APIC version and APIC Platform for Site related issues
37+
38+
* V x.x.x and on-prem/cloud-aws/cloud-azure/all.
39+
40+
41+
### Collection versions
42+
43+
* cisco.nd x.x.x
44+
45+
### Output/ Error message
46+
47+
<!---
48+
Please provide the generated error message.
49+
--->
50+
*
51+
52+
### Expected Behavior
53+
54+
<!--- What should have happened? --->
55+
*
56+
57+
### Actual Behavior
58+
59+
<!--- What actually happened? --->
60+
*
61+
62+
### Playbook tasks to Reproduce
63+
64+
<!--- Please list the playbook tasks required to reproduce the issue. --->
65+
66+
*
67+
68+
### Important Factoids
69+
70+
<!--- Are there anything atypical about your setup that we should know? For example: Same task runs on different version of ND? --->
71+
72+
### References
73+
74+
<!---
75+
Information about referencing Github Issues: https://help.github.com/articles/basic-writing-and-formatting-syntax/#referencing-issues-and-pull-requests
76+
77+
Are there any other GitHub issues (open or closed) or pull requests that should be linked here? Vendor documentation? For example:
78+
--->
79+
80+
* #0000
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
name: 🚀 Feature Request
3+
about: I have a suggestion (might want to implement it myself 🙂)!
4+
labels: enhancement
5+
---
6+
7+
<!--- Please keep this note for the community --->
8+
9+
### Community Note
10+
11+
* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
12+
* Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
13+
* If you are interested in working on this issue or have submitted a pull request, please leave a comment
14+
15+
<!--- Thank you for keeping this note for the community --->
16+
17+
### Description
18+
<!--- Please specify additional labels in the labels section if applicable to the issue.
19+
Possible additional labels: new_module/new_plugin/documentation/feature --->
20+
21+
22+
<!--- Please leave a helpful description of the feature request here. --->
23+
24+
* xxxx
25+
26+
### New or Affected Module(s):
27+
28+
<!--- Please list the new or affected module(s). --->
29+
30+
* nd_XXXXX
31+
32+
### ND version and ND Platform
33+
34+
* V x.x.x and Physical/OVA/Cloud-AWS/Cloud-Azure/SaaS/all.
35+
36+
37+
### APIC version and APIC Platform for Site related features
38+
39+
* V x.x.x and on-prem/cloud-aws/cloud-azure/all.
40+
41+
### Collection versions
42+
43+
* cisco.nd x.x.x
44+
45+
### References
46+
47+
<!---
48+
Information about referencing Github Issues: https://help.github.com/articles/basic-writing-and-formatting-syntax/#referencing-issues-and-pull-requests
49+
50+
Are there any other GitHub issues (open or closed) or pull requests that should be linked here? Vendor blog posts or documentation? For example:
51+
52+
--->
53+
54+
* #0000

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blank_issues_enabled: false

.github/workflows/ansible-test.yml

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: master
5+
pull_request:
6+
schedule:
7+
# * is a special character in YAML so you have to quote this string
8+
- cron: '0 7 * * *'
9+
jobs:
10+
build:
11+
name: Build collection
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
ansible: [2.9.17, 2.10.5, 2.11.0]
16+
steps:
17+
- name: Check out code
18+
uses: actions/checkout@v2
19+
20+
- name: Set up Python 3.8
21+
uses: actions/setup-python@v1
22+
with:
23+
python-version: 3.8
24+
25+
- name: Install ansible-base (v${{ matrix.ansible }})
26+
run: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check
27+
28+
- name: Build a collection tarball
29+
run: ansible-galaxy collection build --output-path "${GITHUB_WORKSPACE}/.cache/collection-tarballs"
30+
31+
- name: Store migrated collection artifacts
32+
uses: actions/upload-artifact@v1
33+
with:
34+
name: collection
35+
path: .cache/collection-tarballs
36+
37+
importer:
38+
name: Galaxy-importer check
39+
needs:
40+
- build
41+
runs-on: ubuntu-latest
42+
steps:
43+
- name: Set up Python 3.8
44+
uses: actions/setup-python@v1
45+
with:
46+
python-version: 3.8
47+
48+
- name: Install ansible-base (v2.11.0)
49+
run: pip install https://github.com/ansible/ansible/archive/v2.11.0.tar.gz --disable-pip-version-check
50+
51+
- name: Download migrated collection artifacts
52+
uses: actions/download-artifact@v1
53+
with:
54+
name: collection
55+
path: .cache/collection-tarballs
56+
57+
- name: Install the collection tarball
58+
run: ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz
59+
60+
- name: Install galaxy-importer
61+
run: pip install galaxy-importer
62+
63+
- name: Create galaxy-importer directory
64+
run: sudo mkdir -p /etc/galaxy-importer
65+
66+
- name: Create galaxy-importer.cfg
67+
run: sudo cp /home/runner/.ansible/collections/ansible_collections/cisco/nd/.github/workflows/galaxy-importer.cfg /etc/galaxy-importer/galaxy-importer.cfg
68+
69+
- name: Run galaxy-importer check
70+
run: python -m galaxy_importer.main .cache/collection-tarballs/cisco-*.tar.gz | tee .cache/collection-tarballs/log.txt && sudo cp ./importer_result.json .cache/collection-tarballs/importer_result.json
71+
72+
- name: Check warnings and errors
73+
run: if grep -E 'WARNING|ERROR' .cache/collection-tarballs/log.txt; then exit 1; else exit 0; fi
74+
75+
- name: Store galaxy_importer check log file
76+
uses: actions/upload-artifact@v1
77+
with:
78+
name: galaxy-importer-log
79+
path: .cache/collection-tarballs/importer_result.json
80+
81+
82+
sanity:
83+
name: Sanity in ubuntu-latest
84+
needs:
85+
- build
86+
runs-on: ubuntu-latest
87+
strategy:
88+
matrix:
89+
ansible: [2.9.17, 2.10.5, 2.11.0]
90+
steps:
91+
- name: Set up Python 3.8
92+
uses: actions/setup-python@v1
93+
with:
94+
python-version: 3.8
95+
96+
- name: Install ansible-base (v${{ matrix.ansible }})
97+
run: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check
98+
99+
- name: Install coverage (v4.5.4)
100+
run: pip install coverage==4.5.4
101+
102+
- name: Download migrated collection artifacts
103+
uses: actions/download-artifact@v1
104+
with:
105+
name: collection
106+
path: .cache/collection-tarballs
107+
108+
- name: Install the collection tarball
109+
run: ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz
110+
111+
- name: Run sanity tests
112+
run: ansible-test sanity --docker -v --color --truncate 0
113+
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd
114+
115+
- name: Generate coverage report
116+
run: ansible-test coverage xml -v --requirements --group-by command --group-by version
117+
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd
118+
119+
- name: Push coverate report to codecov.io
120+
run: bash <(curl -s https://codecov.io/bash) -s 'tests/output/reports/' -F integration
121+
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd
122+
123+
units:
124+
name: Units in ubuntu-latest
125+
needs:
126+
- build
127+
runs-on: ubuntu-latest
128+
strategy:
129+
matrix:
130+
ansible: [2.9.17, 2.10.5, 2.11.0]
131+
steps:
132+
- name: Set up Python 3.8
133+
uses: actions/setup-python@v1
134+
with:
135+
python-version: 3.8
136+
137+
- name: Install ansible-base (v${{ matrix.ansible }})
138+
run: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check
139+
140+
- name: Install coverage (v4.5.4)
141+
run: pip install coverage==4.5.4
142+
143+
- name: Download migrated collection artifacts
144+
uses: actions/download-artifact@v1
145+
with:
146+
name: collection
147+
path: .cache/collection-tarballs
148+
149+
- name: Install the collection tarball
150+
run: ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz
151+
152+
#- name: Run unit tests
153+
# run: ansible-test units --docker -v --color --truncate 0 --python 3.8 --coverage
154+
# working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd
155+
156+
#- name: Generate coverage report.
157+
# run: ansible-test coverage xml -v --requirements --group-by command --group-by version
158+
# working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd
159+
160+
#- uses: codecov/codecov-action@v1
161+
# with:
162+
# fail_ci_if_error: false
163+
# file: /home/runner/.ansible/collections/ansible_collections/cisco/nd/tests/output/reports/coverage.xml
164+
165+
integration:
166+
name: Integration in ubuntu-latest
167+
needs:
168+
- build
169+
runs-on: ubuntu-latest
170+
steps:
171+
- name: Set up Python 3.8
172+
uses: actions/setup-python@v1
173+
with:
174+
python-version: 3.8
175+
176+
- name: Install ansible-base (v2.9.17)
177+
run: pip install https://github.com/ansible/ansible/archive/v2.9.17.tar.gz --disable-pip-version-check
178+
179+
- name: Install coverage (v4.5.4)
180+
run: pip install coverage==4.5.4
181+
182+
- name: Download migrated collection artifacts
183+
uses: actions/download-artifact@v1
184+
with:
185+
name: collection
186+
path: .cache/collection-tarballs
187+
188+
- name: Install the collection tarball
189+
run: ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz
190+
191+
- name: Requesting integration mutex
192+
uses: nev7n/wait_for_response@v1
193+
with:
194+
url: ${{ format('https://8v7s765ibh.execute-api.us-west-1.amazonaws.com/v1/ansible-nd?repo={0}', github.repository) }}
195+
responseCode: 200
196+
timeout: 2000000
197+
interval: 5000
198+
199+
- name: Run integration tests on Python 3.8
200+
run: ansible-test network-integration --docker -v --color --retry-on-error --python 3.8 --truncate 0 --continue-on-error --coverage
201+
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd
202+
203+
- name: Releasing integration mutex
204+
uses: nev7n/wait_for_response@v1
205+
if: always()
206+
with:
207+
url: ${{ format('https://8v7s765ibh.execute-api.us-west-1.amazonaws.com/v1/ansible-nd/release?repo={0}', github.repository) }}
208+
responseCode: 200
209+
210+
- name: Generate coverage report
211+
run: ansible-test coverage xml -v --requirements --group-by command --group-by version
212+
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd
213+
214+
- name: Push coverate report to codecov.io
215+
run: bash <(curl -s https://codecov.io/bash) -s 'tests/output/reports/' -F integration
216+
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/nd

.github/workflows/galaxy-importer.cfg

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[galaxy-importer]
2+
LOG_LEVEL_MAIN = INFO
3+
RUN_FLAKE8 = True
4+
RUN_ANSIBLE_DOC = True
5+
RUN_ANSIBLE_LINT = True
6+
RUN_ANSIBLE_TEST = False
7+
ANSIBLE_TEST_LOCAL_IMAGE = False
8+
LOCAL_IMAGE_DOCKER = False
9+
INFRA_OSD = False

0 commit comments

Comments
 (0)