Skip to content

[pre-commit.ci] pre-commit autoupdate (#320) #870

[pre-commit.ci] pre-commit autoupdate (#320)

[pre-commit.ci] pre-commit autoupdate (#320) #870

# This is a basic workflow to help you get started with Actions
name: "🐍 Lint and Test"
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
pull_request:
branches:
- main
paths-ignore:
- "docs/**"
push:
branches:
- main
paths-ignore:
- "docs/**"
jobs:
lintest:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Get source code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "requirements/*.txt"
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade -r requirements.txt
python -m pip install --upgrade -r requirements/development.txt
python -m pip install --upgrade -r requirements/testing.txt
- 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: Install project
run: python -m pip install -e .
- name: Run Unit tests
run: python -m pytest
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4.5.0
with:
env_vars: PYTHON
flags: unittests
name: Code Coverage for unittests on python-${{ matrix.python-version }}]
env:
PYTHON: ${{ matrix.python-version }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}