diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd132d8..73315b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,43 +2,27 @@ name: CI on: push: - branches: [ main ] + branches: + - main pull_request: - branches: [ main ] + branches: + - main jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Checkout repository + uses: actions/checkout@v2 + - name: Set up Python uses: actions/setup-python@v2 with: - python-version: 3.12.2 + python-version: '3.12.2' - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - - - name: Run tests - run: | - pip install coverage - coverage run -m unittest discover test - coverage report - coverage xml + run: make install - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./coverage.xml - flags: unittests - name: codecov-umbrella - fail_ci_if_error: true - - - name: Codacy code quality - uses: codacy/codacy-analysis-cli-action@v4 - with: - project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + - name: Lint and Check Code + run: make all diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2ed5bd0 --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ +.PHONY: lint check + +# Install dependencies +install: + pip install -r requirements.txt + +# Lint the code using flake8 +lint: + flake8 src test --count --select=E9,F63,F7,F82 --show-source --statistics + flake8 src test --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + +# Check if all Python files are error-free using mypy +check: + mypy src test + +# Run all checks +all: install lint check