|
| 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 |
0 commit comments