2021-12-10 17:01:56 +08:00
|
|
|
name: Code Coverage
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Run Pytest and Upload Coverage
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Set up Python environment
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: "3.9"
|
|
|
|
architecture: "x64"
|
|
|
|
|
2021-12-30 23:29:32 +08:00
|
|
|
- uses: Gr1N/setup-poetry@v7
|
|
|
|
|
|
|
|
- uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ~/.cache/pypoetry/virtualenvs
|
|
|
|
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
|
2021-12-10 17:01:56 +08:00
|
|
|
|
|
|
|
- name: Install dependencies
|
2021-12-20 10:10:22 +08:00
|
|
|
run: poetry install -E all
|
|
|
|
|
|
|
|
- name: Run Pytest
|
2021-12-10 17:01:56 +08:00
|
|
|
run: |
|
|
|
|
cd tests/
|
2022-01-10 11:53:02 +08:00
|
|
|
poetry run pytest -n auto --cov-report xml
|
2021-12-10 17:01:56 +08:00
|
|
|
|
|
|
|
- name: Upload coverage report
|
|
|
|
uses: codecov/codecov-action@v2
|
|
|
|
with:
|
|
|
|
files: ./tests/coverage.xml
|
|
|
|
flags: unittests
|