-
Notifications
You must be signed in to change notification settings - Fork 64
54 lines (45 loc) · 1.66 KB
/
code-coverage.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: Code coverage
on:
push:
pull_request:
jobs:
codecoverage:
env:
PY_COLORS: "1"
source_directory: "./source"
ansible-version: latest
python-version: "3.10"
runs-on: ubuntu-latest
name: "Code coverage | Python 3.10"
steps:
- name: Checkout the collection repository
uses: actions/checkout@v4
with:
path: ${{ env.source_directory }}
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: "0"
- name: Set up Python ${{ env.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.python-version }}
- name: Install ansible-core (${{ env.ansible-version }})
run: python3 -m pip install ansible-core
- name: Read collection metadata from galaxy.yml
id: identify
uses: ansible-network/github_actions/.github/actions/identify_collection@main
with:
source_path: ${{ env.source_directory }}
- name: Build and install the collection
uses: ansible-network/github_actions/.github/actions/build_install_collection@main
with:
install_python_dependencies: true
source_path: ${{ env.source_directory }}
collection_path: ${{ steps.identify.outputs.collection_path }}
tar_file: ${{ steps.identify.outputs.tar_file }}
- name: Print the ansible version
run: ansible --version
- name: Print the python dependencies
run: python3 -m pip list
- name: Run code coverage tests
run: pytest tests --cov-report term --cov=./
working-directory: ${{ steps.identify.outputs.collection_path }}