-
Notifications
You must be signed in to change notification settings - Fork 2
54 lines (46 loc) · 1.76 KB
/
unit-tests.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
name: unit
on:
push:
branches:
- main
pull_request:
env:
NAMESPACE: community
COLLECTION_NAME: upcloud
jobs:
units:
runs-on: ubuntu-latest
name: Unit tests (${{ matrix.version.ansible }})
strategy:
fail-fast: true
matrix:
version:
- { ansible: stable-2.13, python: "3.10" }
- { ansible: stable-2.14, python: "3.11" }
- { ansible: stable-2.15, python: "3.11" }
- { ansible: devel, python: "3.11" }
steps:
- name: Check out code
uses: actions/checkout@v2
with:
path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
- name: Set up Python
uses: actions/setup-python@v2
with:
# it is just required to run that once as "ansible-test units" in the docker image
# will run on all python versions it supports.
python-version: ${{ matrix.version.python }}
- name: Install ansible-base (${{ matrix.version.ansible }})
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.version.ansible }}.tar.gz --disable-pip-version-check
# Run the unit tests
- name: Run unit test
run: ansible-test units -v --color --docker --coverage
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
# ansible-test support producing code coverage date
- name: Generate coverage report
run: ansible-test coverage xml -v --requirements --group-by command --group-by version
working-directory: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
# See the reports at https://codecov.io/gh/GITHUBORG/REPONAME
- uses: codecov/codecov-action@v1
with:
fail_ci_if_error: false