1+ name : Coverage CI
2+ on : [push, pull_request]
3+
4+ jobs :
5+ poetry :
6+ runs-on : ubuntu-latest
7+ defaults :
8+ run :
9+ shell : bash
10+
11+ strategy :
12+ max-parallel : 42
13+ fail-fast : false
14+ matrix :
15+ python-version : ["3.12"]
16+
17+ steps :
18+ # ----------------------------------------------
19+ # check-out repo and set-up python
20+ # ----------------------------------------------
21+ - name : Check out repository
22+ uses : actions/checkout@v3
23+ - name : Set up python
24+ id : setup-python
25+ uses : actions/setup-python@v4
26+ with :
27+ python-version : ${{ matrix.python-version }}
28+
29+ # ----------------------------------------------
30+ # install & configure poetry
31+ # ----------------------------------------------
32+ - name : Install and configure Poetry
33+ uses : snok/install-poetry@v1
34+ with :
35+ virtualenvs-create : true
36+ virtualenvs-in-project : true
37+
38+ # ----------------------------------------------
39+ # load cached venv if cache exists
40+ # ----------------------------------------------
41+ - name : Load cached venv
42+ id : cached-poetry-dependencies
43+ uses : actions/cache@v3
44+ with :
45+ path : .venv
46+ key : venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
47+
48+ # ----------------------------------------------
49+ # install dependencies if cache does not exist
50+ # ----------------------------------------------
51+ - name : Install dependencies
52+ if : steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
53+ run : poetry install --verbose --no-interaction --no-root
54+
55+ # ----------------------------------------------
56+ # install your root project, if required
57+ # ----------------------------------------------
58+ - name : Install project
59+ run : poetry install --verbose --no-interaction
60+
61+ # ----------------------------------------------
62+ # Test coverage
63+ # ----------------------------------------------
64+ - name : Run tests and generate coverage
65+ run : |
66+ poetry run coverage run -m pytest
0 commit comments