Skip to content

Upgrade GitHub Action for Python setup to v5 #156

Upgrade GitHub Action for Python setup to v5

Upgrade GitHub Action for Python setup to v5 #156

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python package
permissions:
contents: read
pull-requests: write
checks: write
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "*" ]
env:
CHATTERBOT_SHOW_TRAINING_PROGRESS: '0'
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
services:
redis:
image: redis/redis-stack-server:latest
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[test,dev,redis,mongodb]
python -m spacy download en_core_web_sm
python -m spacy download de_core_news_sm
- 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: Start MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: '8.0'
- name: Run tests
run: |
python -Wonce -m unittest discover -s tests -v
- name: Run tests for Django example app
run: |
python -m pip install "django<=4.1"
python -Wonce runtests.py
python -Wonce examples/django_example/manage.py test examples/django_example/
# --------------------------------------------------------------
# TODO: Fix & re-enable later
# https://github.com/marketplace/actions/coveralls-github-action
# - name: Coveralls GitHub Action
# uses: coverallsapp/[email protected]
# - name: Generate code coverage
# uses: paambaati/[email protected]
# env:
# CC_TEST_REPORTER_ID: 3ec30a156224df0f59620967241d9659086e918fd824f4f69b8ce7b55b5a590f
# with:
# coverageCommand: coverage
# debug: true