Skip to content

Commit 8f56482

Browse files
authored
Create python-package.yml
1 parent cd6beaa commit 8f56482

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Python package
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
build:
11+
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
python-version: ["3.10"]
16+
poetry-version: ["1.7.1"]
17+
os: [ubuntu-latest]
18+
runs-on: ${{ matrix.os }}
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Install poetry
28+
uses: abatilo/actions-poetry@v2
29+
30+
- uses: actions/cache@v3
31+
name: Define a cache for the virtual environment based on the dependencies lock file
32+
with:
33+
path: ./.venv
34+
key: venv-${{ hashFiles('poetry.lock') }}
35+
36+
- name: Install the project dependencies
37+
run: poetry install
38+
39+
- name: Lint with flake8
40+
run: |
41+
# stop the build if there are Python syntax errors or undefined names
42+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
43+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
44+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
45+
46+
- name: Run unit tests
47+
run: poetry run pytest

0 commit comments

Comments
 (0)