2021-04-20 17:14:52 +03:00
|
|
|
# Run unitary test + flake8
|
|
|
|
|
2021-04-20 11:09:31 +03:00
|
|
|
name: test
|
|
|
|
|
|
|
|
on: [push]
|
|
|
|
|
|
|
|
jobs:
|
2021-04-20 20:25:41 +03:00
|
|
|
test:
|
2021-04-20 11:09:31 +03:00
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-12-12 13:00:52 +03:00
|
|
|
python-version: ["2.7", "3.7", "3.8", "3.9", "3.10", "3.11"]
|
2021-04-20 11:09:31 +03:00
|
|
|
|
|
|
|
steps:
|
|
|
|
|
2022-10-25 16:44:28 +03:00
|
|
|
- uses: actions/checkout@v3
|
2021-04-20 11:09:31 +03:00
|
|
|
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
2022-10-25 20:10:32 +03:00
|
|
|
uses: actions/setup-python@v4
|
2021-04-20 11:09:31 +03:00
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
pip install flake8
|
|
|
|
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
|
|
|
|
|
|
- name: Lint with flake8
|
|
|
|
run: |
|
|
|
|
# Stop the build if there are Python syntax errors or undefined names
|
2021-04-20 20:25:41 +03:00
|
|
|
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=.git,./docs,./glances/outputs/static
|
2021-04-20 11:09:31 +03:00
|
|
|
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
2021-04-20 20:25:41 +03:00
|
|
|
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude=.git,./docs,./glances/outputs/static
|
2021-04-20 11:09:31 +03:00
|
|
|
|
2023-05-01 11:12:09 +03:00
|
|
|
# - name: Lint with Ruff
|
|
|
|
# uses: chartboost/ruff-action@v1
|
2022-07-10 12:22:47 +03:00
|
|
|
|
|
|
|
- name: Static type check
|
|
|
|
run: |
|
2022-07-10 12:34:56 +03:00
|
|
|
if [ "${{ matrix.python-version }}" == "2.7" ];
|
|
|
|
then
|
|
|
|
echo "Skipping static type check for Python 2.7";
|
|
|
|
else
|
2022-07-10 19:52:23 +03:00
|
|
|
echo "Skipping static type check for the moment, too much error...";
|
|
|
|
# pip install pyright
|
|
|
|
# pyright glances
|
2022-07-10 12:34:56 +03:00
|
|
|
fi
|
2022-07-10 19:52:23 +03:00
|
|
|
|
2021-04-20 11:09:31 +03:00
|
|
|
- name: Unitary tests
|
|
|
|
run: |
|
|
|
|
python ./unitest.py
|
2021-04-20 20:25:41 +03:00
|
|
|
|
|
|
|
- name: Security issues with Bandit
|
|
|
|
uses: jpetrucciani/bandit-check@master
|
|
|
|
with:
|
|
|
|
#path: '-r --exit-zero --skip B104 ./glances/'
|
|
|
|
path: '-r --exit-zero --skip B104 ./glances/'
|