|
1 | | -name: Lint and Test |
| 1 | +name: SearchlyAI |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | | - branches: [ "main" ] |
| 5 | + branches: [ main ] |
6 | 6 | pull_request: |
7 | | - branches: [ "main" ] |
| 7 | + branches: [ main ] |
8 | 8 |
|
9 | 9 | jobs: |
10 | | - build: |
| 10 | + backend-lint-and-build: |
11 | 11 | runs-on: ubuntu-latest |
12 | 12 | defaults: |
13 | 13 | run: |
14 | 14 | working-directory: ./backend |
15 | | - |
| 15 | + |
16 | 16 | 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 |
21 | 21 | with: |
22 | | - python-version: "3.10" |
23 | | - |
| 22 | + python-version: '3.11' |
| 23 | + |
24 | 24 | - name: Install dependencies |
25 | 25 | run: | |
26 | 26 | python -m pip install --upgrade pip |
27 | 27 | 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 |
38 | 36 |
|
39 | | - build-frontend: |
| 37 | + frontend-lint-and-build: |
40 | 38 | runs-on: ubuntu-latest |
41 | 39 | defaults: |
42 | 40 | run: |
43 | 41 | working-directory: ./frontend |
| 42 | + |
44 | 43 | steps: |
45 | | - - uses: actions/checkout@v4 |
| 44 | + - uses: actions/checkout@v3 |
| 45 | + |
46 | 46 | - name: Use Node.js |
47 | | - uses: actions/setup-node@v4 |
| 47 | + uses: actions/setup-node@v3 |
48 | 48 | 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 |
52 | 61 |
|
0 commit comments