Handling server join/leave and purge #29
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
name: Linting and Testing | |
on: [push, pull_request, workflow_dispatch] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: false | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip3 install -r requirements.txt | |
pip install flake8 | |
- name: Lint with flake8 | |
run: | | |
# 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 --exclude=src/deprecated,src/TtgcBot.py --ignore=E265,E266,E302,E305,E306,E501,E261,E262,E701,F401,E731,E704 --output-file=warnings.log | |
flake8 src/TtgcBot.py --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --ignore=E265,E266,E302,E305,E306,E501,E261,E262,E701,E402,E731,E704 --output-file=ttgcbot.log | |
flake8 . --count --select=F401 --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude=src/deprecated,src/TtgcBot.py,*/__init__.py --output-file=F401.log | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude src/deprecated --output-file=errors.log | |
- name: Show report | |
if: ${{ always() }} | |
run: | | |
echo "Critical errors:" | |
if [ -r errors.log ]; then cat errors.log; fi | |
echo "" | |
echo "Warnings:" | |
if [ -r warnings.log ]; then cat warnings.log; fi | |
echo "" | |
if [ -r F401.log ]; then cat F401.log; fi | |
echo "" | |
if [ -r ttgcbot.log ]; then cat ttgcbot.log; fi | |
pytest: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: false | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip3 install -r requirements.txt | |
pip install pytest | |
- name: Test with pytest | |
run: | | |
pytest -W ignore::DeprecationWarning --rootdir=src |