-
Notifications
You must be signed in to change notification settings - Fork 18
153 lines (128 loc) · 4.13 KB
/
pr.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
---
name: Pull request build
on:
pull_request:
env:
MAIN_PY_VER: "3.10"
jobs:
lint:
runs-on: ubuntu-latest
name: Lint source files
permissions:
pull-requests: read
steps:
- name: Source checkout
uses: actions/checkout@v3
- name: Set up Python ${{ env.MAIN_PY_VER }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.MAIN_PY_VER }}
- name: Cache pip repository
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ env.MAIN_PY_VER }}
- name: Prepare python environment
run: |
pip install -r requirements.txt
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: Cache poetry virtual environment
uses: actions/cache@v3
with:
path: .venv
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}-${{ env.MAIN_PY_VER }}
- name: Install deno runtime
uses: denoland/[email protected]
- name: Lint the project
run: |
make install-all-deps
make lint
test:
runs-on: ubuntu-latest
needs: [lint]
strategy:
matrix:
python: ["3.9", "3.10"]
name: Test project with Python ${{ matrix.python }}
permissions:
checks: write
pull-requests: write
steps:
- name: Source checkout
uses: actions/checkout@v3
- name: Setup timezone
uses: zcong1993/[email protected]
with:
timezone: Asia/Jerusalem
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Cache pip repository
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ matrix.python }}
- name: Prepare python environment
run: |
pip install -r requirements.txt
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: Cache poetry virtual environment
uses: actions/cache@v3
with:
path: .venv
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python }}
- name: Install project build dependencies
run: make install-all-deps
- name: Test the project
run: >
if [ ${{ matrix.python }} == ${{ env.MAIN_PY_VER }} ];
then make test-with-coverage-reports;
else make test; fi
- name: Report test summary
uses: EnricoMi/publish-unit-test-result-action@v2
if: ${{ matrix.python == env.MAIN_PY_VER && always() }}
with:
test_changes_limit: 0
junit_files: ./junit.xml
report_individual_runs: true
- name: Push to CodeCov
uses: codecov/codecov-action@v3
if: ${{ matrix.python == env.MAIN_PY_VER }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
docs:
runs-on: ubuntu-latest
needs: [lint]
name: Verify documentation site
permissions:
pull-requests: read
steps:
- name: Source checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.MAIN_PY_VER }}
- name: Cache pip repository
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ env.MAIN_PY_VER }}
- name: Prepare python environment
run: |
pip install -r requirements.txt
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: Cache poetry virtual environment
uses: actions/cache@v3
with:
path: .venv
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}-${{ env.MAIN_PY_VER }}
- name: Build documentation site
run: |
make install-all-deps
make docs-build