fix: code coverage work with poetry and add coverage.json gitignore #255
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
# This GitHub Actions workflow contains two jobs: | |
# -- First, Lint uses the latest Ubuntu image and Python 3.8 to check the code | |
# and writing for defects, using the Pipenv linting script and mdl | |
# | |
# -- Second, Test uses a strategy matrix to run the Pipenv test scripts for | |
# multiple platform configurations, and then uploads test coverage. | |
name: Lint and Test | |
on: [push, pull_request] | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Setup Python 3.8 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.8" | |
- name: Install Poetry | |
uses: abatilo/[email protected] | |
with: | |
poetry-version: 1.1.13 | |
- name: Setup Poetry | |
run: | | |
poetry config virtualenvs.create true | |
poetry config virtualenvs.in-project true | |
poetry env info | |
- name: Install dependencies | |
run: poetry install --no-interaction --no-ansi | |
- name: Lint code | |
run: poetry run task lint --check | |
- name: Lint writing | |
uses: actionshub/markdownlint@main | |
test: | |
# Test uses a strategy matrix to ensure that sufficient platform test | |
# coverage is reached. For this configuration, we run the latest Ubuntu | |
# image with Python 3.6 and 3.9, while also including MacOS + Python 3.8 and | |
# Windows + Python 3.7. With this spread, we achieve testing of four | |
# different Python versions and three operating systems without running the | |
# full twelve possible combinations, greatly reducing load and usage. | |
name: Test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
# Turning fail-fast off ensures the entire strategy matrix is allowed to | |
# run to completion, allowing detection of individual platform issues | |
# regardless of the status of the other platforms. | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["3.7", "3.10"] | |
include: | |
- os: macos-latest | |
python-version: "3.9" | |
- os: windows-latest | |
python-version: "3.8" | |
env: | |
# These environment variables are passed to CodeCov to identify each build | |
OS: ${{ matrix.os }} | |
PYTHON: ${{ matrix.python-version }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Poetry | |
uses: abatilo/[email protected] | |
with: | |
poetry-version: 1.1.13 | |
- name: Setup Poetry | |
run: | | |
poetry config virtualenvs.create true | |
poetry config virtualenvs.in-project true | |
poetry env info | |
- name: Install dependencies | |
run: poetry install --no-interaction --no-ansi | |
- name: Execute tests | |
# We need to ensure that the cover-win script is run for Windows, so | |
# this Action runs different commands based on the runner's operating | |
# system. | |
uses: knicknic/os-specific-run@v1 | |
with: | |
linux: poetry run task cover | |
macos: poetry run task cover | |
windows: poetry run task cover-win | |
- name: Upload coverage | |
uses: codecov/codecov-action@v1 | |
with: | |
files: ./coverage.xml | |
flags: unittests | |
env_vars: OS,PYTHON | |
fail_ci_if_error: true |