-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (112 loc) · 3.56 KB
/
ci.yml
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches:
- "master"
- "ci"
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.x"
paths:
- "**.py"
pull_request:
branches:
- "master"
# 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:
create-virtualenv:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11' ]
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: virtualenv cache
uses: syphar/[email protected]
id: cache-virtualenv
with:
custom_cache_key_element: v1.2
- name: pip cache
uses: syphar/restore-pip-download-cache@v1
if: steps.cache-virtualenv.outputs.cache-hit != 'true'
- name: Install Python dependencies
if: steps.cache-virtualenv.outputs.cache-hit != 'true'
env:
POETRY_VERSION: 1.6.1
run: |
pip install pip==23.2.1 setuptools==68.2.2
curl -sSL https://install.python-poetry.org | python3 -
export VENV="$(poetry env info -p)"
source ${VENV}/bin/activate
poetry install --no-interaction -vv
- name: Log currently installed packages and versions
run: pip list
linters-black:
needs: create-virtualenv
runs-on: ubuntu-latest
steps:
- name: source code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
- name: virtualenv cache
uses: syphar/[email protected]
id: cache-virtualenv
with:
custom_cache_key_element: v1.2
- name: Check code style
run: poetry run black --check --line-length=120 --diff async_customerio
linters-mypy:
needs: create-virtualenv
runs-on: ubuntu-latest
steps:
- name: source code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
- name: virtualenv cache
uses: syphar/[email protected]
id: cache-virtualenv
with:
custom_cache_key_element: v1.2
- name: Static type checker
run: |
python -m pip install types-setuptools
poetry run mypy --install-types --no-error-summary --hide-error-codes --follow-imports=skip async_customerio
test:
needs: [ linters-black, linters-mypy ]
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11' ]
steps:
- name: source code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: virtualenv cache
uses: syphar/[email protected]
id: cache-virtualenv
with:
custom_cache_key_element: v1.2
- name: Run pytest
run: pytest tests/
- name: Submit coverage report
if: github.ref == 'refs/heads/master'
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_TOKEN }}
run: |
pip install codacy-coverage
python-codacy-coverage -r coverage.xml