2020-03-17 11:17:19 +00:00
|
|
|
# This workflow will install Python dependencies, run tests and lint with a single version of Python
|
2022-10-10 11:12:22 +00:00
|
|
|
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
|
2020-03-17 11:17:19 +00:00
|
|
|
|
|
|
|
|
name: Python application
|
|
|
|
|
|
|
|
|
|
on:
|
|
|
|
|
push:
|
2020-07-13 12:12:41 -07:00
|
|
|
branches: [ $default-branch ]
|
2020-03-17 11:17:19 +00:00
|
|
|
pull_request:
|
2020-07-13 12:12:41 -07:00
|
|
|
branches: [ $default-branch ]
|
2020-03-17 11:17:19 +00:00
|
|
|
|
2022-02-15 13:42:06 +05:30
|
|
|
permissions:
|
|
|
|
|
contents: read
|
|
|
|
|
|
2020-03-17 11:17:19 +00:00
|
|
|
jobs:
|
|
|
|
|
build:
|
|
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
|
|
steps:
|
2024-01-03 02:09:21 -05:00
|
|
|
- uses: actions/checkout@v4
|
2021-10-20 00:02:48 -04:00
|
|
|
- name: Set up Python 3.10
|
2022-03-28 13:10:48 -04:00
|
|
|
uses: actions/setup-python@v3
|
2020-03-17 11:17:19 +00:00
|
|
|
with:
|
2021-10-22 01:14:49 -04:00
|
|
|
python-version: "3.10"
|
2020-03-17 11:17:19 +00:00
|
|
|
- name: Install dependencies
|
|
|
|
|
run: |
|
|
|
|
|
python -m pip install --upgrade pip
|
2020-04-09 08:41:42 +01:00
|
|
|
pip install flake8 pytest
|
|
|
|
|
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
2020-03-17 11:17:19 +00:00
|
|
|
- name: Lint with flake8
|
|
|
|
|
run: |
|
|
|
|
|
# stop the build if there are Python syntax errors or undefined names
|
|
|
|
|
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
|
|
|
|
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
|
|
|
|
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
|
|
|
|
- name: Test with pytest
|
|
|
|
|
run: |
|
|
|
|
|
pytest
|