-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (118 loc) · 4.25 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
132
133
134
135
136
137
name: ansible-test
on:
push:
pull_request:
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
env:
COLL_NS: flowerysong
COLL_NAME: hvault
PYTHON_VERSION: 3.12
ANSIBLE_COLLECTIONS_PATHS: ${{ github.workspace }}
jobs:
build_collection:
name: build collection
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install 'git+https://github.com/ansible/[email protected]#egg=ansible-core'
- name: Build collection
run: ansible-galaxy collection build -vv
- name: Install collection
run: ansible-galaxy collection install ${{ env.COLL_NS }}-${{ env.COLL_NAME }}-*.tar.gz
- name: Make sure metadata is up to date
run: |
./update-meta.py
git diff
git status --porcelain | grep -q '^ M' && exit 1 || exit 0
- name: Upload collection
uses: actions/upload-artifact@v4
with:
path: ${{ env.COLL_NS }}-${{ env.COLL_NAME }}-*.tar.gz
name: ${{ env.COLL_NS }}-${{ env.COLL_NAME }}
static_analysis:
needs: build_collection
name: static analysis (${{ matrix.ansible_version }}, py${{ matrix.python_version }})
strategy:
fail-fast: false
matrix:
python_version:
- 3.12
ansible_version:
- stable-2.16
- stable-2.17
- devel
include:
- ansible_version: stable-2.15
python_version: 3.11
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install 'git+https://github.com/ansible/ansible@${{ matrix.ansible_version }}#egg=ansible-core' pycodestyle pylint pyyaml voluptuous yamllint junit-xml
- name: Download collection
uses: actions/download-artifact@v4
with:
name: ${{ env.COLL_NS }}-${{ env.COLL_NAME }}
- name: Install collection
run: ansible-galaxy collection install ${{ env.COLL_NS }}-${{ env.COLL_NAME }}-*.tar.gz
- name: Run tests
run: ansible-test sanity -v --color --docker
working-directory: ./ansible_collections/${{ env.COLL_NS }}/${{ env.COLL_NAME }}
integration:
name: integration (${{ matrix.ansible_version }}, py${{ matrix.python_version }}, Vault ${{ matrix.vault_version }})
needs: build_collection
strategy:
fail-fast: false
matrix:
python_version:
- 3.12
ansible_version:
- stable-2.16
- devel
vault_version:
- 1.14.8
include:
# More Python versions
- python_version: 3.9
ansible_version: stable-2.15
vault_version: 1.14.8
- python_version: 3.11
ansible_version: stable-2.15
vault_version: 1.14.8
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install 'git+https://github.com/ansible/ansible@${{ matrix.ansible_version }}#egg=ansible-core' pyyaml junit-xml
- name: Download collection
uses: actions/download-artifact@v4
with:
name: ${{ env.COLL_NS }}-${{ env.COLL_NAME }}
- name: Install collection
run: ansible-galaxy collection install ${{ env.COLL_NS }}-${{ env.COLL_NAME }}-*.tar.gz
- name: Set Vault version
run: "echo 'vault_version: ${{ matrix.vault_version }}' > tests/integration/integration_config.yml"
working-directory: ./ansible_collections/${{ env.COLL_NS }}/${{ env.COLL_NAME }}
- name: Run integration tests
run: ansible-test integration -vvv --color
working-directory: ./ansible_collections/${{ env.COLL_NS }}/${{ env.COLL_NAME }}