diff --git a/.github/workflows/code_checks.yml b/.github/workflows/code_checks.yml index d5a164aa..1f2f81aa 100755 --- a/.github/workflows/code_checks.yml +++ b/.github/workflows/code_checks.yml @@ -38,3 +38,71 @@ jobs: set -e echo "๐Ÿ” Checking Python syntax..." find . -name "*.py" -print0 | xargs -0 -n1 python3 -m py_compile + + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install linting tools + run: | + # Python linting + pip install flake8 + # Docker linting + wget -O /tmp/hadolint https://github.com/hadolint/hadolint/releases/latest/download/hadolint-Linux-x86_64 + chmod +x /tmp/hadolint + # PHP and shellcheck for syntax checking + sudo apt-get update && sudo apt-get install -y php-cli shellcheck + + - name: Shell check + continue-on-error: true + run: | + echo "๐Ÿ” Checking shell scripts..." + find . -name "*.sh" -exec shellcheck {} \; + + - name: Python lint + continue-on-error: true + run: | + echo "๐Ÿ” Linting Python code..." + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + + - name: PHP check + continue-on-error: true + run: | + echo "๐Ÿ” Checking PHP syntax..." + find . -name "*.php" -exec php -l {} \; + + - name: Docker lint + continue-on-error: true + run: | + echo "๐Ÿ” Linting Dockerfiles..." + /tmp/hadolint Dockerfile* || true + + test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + pip install -r requirements.txt + pip install pytest + + - name: Run unit tests + run: | + echo "๐Ÿงช Running unit tests..." + pytest -m "not (docker or compose or feature_complete)" +