-
Notifications
You must be signed in to change notification settings - Fork 5
53 lines (49 loc) · 1.87 KB
/
python3.8-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
# This workflow will install Python dependencies, run tests and lint
# Uses poetry and tests multiple oses and python versions
# For more information see:
# https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
# https://github.com/actions/setup-python#caching-packages-dependencies
name: Python application
on:
push:
branches: ["**"]
pull_request:
branches: ["**"]
permissions:
contents: read
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# specify operating systems
os: [ubuntu-latest, macos-latest, windows-latest]
# specify python versions to test
python-version: ["3.8", "3.9", "3.10"]
# total tests = oses X python versions
# example exclusion: don't test python3.8 on Mac
# exclude:
# - os: macos-latest
# python-version: '3.8'
steps:
# steps indented by YAML extension
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v4
with:
# loop through each version of python specified
python-version: ${{ matrix.python-version }}
# poetry cache required to use poetry
cache: "poetry"
# install flake8 for testing
- run: poetry add flake8
- run: poetry install
- run: poetry run pytest
- name: lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics