|
5 | 5 | branches: |
6 | 6 | - main |
7 | 7 |
|
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | + |
8 | 11 | jobs: |
| 12 | + # LINTING |
9 | 13 | linting: |
10 | | - runs-on: ubuntu-latest |
11 | 14 | name: Linting |
| 15 | + runs-on: ubuntu-latest |
| 16 | + timeout-minutes: 15 |
| 17 | + |
12 | 18 | steps: |
13 | | - - name: Checkout Code |
14 | | - uses: actions/checkout@v3 |
| 19 | + - name: Checkout code |
| 20 | + uses: actions/checkout@v4 |
15 | 21 |
|
16 | | - - name: Set up Node.js |
17 | | - uses: actions/setup-node@v3 |
| 22 | + - name: Setup Node.js |
| 23 | + uses: actions/setup-node@v4 |
18 | 24 | with: |
19 | | - node-version: "18" |
| 25 | + node-version: 18 |
| 26 | + cache: "npm" |
| 27 | + cache-dependency-path: frontend/package-lock.json |
| 28 | + |
| 29 | + # Frontend Dependencies Installation |
20 | 30 |
|
21 | | - - name: Install Dependencies |
22 | | - run: | |
23 | | - cd frontend |
24 | | - npm install |
25 | | - cd .. |
26 | | - cd backend |
27 | | - pip install pre-commit ruff black |
28 | | - cd .. |
29 | | - - name: Run Linters |
| 31 | + - name: Install frontend dependencies |
| 32 | + working-directory: frontend |
| 33 | + run: npm ci |
| 34 | + |
| 35 | + - name: Run frontend linters |
| 36 | + working-directory: frontend |
30 | 37 | run: | |
31 | | - cd frontend/ |
32 | 38 | npm run lint:check |
33 | 39 | npm run format:check |
34 | | - cd .. |
35 | | - cd backend/ |
36 | | - pre-commit run --config ../.pre-commit-config.yaml --all-files || exit 1 |
37 | | - cd .. |
38 | | - cd frontend/src-tauri/ |
39 | | - cargo fmt -- --check |
40 | | -
|
41 | | - # Frontend Test Job |
42 | | - frontend: |
43 | | - runs-on: ubuntu-latest |
44 | | - name: Frontend Tests |
45 | | - steps: |
46 | | - - name: Checkout Code |
47 | | - uses: actions/checkout@v3 |
48 | 40 |
|
49 | | - - name: Set up Node.js |
50 | | - uses: actions/setup-node@v3 |
| 41 | + - name: Setup Python |
| 42 | + uses: actions/setup-python@v5 |
51 | 43 | with: |
52 | | - node-version: "18" |
| 44 | + python-version: "3.11" |
| 45 | + cache: "pip" |
| 46 | + |
| 47 | + - name: Install backend lint tools |
| 48 | + run: | |
| 49 | + python -m pip install --upgrade pip |
| 50 | + pip install pre-commit ruff black |
53 | 51 |
|
54 | | - - name: Install Dependencies & Run Tests |
| 52 | + - name: Run backend linters |
| 53 | + working-directory: backend |
55 | 54 | run: | |
56 | | - cd frontend |
57 | | - npm install |
58 | | - npm test |
| 55 | + pre-commit run --config ../.pre-commit-config.yaml --all-files |
| 56 | +
|
| 57 | + # RUST |
| 58 | + |
| 59 | + - name: Setup Rust |
| 60 | + uses: dtolnay/rust-toolchain@stable |
59 | 61 |
|
60 | | - # Backend Test Job |
61 | | - backend: |
| 62 | + - name: Run cargo fmt |
| 63 | + working-directory: frontend/src-tauri |
| 64 | + run: cargo fmt -- --check |
| 65 | + |
| 66 | + # FRONTEND TESTS |
| 67 | + frontend-tests: |
| 68 | + name: Frontend Tests |
62 | 69 | runs-on: ubuntu-latest |
| 70 | + timeout-minutes: 15 |
| 71 | + |
| 72 | + steps: |
| 73 | + - name: Checkout code |
| 74 | + uses: actions/checkout@v4 |
| 75 | + |
| 76 | + - name: Setup Node.js |
| 77 | + uses: actions/setup-node@v4 |
| 78 | + with: |
| 79 | + node-version: 18 |
| 80 | + cache: "npm" |
| 81 | + cache-dependency-path: frontend/package-lock.json |
| 82 | + |
| 83 | + - name: Install dependencies |
| 84 | + working-directory: frontend |
| 85 | + run: npm ci |
| 86 | + |
| 87 | + - name: Run frontend tests |
| 88 | + working-directory: frontend |
| 89 | + run: npm test -- --ci |
| 90 | + |
| 91 | + # BACKEND TESTS |
| 92 | + backend-tests: |
63 | 93 | name: Backend Tests |
| 94 | + runs-on: ubuntu-latest |
| 95 | + timeout-minutes: 20 |
| 96 | + |
| 97 | + strategy: |
| 98 | + fail-fast: false |
| 99 | + matrix: |
| 100 | + python-version: ["3.11"] |
| 101 | + |
64 | 102 | steps: |
65 | | - - name: Checkout Code |
66 | | - uses: actions/checkout@v3 |
| 103 | + - name: Checkout code |
| 104 | + uses: actions/checkout@v4 |
67 | 105 |
|
68 | | - - name: Set up Python |
69 | | - uses: actions/setup-python@v4 |
| 106 | + - name: Setup Python |
| 107 | + uses: actions/setup-python@v5 |
70 | 108 | with: |
71 | | - python-version: "3.11" |
| 109 | + python-version: ${{ matrix.python-version }} |
| 110 | + cache: "pip" |
72 | 111 |
|
73 | | - - name: Build check(Main backend) |
| 112 | + - name: Install backend dependencies |
| 113 | + working-directory: backend |
74 | 114 | run: | |
75 | | - cd backend |
76 | 115 | python -m pip install --upgrade pip |
77 | 116 | pip install -r requirements.txt |
78 | | - pyinstaller main.py --name PictoPy_Server --onedir --distpath dist |
79 | 117 |
|
80 | | - - name: Build check(Sync Microservice) |
| 118 | + - name: Build check (Main Backend) |
| 119 | + working-directory: backend |
81 | 120 | run: | |
82 | | - cd sync-microservice |
83 | | - pip install -r requirements.txt |
84 | | - pyinstaller main.py --name PictoPy_Sync_Microservice --onedir --distpath dist |
| 121 | + pyinstaller main.py \ |
| 122 | + --name PictoPy_Server \ |
| 123 | + --onedir \ |
| 124 | + --distpath dist |
85 | 125 |
|
86 | | - - name: Run Tests |
| 126 | + - name: Build check (Sync Microservice) |
| 127 | + working-directory: sync-microservice |
87 | 128 | run: | |
88 | | - cd backend |
89 | | - pytest |
| 129 | + pip install -r requirements.txt |
| 130 | + pyinstaller main.py \ |
| 131 | + --name PictoPy_Sync_Microservice \ |
| 132 | + --onedir \ |
| 133 | + --distpath dist |
90 | 134 |
|
| 135 | + - name: Run backend tests |
| 136 | + working-directory: backend |
| 137 | + run: pytest -v |
0 commit comments