212 lines
5.6 KiB
YAML
212 lines
5.6 KiB
YAML
version: "2.1"
|
|
|
|
workflows:
|
|
version: 2
|
|
main_workflow:
|
|
jobs:
|
|
- sanity_test:
|
|
matrix: &matrix
|
|
parameters:
|
|
# ansible is branch name in ansible/ansible git repo
|
|
ansible:
|
|
- stable-2.9
|
|
- stable-2.10
|
|
- stable-2.11
|
|
- stable-2.12
|
|
- stable-2.13
|
|
|
|
- unit_test:
|
|
matrix: *matrix
|
|
|
|
- integration_test_git:
|
|
requires:
|
|
- sanity_test
|
|
- unit_test
|
|
matrix: *matrix
|
|
|
|
- integration_test_galaxy:
|
|
filters: { branches: { only: [ stable ] } }
|
|
requires:
|
|
- integration_test_git
|
|
matrix: *matrix
|
|
|
|
cron_master:
|
|
triggers:
|
|
- schedule:
|
|
cron: "12 5 * * 0,3"
|
|
filters: { branches: { only: [ master ] } }
|
|
jobs:
|
|
- integration_test_git:
|
|
matrix: *matrix
|
|
|
|
cron_released:
|
|
triggers:
|
|
- schedule:
|
|
cron: "12 5 * * 1,4"
|
|
filters: { branches: { only: [ stable ] } }
|
|
jobs:
|
|
- integration_test_galaxy:
|
|
matrix: *matrix
|
|
|
|
cron_ansible_devel:
|
|
triggers:
|
|
- schedule:
|
|
cron: "12 5 * * 2,5"
|
|
filters: { branches: { only: [ master ] } }
|
|
jobs:
|
|
- sanity_test:
|
|
matrix: &devel-matrix
|
|
parameters:
|
|
ansible: [ devel ]
|
|
|
|
- unit_test:
|
|
matrix: *devel-matrix
|
|
|
|
- integration_test_git:
|
|
requires:
|
|
- sanity_test
|
|
- unit_test
|
|
matrix: *devel-matrix
|
|
|
|
windows_version_check:
|
|
triggers:
|
|
- schedule:
|
|
cron: "12 3 * * 0,2,4"
|
|
filters: { branches: { only: [ master ] } }
|
|
jobs:
|
|
- windows_version_check
|
|
|
|
jobs:
|
|
sanity_test:
|
|
parameters:
|
|
ansible:
|
|
description: Ansible version to use
|
|
type: string
|
|
machine: &ci-machine
|
|
image: ubuntu-2004:202010-01
|
|
working_directory: ~/ansible_collections/sensu/sensu_go
|
|
steps:
|
|
- wrapper:
|
|
ansible: << parameters.ansible >>
|
|
kind: sanity
|
|
test_commands:
|
|
- run: make sanity
|
|
|
|
unit_test:
|
|
parameters:
|
|
ansible:
|
|
description: Ansible version to use
|
|
type: string
|
|
machine: *ci-machine
|
|
working_directory: ~/ansible_collections/sensu/sensu_go
|
|
steps:
|
|
- wrapper:
|
|
ansible: << parameters.ansible >>
|
|
kind: sanity
|
|
test_commands:
|
|
- run: make units
|
|
- store_artifacts:
|
|
path: tests/output/reports/coverage
|
|
destination: coverage-report
|
|
- store_test_results:
|
|
path: tests/output/junit
|
|
|
|
integration_test_git:
|
|
parallelism: 6
|
|
parameters:
|
|
ansible:
|
|
description: Ansible version to use
|
|
type: string
|
|
machine: *ci-machine
|
|
working_directory: ~/sensu_go
|
|
steps:
|
|
- wrapper:
|
|
ansible: << parameters.ansible >>
|
|
kind: integration
|
|
test_commands:
|
|
- run: ansible-galaxy collection build
|
|
- run: ansible-galaxy collection install sensu-sensu_go-*.tar.gz
|
|
- run_integration_tests
|
|
|
|
integration_test_galaxy:
|
|
parallelism: 6
|
|
parameters:
|
|
ansible:
|
|
description: Ansible version to use
|
|
type: string
|
|
machine: *ci-machine
|
|
working_directory: ~/sensu_go
|
|
steps:
|
|
- wrapper:
|
|
ansible: << parameters.ansible >>
|
|
kind: integration
|
|
test_commands:
|
|
- run: |
|
|
ansible-galaxy collection install \
|
|
sensu.sensu_go:$(grep version: galaxy.yml | cut -d" " -f2)
|
|
- run_integration_tests
|
|
|
|
windows_version_check:
|
|
docker:
|
|
- image: cimg/python:3.8
|
|
steps:
|
|
- checkout
|
|
- run: pip install pyyaml
|
|
- run: make check_windows_versions
|
|
|
|
commands:
|
|
run_integration_tests:
|
|
description: Run integration tests
|
|
steps:
|
|
- run: ansible-galaxy collection install community.docker
|
|
- run:
|
|
name: Display scheduled scenarios
|
|
command: |
|
|
circleci tests glob "tests/integration/molecule/*/molecule.yml" \
|
|
| circleci tests split --split-by=timings
|
|
- run: make integration_ci
|
|
- store_test_results:
|
|
path: test_results
|
|
- store_artifacts:
|
|
path: test_results
|
|
|
|
wrapper:
|
|
description: Wrapper command that takes care of venv caching
|
|
parameters:
|
|
ansible:
|
|
description: Ansible version to install
|
|
type: string
|
|
kind:
|
|
description: Test kind (used to construct cache name)
|
|
type: string
|
|
test_commands:
|
|
description: Test commands to execute
|
|
type: steps
|
|
steps:
|
|
- checkout: { path: . }
|
|
- run:
|
|
name: Generate cache id file
|
|
command: |
|
|
rm -f cache-id.txt
|
|
echo "week $(date +%V)" >> cache-id.txt
|
|
echo "ansible << parameters.ansible >>" >> cache-id.txt
|
|
echo "kind << parameters.kind >>" >> cache-id.txt
|
|
echo "cache busting string 2" >> cache-id.txt
|
|
- restore_cache:
|
|
key: '{{ checksum "cache-id.txt" }}'
|
|
- run:
|
|
name: Create virtual environment
|
|
command: python3 -m venv ${HOME}/venv
|
|
- run:
|
|
name: Activate virtualenv
|
|
command: |
|
|
echo 'export PATH=${HOME}/venv/bin:$PATH' >> $BASH_ENV
|
|
- run:
|
|
name: Install Ansible
|
|
command: pip install -U https://github.com/ansible/ansible/archive/<< parameters.ansible >>.tar.gz --disable-pip-version-check
|
|
- steps: << parameters.test_commands >>
|
|
- save_cache:
|
|
key: '{{ checksum "cache-id.txt" }}'
|
|
paths:
|
|
- "~/venv"
|