Skip to content

Switch build from setuptools to Poetry and move tests path #457

Switch build from setuptools to Poetry and move tests path

Switch build from setuptools to Poetry and move tests path #457

Workflow file for this run

name: Code coverage
on:
push:
branches:
- main
# Temporary inclusion of master branch during default branch name transition
- master
pull_request:
branches:
- main
# Temporary inclusion of master branch during default branch name transition
- master
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction
#----------------------------------------------
# run test suite and output coverage file
#----------------------------------------------
- name: Test with pytest
run: poetry run pytest --cov=./ --cov-report=xml
#----------------------------------------------
# upload coverage stats
# (requires CODECOV_TOKEN in repository secrets)
#----------------------------------------------
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
files: ./coverage1.xml,./coverage2.xml
directory: ./coverage/reports/
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
path_to_write_report: ./coverage/codecov_report.gz