Skip to content

Commit c4cb345

Browse files
committed
Added pull request_template and code-quality-checks
1 parent 1019a5c commit c4cb345

File tree

3 files changed

+186
-1
lines changed

3 files changed

+186
-1
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!-- We welcome contributions. All patches must include a sign-off. Please see CONTRIBUTING.md for details -->
2+
3+
4+
## What type of PR is this?
5+
<!-- Check all that apply, delete what doesn't apply. -->
6+
7+
- [ ] Refactor
8+
- [ ] Feature
9+
- [ ] Bug Fix
10+
- [ ] Other
11+
12+
## Description
13+
14+
## How is this tested?
15+
16+
- [ ] Unit tests
17+
- [ ] E2E Tests
18+
- [ ] Manually
19+
- [ ] N/A
20+
21+
<!-- If Manually, please describe. -->
22+
23+
## Related Tickets & Documents
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: Code Quality Checks
2+
on:
3+
push:
4+
branches:
5+
- v1/main
6+
pull_request:
7+
branches:
8+
- v1/main
9+
jobs:
10+
check-linting:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: [3.8, 3.9, "3.10"]
15+
steps:
16+
#----------------------------------------------
17+
# check-out repo and set-up python
18+
#----------------------------------------------
19+
- name: Check out repository
20+
uses: actions/checkout@v2
21+
- name: Set up python ${{ matrix.python-version }}
22+
id: setup-python
23+
uses: actions/setup-python@v2
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
#----------------------------------------------
27+
# ----- install & configure poetry -----
28+
#----------------------------------------------
29+
- name: Install Poetry
30+
uses: snok/install-poetry@v1
31+
with:
32+
virtualenvs-create: true
33+
virtualenvs-in-project: true
34+
installer-parallel: true
35+
36+
#----------------------------------------------
37+
# load cached venv if cache exists
38+
#----------------------------------------------
39+
- name: Load cached venv
40+
id: cached-poetry-dependencies
41+
uses: actions/cache@v2
42+
with:
43+
path: .venv
44+
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ github.event.repository.name }}-${{ hashFiles('**/poetry.lock') }}
45+
#----------------------------------------------
46+
# install dependencies if cache does not exist
47+
#----------------------------------------------
48+
- name: Install dependencies
49+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
50+
run: poetry install --no-interaction --no-root
51+
#----------------------------------------------
52+
# install your root project, if required
53+
#----------------------------------------------
54+
- name: Install library
55+
run: poetry install --no-interaction
56+
#----------------------------------------------
57+
# black the code
58+
#----------------------------------------------
59+
- name: Black
60+
run: poetry run black --check src
61+
62+
check-types:
63+
runs-on: ubuntu-latest
64+
strategy:
65+
matrix:
66+
python-version: [3.8, 3.9, "3.10"]
67+
steps:
68+
#----------------------------------------------
69+
# check-out repo and set-up python
70+
#----------------------------------------------
71+
- name: Check out repository
72+
uses: actions/checkout@v2
73+
- name: Set up python ${{ matrix.python-version }}
74+
id: setup-python
75+
uses: actions/setup-python@v2
76+
with:
77+
python-version: ${{ matrix.python-version }}
78+
#----------------------------------------------
79+
# ----- install & configure poetry -----
80+
#----------------------------------------------
81+
- name: Install Poetry
82+
uses: snok/install-poetry@v1
83+
with:
84+
virtualenvs-create: true
85+
virtualenvs-in-project: true
86+
installer-parallel: true
87+
88+
#----------------------------------------------
89+
# load cached venv if cache exists
90+
#----------------------------------------------
91+
- name: Load cached venv
92+
id: cached-poetry-dependencies
93+
uses: actions/cache@v2
94+
with:
95+
path: .venv
96+
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ github.event.repository.name }}-${{ hashFiles('**/poetry.lock') }}
97+
#----------------------------------------------
98+
# install dependencies if cache does not exist
99+
#----------------------------------------------
100+
- name: Install dependencies
101+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
102+
run: poetry install --no-interaction --no-root
103+
#----------------------------------------------
104+
# install your root project, if required
105+
#----------------------------------------------
106+
- name: Install library
107+
run: poetry install --no-interaction
108+
#----------------------------------------------
109+
# mypy the code
110+
#----------------------------------------------
111+
- name: Mypy
112+
run: |
113+
mkdir .mypy_cache # Workaround for bad error message "error: --install-types failed (no mypy cache directory)"; see https://github.com/python/mypy/issues/10768#issuecomment-2178450153
114+
poetry run mypy --install-types --non-interactive src

poetry.lock

Lines changed: 49 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)