CP-41819: Py3: Collect, check and report code coverage from Python3 unit test runs #150
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and test | |
on: | |
push: | |
pull_request: | |
concurrency: # Cancel pending and in-progress workflows for the same PR, branch or tag: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
# No warnings for pip and pytest themselves; pytest enables warnings in conftest.py | |
PYTHONWARNINGS: ignore | |
# Development Mode for stronger checks: https://docs.python.org/3/library/devmode.html | |
PYTHONDEVMODE: yes | |
jobs: | |
python-checks: | |
name: Run the Xen-Bugtool Test Environment | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
#: Install Python 2.7 from Ubuntu 20.04 using apt-get install | |
sudo apt-get update && sudo apt-get install -y python2 | |
curl -sSL https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py | |
python2 get-pip.py | |
if [ -f requirements.txt ]; then pip2 install -r requirements.txt; fi | |
if [ -f requirements-dev.txt ]; then pip2 install -r requirements-dev.txt; fi | |
pip2 install pylint==1.9.4 | |
- name: Run pylint-1.9.4 for pylint --py3k linting (configured in .pylintrc) | |
run: python2 -m pylint xen-bugtool | |
- name: Run python2 -m pytest to execute all unit and integration tests | |
run: python2 -m pytest -v -rA | |
# https://www.python4data.science/en/latest/productive/git/advanced/hooks/ci.html | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
cache: 'pip' | |
- run: pip install -r requirements-dev.txt | |
name: Install the pytest dependencies for running the pytest suite using Python3 | |
- uses: actions/cache@v3 | |
name: Setup cache for running pre-commit fast | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} | |
- uses: pre-commit/[email protected] | |
name: Run pre-commit checks | |
env: | |
# Skip the no-commit-to-branch check inside of GitHub CI (for CI on merge to master) | |
SKIP: no-commit-to-branch |