diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index bbe1dd1..49c7c22 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,52 +1,61 @@ -name: Lint and Test +name: SearchlyAI on: push: - branches: [ "main" ] + branches: [ main ] pull_request: - branches: [ "main" ] + branches: [ main ] jobs: - build: + backend-lint-and-build: runs-on: ubuntu-latest defaults: run: working-directory: ./backend - + steps: - - uses: actions/checkout@v4 - - - name: Set up Python 3.10 - uses: actions/setup-python@v5 + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 with: - python-version: "3.10" - + python-version: '3.11' + - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt - pip install flake8 black mypy isort pytest - - - name: Run Black (Check) - run: black . --check - - - name: Run Isort (Check) - run: isort . --check-only - - - name: Run Flake8 - run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + pip install flake8 + + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - build-frontend: + frontend-lint-and-build: runs-on: ubuntu-latest defaults: run: working-directory: ./frontend + steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 + - name: Use Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v3 with: - node-version: '18' - - run: npm ci - - run: npm run lint + node-version: '18.x' + cache: 'npm' + cache-dependency-path: './frontend/package-lock.json' + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + + - name: Lint + run: npm run lint