-
Notifications
You must be signed in to change notification settings - Fork 4
67 lines (57 loc) · 2.17 KB
/
python-app.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
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python application
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install pip
run: |
python -m pip install --upgrade pip
- name: Install Poetry
uses: snok/install-poetry@v1.3.3
with:
version: 1.5.0
virtualenvs-create: true
- name: Configure poetry
run: |
poetry config virtualenvs.in-project true
- name: Poetry Cache
uses: actions/cache@v2
id: poetry-cache
with:
path: .venv
key: venv-${{ hashFiles('**/poetry.lock') }}
# This is from <https://github.com/python-poetry/poetry/blob/639d5e057/.github/workflows/main.yml#L57-L60>
- name: Ensure cache is healthy
if: steps.poetry-cache.outputs.cache-hit == 'true'
shell: bash
run: |
timeout 10s poetry run pip --version || rm -rf .venv
- name: Install dependencies
run: |
poetry install -E all
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 tdwii_plus_examples --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# --extend-ignore=203 because black puts in a space before a slicing :
# while flake8 complains (this warning is not PEP 8 compliant), If W503 pops up, that should be disabled also
poetry run flake8 tdwii_plus_examples --count --exit-zero --extend-ignore=E203 --max-line-length=127 --statistics
# poetry run flake8 tdwii_plus_examples --count --exit-zero --max-complexity=10 --statistics
- name: Test with pytest
run: |
poetry run pytest tdwii_plus_examples/tests