44 lines
1.1 KiB
YAML
44 lines
1.1 KiB
YAML
name: Python Linting
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- '**' # Match all branches
|
|
pull_request:
|
|
branches:
|
|
- '**' # Match all branches
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: '3.12' # Specify the exact Python version
|
|
|
|
- name: Cache pip dependencies
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.cache/pip
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m venv venv # Create a virtual environment in the project root
|
|
source venv/bin/activate
|
|
pip install --upgrade pip
|
|
pip install -r requirements.txt # Install dependencies from requirements.txt
|
|
|
|
- name: Run Flake8
|
|
run: |
|
|
source venv/bin/activate
|
|
flake8 . --config=.flake8 # Run flake8 using the configuration in .flake8
|
|
|