| 1 |
name: Plugins CI |
| 2 |
on: |
| 3 |
push: |
| 4 |
paths: |
| 5 |
- 'plugins/**' |
| 6 |
- 'tests/**' |
| 7 |
- '.github/workflows/ansible-test-plugins.yml' |
| 8 |
pull_request: |
| 9 |
paths: |
| 10 |
- 'plugins/**' |
| 11 |
- 'tests/**' |
| 12 |
- '.github/workflows/ansible-test-plugins.yml' |
| 13 |
schedule: |
| 14 |
- cron: '0 6 * * *' |
| 15 |
|
| 16 |
env: |
| 17 |
clickhouse_version_file: "./ansible_collections/community/clickhouse/tests/integration/targets/setup_clickhouse/vars/main.yml" |
| 18 |
clickhouse_test_info_file: "./ansible_collections/community/clickhouse/tests/integration/targets/clickhouse_info/tasks/initial.yml" |
| 19 |
|
| 20 |
jobs: |
| 21 |
sanity: |
| 22 |
name: "Sanity (Python: ${{ matrix.python }}, Ansible: ${{ matrix.ansible }})" |
| 23 |
runs-on: ubuntu-latest |
| 24 |
strategy: |
| 25 |
matrix: |
| 26 |
ansible: |
| 27 |
- stable-2.17 |
| 28 |
- stable-2.18 |
| 29 |
- stable-2.19 |
| 30 |
- stable-2.20 |
| 31 |
- devel |
| 32 |
steps: |
| 33 |
|
| 34 |
- name: Check out code |
| 35 |
uses: actions/checkout@v6 |
| 36 |
with: |
| 37 |
path: ansible_collections/community/clickhouse |
| 38 |
|
| 39 |
- name: Set up Python |
| 40 |
uses: actions/setup-python@v6 |
| 41 |
with: |
| 42 |
python-version: "3.12" |
| 43 |
|
| 44 |
- name: Install ansible-base (${{ matrix.ansible }}) |
| 45 |
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check |
| 46 |
|
| 47 |
- name: Run sanity tests |
| 48 |
run: ansible-test sanity --docker -v --color |
| 49 |
working-directory: ./ansible_collections/community/clickhouse |
| 50 |
|
| 51 |
units: |
| 52 |
runs-on: ubuntu-latest |
| 53 |
name: Units (Ⓐ${{ matrix.ansible }}) |
| 54 |
strategy: |
| 55 |
# As soon as the first unit test fails, |
| 56 |
# cancel the others to free up the CI queue |
| 57 |
fail-fast: true |
| 58 |
matrix: |
| 59 |
ansible: |
| 60 |
- stable-2.17 |
| 61 |
- stable-2.18 |
| 62 |
- stable-2.19 |
| 63 |
- stable-2.20 |
| 64 |
- devel |
| 65 |
|
| 66 |
steps: |
| 67 |
- name: Check out code |
| 68 |
uses: actions/checkout@v6 |
| 69 |
with: |
| 70 |
path: ./ansible_collections/community/clickhouse |
| 71 |
|
| 72 |
- name: Set up Python |
| 73 |
uses: actions/setup-python@v6 |
| 74 |
with: |
| 75 |
python-version: "3.12" |
| 76 |
|
| 77 |
- name: Install ansible-base (${{ matrix.ansible }}) |
| 78 |
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check |
| 79 |
|
| 80 |
- name: Instal clickhouse-driver |
| 81 |
run: pip install clickhouse-driver |
| 82 |
|
| 83 |
# Run the unit tests |
| 84 |
- name: Run unit test |
| 85 |
run: ansible-test units -v --color --python 3.10 --docker --coverage |
| 86 |
working-directory: ./ansible_collections/community/clickhouse |
| 87 |
|
| 88 |
# ansible-test support producing code coverage date |
| 89 |
- name: Generate coverage report |
| 90 |
run: ansible-test coverage xml -v --requirements --group-by command --group-by version |
| 91 |
working-directory: ./ansible_collections/community/clickhouse |
| 92 |
|
| 93 |
# See the reports at https://codecov.io/gh/GITHUBORG/REPONAME |
| 94 |
- uses: codecov/codecov-action@v5 |
| 95 |
with: |
| 96 |
fail_ci_if_error: false |
| 97 |
|
| 98 |
integration: |
| 99 |
name: "Integration (Python: ${{ matrix.python }}, Ansible: ${{ matrix.ansible }}, ClickHouse: ${{ matrix.clickhouse }}" |
| 100 |
runs-on: ubuntu-latest |
| 101 |
strategy: |
| 102 |
fail-fast: false |
| 103 |
matrix: |
| 104 |
ansible: |
| 105 |
- stable-2.18 |
| 106 |
- stable-2.19 |
| 107 |
- stable-2.20 |
| 108 |
- devel |
| 109 |
clickhouse: |
| 110 |
- 23.8.16.40 |
| 111 |
- 24.8.14.39 |
| 112 |
- 25.3.3.42 |
| 113 |
python: |
| 114 |
- "3.12" |
| 115 |
steps: |
| 116 |
|
| 117 |
- name: Check out code |
| 118 |
uses: actions/checkout@v6 |
| 119 |
with: |
| 120 |
path: ansible_collections/community/clickhouse |
| 121 |
|
| 122 |
- name: Set up Python |
| 123 |
uses: actions/setup-python@v6 |
| 124 |
with: |
| 125 |
python-version: "3.12" |
| 126 |
|
| 127 |
- name: Install ansible-base (${{ matrix.ansible }}) |
| 128 |
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check |
| 129 |
|
| 130 |
- name: Set Clickhouse version (${{ matrix.clickhouse }}) |
| 131 |
run: "sed -i 's/^clickhouse_version:.*/clickhouse_version: \"${{ matrix.clickhouse }}\"/g' ${{ env.clickhouse_version_file }}" |
| 132 |
|
| 133 |
- name: Run integration tests |
| 134 |
run: ansible-test integration --docker ubuntu2404 -v --color --retry-on-error --continue-on-error --python ${{ matrix.python }} --diff --coverage |
| 135 |
working-directory: ./ansible_collections/community/clickhouse |
| 136 |
|
| 137 |
- name: Generate coverage report. |
| 138 |
run: ansible-test coverage xml -v --requirements --group-by command --group-by version |
| 139 |
working-directory: ./ansible_collections/community/clickhouse |
| 140 |
|
| 141 |
- uses: codecov/codecov-action@v5 |
| 142 |
with: |
| 143 |
fail_ci_if_error: false |