-
Notifications
You must be signed in to change notification settings - Fork 5
118 lines (106 loc) · 3.32 KB
/
test-integration.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
name: Collection Integration tests
on:
schedule:
- cron: "0 5 * * *" # UTC
push:
tags: "v*"
branches:
- "test/**"
jobs:
integration-test:
name: >-
Integration test on ansible-core ${{ matrix.ansible }}
using Python ${{ matrix.python }}
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ansible_collections/cloudscale_ch/cloud
strategy:
max-parallel: 1
fail-fast: false
matrix:
ansible:
- 2.13
- 2.14
- 2.15
include:
- ansible: 2.13
python: 3.8
- ansible: 2.14
python: 3.9
- ansible: 2.15
python: 3.9
steps:
- name: Check out code
uses: actions/checkout@v3
with:
path: ansible_collections/cloudscale_ch/cloud
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install ansible and collection dependencies
run: |
python -m pip install --upgrade pip
# Install the latest ansible-core patchlevel version
pip install 'ansible-core~=${{ matrix.ansible }}.0'
pip install -r tests/requirements.txt
- name: Build and install collection
run: |
ansible-galaxy collection build .
ansible-galaxy collection install *.gz
- name: Add config file
env:
CONFIG_FILE: ${{ secrets.CONFIG_FILE }}
INI_FILE: tests/integration/cloud-config-cloudscale.ini
run: |
echo -n "$CONFIG_FILE" > $INI_FILE && [ -s $INI_FILE ] || (>&2 echo no secrets provided; exit 1)
- name: Ensure no other integration test is currently running
uses: softprops/turnstyle@v1
timeout-minutes: 60
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
same-branch-only: false
- name: Run the tests
run: >-
ansible-test
integration
--docker
--python ${{ matrix.python }}
-v
--diff
--color
--allow-unsupported
--continue-on-error
--coverage
cloud/cloudscale/
- name: Generate coverage report.
run: >-
ansible-test
coverage xml
-v
--requirements
--group-by command
--group-by version
- uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
- name: Send mail in case of failure
id: send_mail
if: ${{ failure() && github.event_name == 'schedule' }}
shell: python3 {0}
run: |
from smtplib import SMTP
from email.message import EmailMessage
email = EmailMessage()
email['TO'] = '${{ secrets.CRON_RCPT }}'
email['FROM'] = '[email protected]'
email['Subject'] = 'Ansible Cloud Module Integration Test Failure'
email.set_content("""
Integration tests using ansible-core ${{ matrix.ansible }} on Python ${{ matrix.python }} failed:
https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
""")
with SMTP('${{ secrets.MAILSERVER }}') as smtp:
smtp.starttls()
smtp.send_message(email)