CI #1972
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
schedule: | |
- cron: "0 3 * * *" | |
env: | |
setup_cassandra_version_file: "./tests/integration/targets/setup_cassandra/defaults/main.yml" | |
setup_ccm_version_file: "./tests/integration/targets/setup_cassandra_cluster_manager/defaults/main.yml" | |
jobs: | |
sanity: | |
runs-on: ubuntu-20.04 | |
defaults: | |
run: | |
working-directory: ansible_collections/community/cassandra | |
strategy: | |
matrix: | |
ansible_version: | |
- devel | |
- stable-2.13 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
with: | |
path: ansible_collections/community/cassandra | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install ansible-base (${{ matrix.ansible_version }}) | |
uses: nick-invision/retry@v2 | |
with: | |
timeout_minutes: 3 | |
max_attempts: 3 | |
command: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check | |
- name: Run sanity tests | |
run: ansible-test sanity --docker -v --color --python 3.9 | |
integration_matrix: | |
runs-on: ubuntu-20.04 | |
defaults: | |
run: | |
working-directory: ansible_collections/community/cassandra | |
outputs: | |
matrix: ${{ steps.json-list.outputs.modules-to-test }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
with: | |
path: ansible_collections/community/cassandra | |
- name: Generate module list | |
run: | | |
find tests/integration/targets -type d -maxdepth 1 -not -name 'setup*' | cut -d '/' -f4 | sort | awk NF | jq -sRc 'split("\n") | map(select(length > 0))' > int_test_modules.json | |
- name: Set output variable | |
id: json-list | |
run: | | |
output=$(cat int_test_modules.json) | |
echo "modules-to-test=$output" >> $GITHUB_OUTPUT | |
echo "$output" | |
integration_311x: | |
needs: integration_matrix | |
runs-on: ubuntu-20.04 | |
defaults: | |
run: | |
working-directory: ansible_collections/community/cassandra | |
strategy: | |
matrix: | |
python_version: ["3.10"] | |
ansible_version: | |
- stable-2.12 | |
- stable-2.13 | |
- devel | |
cassandra_version: | |
- package_version: "311x" | |
tar_version: "3.11.11" | |
test_scenario: | |
- docker_image: default | |
python_version: "3.6" | |
ansible_test_options: "" | |
#- docker_image: centos7 | |
# python_version: "2.7" | |
# ansible_test_options: "--docker-privileged" | |
cassandra_module: ${{ fromJson(needs.integration_matrix.outputs.matrix) }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
with: | |
path: ansible_collections/community/cassandra | |
- name: Set up Python ${{ matrix.python_version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python_version }} | |
- name: Install ansible-base (${{ matrix.ansible_version }}) | |
uses: nick-invision/retry@v2 | |
with: | |
timeout_minutes: 3 | |
max_attempts: 3 | |
command: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check | |
- name: Ensure cassandra versions are set to ${{ matrix.cassandra_version.package_version }} | ${{ matrix.cassandra_version.tar_version }} | |
run: | | |
sed -i 's/^cassandra_version:.*/cassandra_version: \"${{ matrix.cassandra_version.package_version }}\"/g' ${{ env.setup_cassandra_version_file }} | |
sed -i 's/^cassandra_version:.*/cassandra_version: \"${{ matrix.cassandra_version.tar_version }}\"/g' ${{ env.setup_ccm_version_file }} | |
- name: Install ansible.posix | |
uses: nick-invision/retry@v2 | |
with: | |
timeout_minutes: 3 | |
max_attempts: 3 | |
command: ansible-galaxy collection install ansible.posix -p ansible_collections/ | |
- name: Run integration tests on Python ${{ matrix.test_scenario.python_version }} | ${{ matrix.test_scenario.docker_image }} | ${{ matrix.ansible_version }} | ${{ matrix.cassandra_module }} | ${{ matrix.cassandra_version.package_version }} | |
run: ansible-test integration --docker ${{ matrix.test_scenario.docker_image }} ${{ matrix.test_scenario.ansible_test_options }} -v --color --retry-on-error --python ${{ matrix.test_scenario.python_version }} --continue-on-error --diff --coverage ${{ matrix.cassandra_module }} | |
- name: Generate coverage report. | |
run: ansible-test coverage xml -v --requirements --group-by command --group-by version | |
- uses: codecov/codecov-action@v1 | |
with: | |
fail_ci_if_error: false | |
- name: Upload Coverage data | |
run: tests/coverage.sh | |
integration_40x: | |
needs: integration_matrix | |
runs-on: ubuntu-20.04 | |
defaults: | |
run: | |
working-directory: ansible_collections/community/cassandra | |
strategy: | |
matrix: | |
python_version: ["3.10"] | |
ansible_version: | |
- stable-2.12 | |
- stable-2.13 | |
- devel | |
cassandra_version: | |
- package_version: "40x" | |
tar_version: "4.0.5" | |
test_scenario: | |
#- docker_image: centos7 | |
# python_version: "2.7" | |
# ansible_test_options: "--docker-privileged" | |
- docker_image: ubuntu2004 | |
python_version: "3.8" | |
ansible_test_options: "" | |
cassandra_module: ${{ fromJson(needs.integration_matrix.outputs.matrix) }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
with: | |
path: ansible_collections/community/cassandra | |
- name: Set up Python ${{ matrix.python_version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python_version }} | |
- name: Install ansible-base (${{ matrix.ansible_version }}) | |
uses: nick-invision/retry@v2 | |
with: | |
timeout_minutes: 3 | |
max_attempts: 3 | |
command: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check | |
- name: Install ansible.posix | |
uses: nick-invision/retry@v2 | |
with: | |
timeout_minutes: 3 | |
max_attempts: 3 | |
command: ansible-galaxy collection install ansible.posix -p ansible_collections/ | |
- name: Ensure cassandra versions are set to ${{ matrix.cassandra_version.package_version }} | ${{ matrix.cassandra_version.tar_version }} | |
run: | | |
sed -i 's/^cassandra_version:.*/cassandra_version: \"${{ matrix.cassandra_version.package_version }}\"/g' ${{ env.setup_cassandra_version_file }} | |
sed -i 's/^cassandra_version:.*/cassandra_version: \"${{ matrix.cassandra_version.tar_version }}\"/g' ${{ env.setup_ccm_version_file }} | |
- name: Run integration tests on Python ${{ matrix.test_scenario.python_version }} | ${{ matrix.test_scenario.docker_image }} | ${{ matrix.ansible_version }} | ${{ matrix.cassandra_module }} | ${{ matrix.cassandra_version.package_version }} | |
run: ansible-test integration --docker ${{ matrix.test_scenario.docker_image }} ${{ matrix.test_scenario.ansible_test_options }} -v --color --retry-on-error --python ${{ matrix.test_scenario.python_version }} --continue-on-error --diff --coverage ${{ matrix.cassandra_module }} | |
- name: Generate coverage report. | |
run: ansible-test coverage xml -v --requirements --group-by command --group-by version | |
- uses: codecov/codecov-action@v1 | |
with: | |
fail_ci_if_error: false | |
- name: Upload Coverage data | |
run: tests/coverage.sh |