File size: 1,147 Bytes
fe1089d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# workflow file tp build a python app and lint it
# CREDIT: Adopted from Github Actions Documentation
## see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python Install and Linting

# runs on every push/pr to any repo and on manual dispatch
on:
  push:

  pull_request:

  workflow_dispatch:

permissions:
  contents: read

# jobs to run
jobs:
  # main build job that installs dependencies and lints
  build:
    runs-on: ubuntu-latest

    steps:
    # checkout the repository
    - uses: actions/checkout@v3
    # set up python 3.10
    - name: Set up Python 3.10
      uses: actions/setup-python@v3
      with:
        python-version: "3.10"
    # install dependencies from requirements.txt
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install pylint black
        if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
    # lint and format all files with black (as defined in pyproject.toml)
    - name: Lint & Fix with Black
      run: black .
    # lint with pylint
    - name: Lint with Pylint
      run: pylint .