-
Notifications
You must be signed in to change notification settings - Fork 55
132 lines (106 loc) · 4.32 KB
/
main.yml
File metadata and controls
132 lines (106 loc) · 4.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the develop branch
push:
branches: [develop, main]
pull_request:
branches: [develop, main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
name: Build DCNM collection
runs-on: ubuntu-latest
strategy:
matrix:
ansible: [2.15.13, 2.16.14, 2.17.12, 2.18.6]
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up Python "3.11"
uses: actions/setup-python@v1
with:
python-version: "3.11"
- name: Install ansible-base (v${{ matrix.ansible }})
run: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check
- name: Build a DCNM collection tarball
run: ansible-galaxy collection build --output-path "${GITHUB_WORKSPACE}/.cache/v${{ matrix.ansible }}/collection-tarballs"
- name: Store migrated collection artifacts
uses: actions/upload-artifact@v4.4.0
with:
name: collection_v${{ matrix.ansible }}
path: .cache/v${{ matrix.ansible }}/collection-tarballs
overwrite: true
sanity:
name: Run ansible-sanity tests
needs:
- build
runs-on: ubuntu-latest
strategy:
matrix:
ansible: [2.15.13, 2.16.14, 2.17.12, 2.18.6]
python: ["3.10", "3.11"]
exclude:
- ansible: 2.18.6
python: "3.10"
steps:
- name: Set up Python (v${{ matrix.python }})
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}
- name: Install ansible-base (v${{ matrix.ansible }})
run: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check
- name: Download migrated collection artifacts
uses: actions/download-artifact@v4.1.7
with:
name: collection_v${{ matrix.ansible }}
path: .cache/v${{ matrix.ansible }}/collection-tarballs
- name: Install the collection tarball
run: ansible-galaxy collection install .cache/v${{ matrix.ansible }}/collection-tarballs/*.tar.gz
- name: Run sanity tests
run: ansible-test sanity --docker --python ${{matrix.python}} -v --color --truncate 0
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/dcnm
unit-tests:
name: Run DCNM Unit Tests
needs:
- build
runs-on: ubuntu-latest
strategy:
matrix:
ansible: [2.15.13, 2.16.14, 2.17.12, 2.18.6]
steps:
- name: Set up Python "3.11"
uses: actions/setup-python@v1
with:
python-version: "3.11"
- name: Install ansible-base (v${{ matrix.ansible }})
run: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check
- name: Install Pydantic (v2)
run: pip install pydantic==2.11.10
- name: Install Requests
run: pip install requests==2.32.5
- name: Install DeepDiff (v8.5.0)
run: pip install deepdiff==8.5.0
- name: Install coverage (v7.3.4)
run: pip install coverage==7.3.4
- name: Install pytest (v7.4.4)
run: pip install pytest==7.4.4
- name: Download migrated collection artifacts
uses: actions/download-artifact@v4.1.7
with:
name: collection_v${{ matrix.ansible }}
path: .cache/v${{ matrix.ansible }}/collection-tarballs
- name: Install the collection tarball
run: ansible-galaxy collection install .cache/v${{ matrix.ansible }}/collection-tarballs/*.tar.gz
- name: Run DCNM Unit tests
run: coverage run --source=. -m pytest tests/unit/. -vvvv
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/dcnm
env:
PYTHONPATH: /home/runner/.ansible/collections
- name: Generate coverage report
run: coverage report
working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/dcnm