Skip to content

[workflow] Add workflow to check for changelog fragments in PR (#274) #496

[workflow] Add workflow to check for changelog fragments in PR (#274)

[workflow] Add workflow to check for changelog fragments in PR (#274) #496

Workflow file for this run

name: Code coverage
on:
push:
pull_request:
jobs:
codecoverage:
env:
PY_COLORS: "1"
source_directory: "./source"
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
ansible-version:
- stable-2.14
python-version:
- "3.10"
runs-on: ${{ matrix.os }}
name: "Code coverage py${{ matrix.python-version }} / ${{ matrix.os }} / ${{ matrix.ansible-version }}"
steps:
- name: Checkout the collection repository
uses: actions/checkout@v3
with:
path: ${{ env.source_directory }}
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: "0"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install ansible-core (${{ matrix.ansible-version }})
run: python3 -m pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible-version }}.tar.gz --disable-pip-version-check
- 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: |
ansible-test units --python ${{ matrix.python-version }} --coverage --requirements
ansible-test coverage report
working-directory: ${{ steps.identify.outputs.collection_path }}