|
| 1 | +--- |
| 2 | +version: 2.1 |
| 3 | +aliases: |
| 4 | + - &linting_and_unit_tests |
| 5 | + - "linting" |
| 6 | + - "test" |
| 7 | + - &linting_test |
| 8 | + - "linting" |
| 9 | + - &unit_test |
| 10 | + - "test" |
| 11 | +executors: |
| 12 | + linux: |
| 13 | + docker: |
| 14 | + - image: "circleci/python:3.7.10" |
| 15 | +orbs: |
| 16 | + # The python orb contains a set of prepackaged CircleCI configuration you can use repeatedly in your configuration |
| 17 | + # files |
| 18 | + # Orb commands and jobs help you with common scripting around a language/tool |
| 19 | + # so you dont have to copy and paste it everywhere. |
| 20 | + # See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/python |
| 21 | + python: "circleci/python@1.2" |
| 22 | +workflows: |
| 23 | + TestFlow: # This is the name of the workflow, feel free to change it to better match your workflow. |
| 24 | + # Inside the workflow, you define the jobs you want to run. |
| 25 | + # For more details on extending your workflow, see the configuration docs: |
| 26 | + # https://circleci.com/docs/2.0/configuration-reference/#workflows |
| 27 | + jobs: |
| 28 | + - "linting" |
| 29 | + - test: |
| 30 | + requires: *linting_test |
| 31 | + - "integration_nautobot": |
| 32 | + requires: *unit_test |
| 33 | + - "integration_netbox28": |
| 34 | + requires: *unit_test |
| 35 | + - "integration_netbox29": |
| 36 | + requires: *unit_test |
| 37 | + - "integration_netbox210": |
| 38 | + requires: *unit_test |
| 39 | + |
| 40 | +jobs: |
| 41 | + linting: |
| 42 | + docker: |
| 43 | + - image: "circleci/python:3.7.10" # primary container for the build job |
| 44 | + environment: |
| 45 | + INVOKE_LOCAL: "True" |
| 46 | + steps: |
| 47 | + - "checkout" |
| 48 | + # - python/install-packages: |
| 49 | + # pkg-manager: poetry |
| 50 | + - run: |
| 51 | + command: "pip install --upgrade wheel pip" |
| 52 | + name: "Upgrade Pip" |
| 53 | + - run: |
| 54 | + command: "pip install invoke poetry toml" |
| 55 | + name: "Install pip packages" |
| 56 | + - run: |
| 57 | + command: "poetry config virtualenvs.create false" |
| 58 | + name: "Poetry config virtual envs" |
| 59 | + - run: |
| 60 | + command: "poetry config installer.parallel false" |
| 61 | + name: "Poetry config parallel" |
| 62 | + - run: |
| 63 | + command: "poetry install --no-interaction --no-ansi --no-root" |
| 64 | + name: "Install application" |
| 65 | + - run: |
| 66 | + command: "invoke black" |
| 67 | + - run: |
| 68 | + command: "invoke bandit" |
| 69 | + - run: |
| 70 | + command: "invoke pydocstyle" |
| 71 | + - run: |
| 72 | + command: "invoke flake8" |
| 73 | + - run: |
| 74 | + command: "invoke yamllint" |
| 75 | + - run: |
| 76 | + command: "invoke pylint" |
| 77 | + test: |
| 78 | + machine: |
| 79 | + image: "ubuntu-2004:202104-01" |
| 80 | + steps: |
| 81 | + - "checkout" |
| 82 | + - run: |
| 83 | + name: "Change to Python 3.7 package on system" |
| 84 | + command: | |
| 85 | + pyenv versions |
| 86 | + pyenv global 3.9.4 |
| 87 | + which pip |
| 88 | + pip -V |
| 89 | + - run: |
| 90 | + name: "Install python packages" |
| 91 | + command: "pip install --upgrade wheel pip toml invoke" |
| 92 | + - run: |
| 93 | + name: "Build Test Image" |
| 94 | + command: "invoke build-image --nocache" |
| 95 | + - run: |
| 96 | + name: "Run Unit Tests" |
| 97 | + command: "invoke pytest" |
| 98 | + integration_nautobot: |
| 99 | + machine: |
| 100 | + image: "ubuntu-2004:202104-01" |
| 101 | + steps: |
| 102 | + - "checkout" |
| 103 | + - run: |
| 104 | + name: "Nautobot Test" |
| 105 | + command: | |
| 106 | + pyenv versions |
| 107 | + pyenv global 3.9.4 |
| 108 | + which pip |
| 109 | + pip -V |
| 110 | + pip install --upgrade pip wheel |
| 111 | + pip install invoke toml poetry pynautobot ansible==2.10.7 |
| 112 | + ansible-galaxy collection install networktocode.nautobot |
| 113 | + poetry config virtualenvs.create false |
| 114 | + poetry config installer.parallel false |
| 115 | + poetry install |
| 116 | + invoke nautobot-integration-tests |
| 117 | + environment: |
| 118 | + NAUTOBOT_VERSION: "1.0.1" |
| 119 | + integration_netbox210: |
| 120 | + machine: |
| 121 | + image: "ubuntu-2004:202104-01" |
| 122 | + steps: |
| 123 | + - "checkout" |
| 124 | + - run: |
| 125 | + name: "NetBox 2.10 Test" |
| 126 | + command: | |
| 127 | + pyenv versions |
| 128 | + pyenv global 3.9.4 |
| 129 | + which pip |
| 130 | + pip -V |
| 131 | + pip install invoke toml poetry pynetbox ansible==2.10.7 |
| 132 | + ansible-galaxy collection install git+https://github.com/netbox-community/ansible_modules.git,v3.0.0 |
| 133 | + poetry config virtualenvs.create false |
| 134 | + poetry config installer.parallel false |
| 135 | + poetry install |
| 136 | + invoke integration-tests |
| 137 | + environment: |
| 138 | + NETBOX_VERSION: "v2.10" |
| 139 | + integration_netbox29: |
| 140 | + machine: |
| 141 | + image: "ubuntu-2004:202104-01" |
| 142 | + steps: |
| 143 | + - "checkout" |
| 144 | + - run: |
| 145 | + name: "NetBox 2.9 Test" |
| 146 | + command: | |
| 147 | + pyenv versions |
| 148 | + pyenv global 3.9.4 |
| 149 | + which pip |
| 150 | + pip -V |
| 151 | + pip install invoke toml poetry pynetbox ansible==2.10.7 |
| 152 | + ansible-galaxy collection install git+https://github.com/netbox-community/ansible_modules.git,v3.0.0 |
| 153 | + poetry config virtualenvs.create false |
| 154 | + poetry config installer.parallel false |
| 155 | + poetry install |
| 156 | + invoke integration-tests |
| 157 | + environment: |
| 158 | + NETBOX_VERSION: "v2.9" |
| 159 | + integration_netbox28: |
| 160 | + machine: |
| 161 | + image: "ubuntu-2004:202104-01" |
| 162 | + steps: |
| 163 | + - "checkout" |
| 164 | + - run: |
| 165 | + name: "NetBox 2.8 Test" |
| 166 | + command: | |
| 167 | + pyenv versions |
| 168 | + pyenv global 3.9.4 |
| 169 | + which pip |
| 170 | + pip -V |
| 171 | + pip install invoke toml poetry pynetbox ansible==2.10.7 |
| 172 | + ansible-galaxy collection install git+https://github.com/netbox-community/ansible_modules.git,v3.0.0 |
| 173 | + poetry config virtualenvs.create false |
| 174 | + poetry config installer.parallel false |
| 175 | + poetry install |
| 176 | + invoke integration-tests |
| 177 | + environment: |
| 178 | + NETBOX_VERSION: "v2.8" |
0 commit comments