Debian Codegraph @

ansible_collections/cloudscale_ch/cloud/.github/workflows/ansible-collection-integration-tests.yml

raw symbols SCIP
1 name: Ansible Collection Integration Tests
2
3 on:
4 schedule:
5 - cron: "0 5 * * *" # UTC
6 push:
7 tags: "v*"
8 branches:
9 - "test/**"
10 workflow_dispatch:
11 jobs:
12 integration-test:
13 name: >-
14 Integration test on ansible-core ${{ matrix.ansible }}
15 using Python ${{ matrix.python }}
16 runs-on: ubuntu-22.04
17 defaults:
18 run:
19 working-directory: ansible_collections/cloudscale_ch/cloud
20 strategy:
21 max-parallel: 1
22 fail-fast: false
23 matrix:
24 ansible:
25 - 2.13.0
26 - 2.14.0
27 - 2.15.0
28 - 2.19.0b1
29 include:
30 - ansible: 2.13.0
31 python: 3.8
32 - ansible: 2.14.0
33 python: 3.9
34 - ansible: 2.15.0
35 python: 3.9
36 - ansible: 2.19.0b1
37 python: 3.12
38 steps:
39 - name: Check out code
40 uses: actions/checkout@v4
41 with:
42 path: ansible_collections/cloudscale_ch/cloud
43
44 - name: Set up Python ${{ matrix.python }}
45 uses: actions/setup-python@v4
46 with:
47 python-version: ${{ matrix.python }}
48
49 - name: Install ansible and collection dependencies
50 run: |
51 python -m pip install --upgrade pip
52 # Install the latest ansible-core patchlevel version
53 pip install 'ansible-core~=${{ matrix.ansible }}'
54 pip install -r tests/requirements.txt
55
56 - name: Build and install collection
57 run: |
58 ansible-galaxy collection build .
59 ansible-galaxy collection install *.gz
60
61 - name: Add config file
62 env:
63 CONFIG_FILE: ${{ secrets.CONFIG_FILE }}
64 INI_FILE: tests/integration/cloud-config-cloudscale.ini
65 run: |
66 echo -n "$CONFIG_FILE" > $INI_FILE && [ -s $INI_FILE ] || (>&2 echo no secrets provided; exit 1)
67
68 - name: Ensure no other integration test is currently running
69 uses: softprops/turnstyle@v1
70 timeout-minutes: 60
71 env:
72 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73 with:
74 same-branch-only: false
75
76 - name: Run the tests
77 run: >-
78 ansible-test
79 integration
80 --docker
81 --python ${{ matrix.python }}
82 -v
83 --diff
84 --color
85 --allow-unsupported
86 --continue-on-error
87 --coverage
88 cloud/cloudscale/
89
90 - name: Generate coverage report.
91 run: >-
92 ansible-test
93 coverage xml
94 -v
95 --requirements
96 --group-by command
97 --group-by version
98
99 - uses: codecov/codecov-action@v3
100 with:
101 fail_ci_if_error: false
102
103 - name: Send mail in case of failure
104 id: send_mail
105 if: ${{ failure() && github.event_name == 'schedule' }}
106 shell: python3 {0}
107 run: |
108 from smtplib import SMTP
109 from email.message import EmailMessage
110
111 email = EmailMessage()
112 email['TO'] = '${{ secrets.CRON_RCPT }}'
113 email['FROM'] = '[email protected]'
114 email['Subject'] = 'Ansible Cloud Module Integration Test Failure'
115 email.set_content("""
116 Integration tests using ansible-core ${{ matrix.ansible }} on Python ${{ matrix.python }} failed:
117 https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
118 """)
119
120 with SMTP('${{ secrets.MAILSERVER }}') as smtp:
121 smtp.starttls()
122 smtp.send_message(email)