-
Notifications
You must be signed in to change notification settings - Fork 1
83 lines (70 loc) · 2.52 KB
/
ci.yml
File metadata and controls
83 lines (70 loc) · 2.52 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# This is a basic workflow to help you get started with Actions
# based on https://github.com/snok/install-poetry
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches:
- main
paths:
- "src/**"
- "tests/**"
- "pyproject.toml"
- "poetry.toml"
- "poetry.lock"
- "!**.md"
- "!.github/workflows/docs.yml"
pull_request:
paths-ignore:
- "**.md"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "test"
test:
# The type of runner that the job will run on
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest"]
python-version: ["3.8", "3.9"]
runs-on: ${{ matrix.os }}
steps:
# https://github.com/actions/checkout
- name: Checkout project repository
uses: actions/checkout@v3
# https://github.com/actions/setup-python
- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# https://github.com/snok/install-poetry
- name: Install Poetry
uses: snok/install-poetry@v1
# with:
# virtualenvs-create: true
# virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install main (mandatory) and development dependencies
# [tool.poetry.dependencies] [tool.poetry.group.dev.dependencies] in pyproject.toml
run: poetry install --only main,test
- name: Install package
run: poetry install --only-root
- name: Test with pytest and create coverage report
# Configuration of pytest [tool.pytest.ini_options] in pyproject.toml
# https://docs.pytest.org/en/latest/reference/customize.html#pyproject-toml
run: poetry run pytest --cov-report=xml
- name: Upload coverage to Codecov
# https://docs.codecov.com/docs
# https://github.com/codecov/codecov-action
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
# generated using --cov-report=xml above