Update .github/workflows/main.yml #2
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: For Natural Language Processing | |
on: [push] | |
jobs: | |
build: | |
name: Code Analysis | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 4 | |
fail-fast: false | |
matrix: | |
python-version: ['3.10'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f ${{ github.workspace }}/.devcontainer/requirements.txt ]; then pip install -r ${{ github.workspace }}/.devcontainer/requirements.txt; fi | |
- name: Lint with flake8 | |
run: | | |
printf "\n" | |
echo "============================= flake8 session starts ==============================" | |
printf "\n" | |
# stop the build if there are Python syntax errors or undefined names | |
printf "\n" | |
echo "Issues in relation to logic (F7), syntax (Python E9, Flake F7), mathematical | |
formulae symbols (F63), undefined variable names (F82):" | |
printf "\n src/functions " | |
flake8 --count --select=E9,F63,F7,F82 --show-source --statistics src/functions | |
printf "\n src/main.py " | |
flake8 --count --select=E9,F63,F7,F82 --show-source --statistics src/main.py | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
printf "\n\n" | |
echo "Complexity issues:" | |
printf "\n src/functions " | |
flake8 --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics src/functions | |
printf "\n src/main.py " | |
flake8 --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics src/main.py | |
- name: Lint with pylint | |
run: | | |
printf "\n" | |
echo "============================= pylint session starts ==============================" | |
printf "\n Package src/functions" | |
pylint --rcfile .pylintrc src/functions | |
printf "\n Module src/main.py" | |
pylint --rcfile .pylintrc src/main.py | |
- name: Test with pytest | |
run: | | |
printf "\n" | |
echo "============================= pytest session starts ==============================" | |
printf "\n pytest tests pending" | |
printf "\n Pattern: pytest -o python_files=test_*" | |
- name: Coverage with pytest-cov | |
run: | | |
printf "\n " | |
echo "============================= coverage session starts ==============================" | |
printf "\n test coverage tests pending" | |
printf "\n Pattern: pytest --cov-report term-missing --cov src/.../... tests/.../..." |