Skip to content

Commit 0742a24

Browse files
committed
feat: Add GitHub Actions workflow for backend and frontend linting and building.
1 parent 7bf7ff3 commit 0742a24

File tree

1 file changed

+36
-27
lines changed

1 file changed

+36
-27
lines changed

.github/workflows/lint.yml

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,61 @@
1-
name: Lint and Test
1+
name: SearchlyAI
22

33
on:
44
push:
5-
branches: [ "main" ]
5+
branches: [ main ]
66
pull_request:
7-
branches: [ "main" ]
7+
branches: [ main ]
88

99
jobs:
10-
build:
10+
backend-lint-and-build:
1111
runs-on: ubuntu-latest
1212
defaults:
1313
run:
1414
working-directory: ./backend
15-
15+
1616
steps:
17-
- uses: actions/checkout@v4
18-
19-
- name: Set up Python 3.10
20-
uses: actions/setup-python@v5
17+
- uses: actions/checkout@v3
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v4
2121
with:
22-
python-version: "3.10"
23-
22+
python-version: '3.11'
23+
2424
- name: Install dependencies
2525
run: |
2626
python -m pip install --upgrade pip
2727
pip install -r requirements.txt
28-
pip install flake8 black mypy isort pytest
29-
30-
- name: Run Black (Check)
31-
run: black . --check
32-
33-
- name: Run Isort (Check)
34-
run: isort . --check-only
35-
36-
- name: Run Flake8
37-
run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
28+
pip install flake8
29+
30+
- name: Lint with flake8
31+
run: |
32+
# stop the build if there are Python syntax errors or undefined names
33+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
34+
# exit-zero treats all errors as warnings
35+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
3836
39-
build-frontend:
37+
frontend-lint-and-build:
4038
runs-on: ubuntu-latest
4139
defaults:
4240
run:
4341
working-directory: ./frontend
42+
4443
steps:
45-
- uses: actions/checkout@v4
44+
- uses: actions/checkout@v3
45+
4646
- name: Use Node.js
47-
uses: actions/setup-node@v4
47+
uses: actions/setup-node@v3
4848
with:
49-
node-version: '18'
50-
- run: npm ci
51-
- run: npm run lint
49+
node-version: '18.x'
50+
cache: 'npm'
51+
cache-dependency-path: './frontend/package-lock.json'
52+
53+
- name: Install dependencies
54+
run: npm ci
55+
56+
- name: Build
57+
run: npm run build
58+
59+
- name: Lint
60+
run: npm run lint
5261

0 commit comments

Comments
 (0)