-
Notifications
You must be signed in to change notification settings - Fork 14
57 lines (47 loc) · 1.71 KB
/
test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Test
on: [ push, workflow_dispatch ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Lint & Test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/[email protected]
- id: setup-python
name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.4.2
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
# Only when the context is exactly the same, we will restore the cache.
- name: Load cached venv
id: restore-poetry-dependencies
uses: actions/cache/[email protected]
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Create venv and install dependencies
if: steps.restore-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --with dev
- id: cache-poetry-dependencies
name: Cache venv
if: steps.restore-poetry-dependencies.outputs.cache-hit != 'true'
uses: actions/cache/[email protected]
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Run tests with pytest and generate coverage report
run: |
ENV_PATH=".test.env" poetry run task test
poetry run task coverage xml
- name: Upload coverage reports to CodeCov
uses: codecov/codecov-action@v3