Merge pull request #268 from Guts/dependabot/github_actions/codecov/c… #259
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: | |
- master | |
paths-ignore: | |
- "docs/**" | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- "docs/**" | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
lintest: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["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 | |
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 -r requirements/local.txt | |
- name: Install NLTK | |
run: | | |
# download NLTK packages - please refer to `ntlk.txt` | |
python -m nltk.downloader punkt stopwords | |
- 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: Run Unit tests | |
run: | | |
pytest | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4.1.1 |