| 1 |
name: CI |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: [main] |
| 6 |
pull_request: |
| 7 |
schedule: |
| 8 |
- cron: '0 3 * * *' |
| 9 |
|
| 10 |
jobs: |
| 11 |
build: |
| 12 |
name: Build collection |
| 13 |
runs-on: ubuntu-latest |
| 14 |
strategy: |
| 15 |
fail-fast: false |
| 16 |
matrix: |
| 17 |
ansible-version: [stable-2.19] |
| 18 |
steps: |
| 19 |
- name: Check out code |
| 20 |
uses: actions/checkout@v3 |
| 21 |
|
| 22 |
- name: Set up Python 3.13 |
| 23 |
uses: actions/setup-python@v4 |
| 24 |
with: |
| 25 |
python-version: 3.13 |
| 26 |
|
| 27 |
- name: Install ansible (${{ matrix.ansible-version }}) |
| 28 |
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible-version }}.tar.gz --disable-pip-version-check |
| 29 |
|
| 30 |
- name: Build a collection tarball |
| 31 |
run: ansible-galaxy collection build --output-path "${GITHUB_WORKSPACE}/.cache/collection-tarballs" |
| 32 |
|
| 33 |
- name: Store migrated collection artifacts |
| 34 |
uses: actions/[email protected] |
| 35 |
with: |
| 36 |
name: collection |
| 37 |
path: .cache/collection-tarballs |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
unit: |
| 45 |
name: Unit Tests (Ⓐ${{ matrix.ansible }} with ${{ matrix.python }} python) |
| 46 |
needs: [build] |
| 47 |
runs-on: ubuntu-latest |
| 48 |
strategy: |
| 49 |
fail-fast: false |
| 50 |
matrix: |
| 51 |
python: ['3.11', '3.12', '3.13'] |
| 52 |
ansible: |
| 53 |
- stable-2.17 |
| 54 |
- stable-2.18 |
| 55 |
- stable-2.19 |
| 56 |
- devel |
| 57 |
exclude: |
| 58 |
- ansible: devel |
| 59 |
python: '3.11' |
| 60 |
- ansible: devel |
| 61 |
python: '3.12' |
| 62 |
- ansible: devel |
| 63 |
python: '3.13' |
| 64 |
- ansible: stable-2.17 |
| 65 |
python: '3.13' |
| 66 |
|
| 67 |
steps: |
| 68 |
- name: Perform unit testing with ansible-test |
| 69 |
uses: ansible-community/ansible-test-gh-action@release/v1 |
| 70 |
with: |
| 71 |
testing-type: units |
| 72 |
coverage: always |
| 73 |
ansible-core-version: ${{ matrix.ansible }} |
| 74 |
target-python-version: ${{ matrix.python }} |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
sanity: |
| 82 |
name: Sanity (Ⓐ${{ matrix.ansible }} with ${{ matrix.python }} python) |
| 83 |
runs-on: ubuntu-latest |
| 84 |
needs: [build] |
| 85 |
strategy: |
| 86 |
fail-fast: false |
| 87 |
matrix: |
| 88 |
python: ['3.11', '3.12', '3.13'] |
| 89 |
ansible: |
| 90 |
- stable-2.17 |
| 91 |
- stable-2.18 |
| 92 |
- stable-2.19 |
| 93 |
- devel |
| 94 |
exclude: |
| 95 |
- ansible: devel |
| 96 |
python: '3.11' |
| 97 |
- ansible: devel |
| 98 |
python: '3.12' |
| 99 |
- ansible: devel |
| 100 |
python: '3.13' |
| 101 |
- ansible: stable-2.17 |
| 102 |
python: '3.13' |
| 103 |
steps: |
| 104 |
- name: Perform sanity testing |
| 105 |
uses: ansible-community/ansible-test-gh-action@release/v1 |
| 106 |
with: |
| 107 |
ansible-core-version: ${{ matrix.ansible }} |
| 108 |
target-python-version: ${{ matrix.python }} |
| 109 |
testing-type: sanity |
| 110 |
pull-request-change-detection: true |
| 111 |
coverage: never |
| 112 |
|
| 113 |
lint: |
| 114 |
name: Ansible lint |
| 115 |
runs-on: ubuntu-latest |
| 116 |
needs: [build] |
| 117 |
strategy: |
| 118 |
fail-fast: false |
| 119 |
matrix: |
| 120 |
python-version: ["3.13"] |
| 121 |
ansible-version: [stable-2.19, devel] |
| 122 |
|
| 123 |
steps: |
| 124 |
|
| 125 |
- name: Checkout the source code |
| 126 |
uses: actions/checkout@v3 |
| 127 |
with: |
| 128 |
fetch-depth: 0 |
| 129 |
|
| 130 |
- name: Set up Python ${{ matrix.python-version }} |
| 131 |
uses: actions/setup-python@v4 |
| 132 |
with: |
| 133 |
python-version: ${{ matrix.python-version }} |
| 134 |
|
| 135 |
- name: Install ansible (${{ matrix.ansible-version }}) version |
| 136 |
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible-version }}.tar.gz --disable-pip-version-check |
| 137 |
|
| 138 |
- name: Install ansible lint |
| 139 |
run: pip install ansible-lint --disable-pip-version-check |
| 140 |
|
| 141 |
- name: Download migrated collection artifacts |
| 142 |
uses: actions/[email protected] |
| 143 |
with: |
| 144 |
name: collection |
| 145 |
path: .cache/collection-tarballs |
| 146 |
|
| 147 |
- name: Install collection build |
| 148 |
run: ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz |
| 149 |
|
| 150 |
- name: Run Ansible lint |
| 151 |
run: ansible-lint --show-relpath |
| 152 |
working-directory: /home/runner/work/ansible-unity/ansible-unity |