-
Notifications
You must be signed in to change notification settings - Fork 15
131 lines (118 loc) · 3.99 KB
/
ansible-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# This file implements a Github action to run Ansible collection sanity tests
# and unit tests on the Conjur Ansible Collection. The Ansible collection tests
# are run across the following matrices:
#
# Ansible versions (Python versions):
# - stable-2.13 (3.8, 3.9, 3.10)
# - stable-2.14 (3.9, 3.10, 3.11)
# - stable-2.15 (3.9, 3.10, 3.11)
# - stable-2.16 (3.10, 3.11, 3.12)
# - devel (3.11)
#
# As Ansible's devel version is unstable, it should be considered a smoke signal
# for the next released version. Failures against the devel version should not
# be considered blocking.
name: CI
on:
# Run CI against all pushes (direct commits) and Pull Requests
- push
- pull_request
jobs:
###
# Sanity tests
#
# https://docs.ansible.com/ansible/latest/dev_guide/testing_sanity.html
sanity:
name: Sanity (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }})
strategy:
# fail-fast means one failing matrix case will cancel all other
# still-incomplete cases. As tests against Ansible's devel branch are
# unstable, this is disabled.
fail-fast: false
matrix:
ansible:
- stable-2.13
- stable-2.14
- stable-2.15
python:
- '3.9'
- '3.10'
include:
- ansible: stable-2.13
python: '3.8'
- ansible: stable-2.14
python: '3.11'
- ansible: stable-2.15
python: '3.11'
- ansible: stable-2.16
python: '3.10'
- ansible: stable-2.16
python: '3.11'
- ansible: stable-2.16
python: '3.12'
- ansible: devel
python: '3.11'
runs-on: ubuntu-latest
steps:
# ansible-test requires the collection to be in a directory in the form
# .../ansible_collections/cyberark/conjur/
- name: Check out code
uses: actions/checkout@v3
with:
path: ansible_collections/cyberark/conjur
- name: Set up Python ${{ matrix.ansible }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
# Install the head of the given branch
- name: Install ansible-base (${{ matrix.ansible }})
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check
# run ansible-test sanity inside of Docker.
# The docker container has all the pinned dependencies that are required.
# Explicitly specify the version of Python we want to test
- name: Run sanity tests
run: ansible-test sanity --docker -v --color --python ${{ matrix.python }} --exclude dev/ --exclude ci/ --exclude secrets.yml
working-directory: ./ansible_collections/cyberark/conjur
###
# Unit tests
#
# https://docs.ansible.com/ansible/latest/dev_guide/testing_units.html
units:
name: Units (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }})
strategy:
# fail-fast means one failing matrix case will cancel all other
# still-incomplete cases. As tests against Ansible's devel branch are
# unstable, this is disabled.
fail-fast: false
matrix:
ansible:
- stable-2.13
- stable-2.14
- stable-2.15
python:
- '3.9'
- '3.10'
include:
- ansible: stable-2.13
python: '3.8'
- ansible: stable-2.14
python: '3.11'
- ansible: stable-2.15
python: '3.11'
- ansible: stable-2.16
python: '3.10'
- ansible: stable-2.16
python: '3.11'
- ansible: stable-2.16
python: '3.12'
- ansible: devel
python: '3.11'
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
with:
path: ansible_collections/cyberark/conjur
- name: Run unit tests
run: ./dev/test_unit.sh -a ${{ matrix.ansible }} -p ${{ matrix.python }}
working-directory: ./ansible_collections/cyberark/conjur