|
8 | 8 |
|
9 | 9 | jobs: |
10 | 10 | lint-and-type-check: |
11 | | - name: Lint and Type Check |
| 11 | + name: Lint & Type Check |
12 | 12 | runs-on: ubuntu-latest |
13 | | - |
| 13 | + |
14 | 14 | steps: |
15 | | - - name: Checkout code |
16 | | - uses: actions/checkout@v4 |
| 15 | + - uses: actions/checkout@v4 |
17 | 16 |
|
18 | | - - name: Setup Node.js |
19 | | - uses: actions/setup-node@v4 |
| 17 | + - uses: actions/setup-node@v4 |
20 | 18 | with: |
21 | 19 | node-version: '20' |
22 | 20 |
|
23 | | - - name: Setup pnpm |
24 | | - uses: pnpm/action-setup@v2 |
| 21 | + - uses: pnpm/action-setup@v2 |
25 | 22 | with: |
26 | 23 | version: 8 |
27 | 24 |
|
28 | | - - name: Get pnpm store directory |
29 | | - id: pnpm-cache |
30 | | - shell: bash |
31 | | - run: | |
32 | | - echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT |
33 | | -
|
34 | | - - name: Setup pnpm cache |
| 25 | + - name: Cache pnpm |
35 | 26 | uses: actions/cache@v4 |
36 | 27 | with: |
37 | | - path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} |
38 | | - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} |
39 | | - restore-keys: | |
40 | | - ${{ runner.os }}-pnpm-store- |
| 28 | + path: ~/.pnpm-store |
| 29 | + key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} |
| 30 | + restore-keys: ${{ runner.os }}-pnpm- |
41 | 31 |
|
42 | | - - name: Install dependencies |
43 | | - run: pnpm install --frozen-lockfile |
| 32 | + - run: pnpm install --frozen-lockfile |
44 | 33 |
|
45 | | - - name: Run ESLint |
46 | | - run: pnpm lint || echo "ESLint found issues but continuing..." |
| 34 | + - name: ESLint |
| 35 | + run: pnpm lint |
47 | 36 | continue-on-error: true |
48 | 37 |
|
49 | | - - name: Type check |
50 | | - run: pnpm tsc --noEmit || echo "TypeScript check found issues but continuing..." |
| 38 | + - name: TypeScript |
| 39 | + run: pnpm tsc --noEmit |
51 | 40 | continue-on-error: true |
52 | 41 |
|
53 | 42 | build: |
54 | 43 | name: Build |
55 | 44 | runs-on: ubuntu-latest |
56 | 45 | needs: lint-and-type-check |
57 | | - |
| 46 | + |
58 | 47 | steps: |
59 | | - - name: Checkout code |
60 | | - uses: actions/checkout@v4 |
| 48 | + - uses: actions/checkout@v4 |
61 | 49 |
|
62 | | - - name: Setup Node.js |
63 | | - uses: actions/setup-node@v4 |
| 50 | + - uses: actions/setup-node@v4 |
64 | 51 | with: |
65 | 52 | node-version: '20' |
66 | 53 |
|
67 | | - - name: Setup pnpm |
68 | | - uses: pnpm/action-setup@v2 |
| 54 | + - uses: pnpm/action-setup@v2 |
69 | 55 | with: |
70 | 56 | version: 8 |
71 | 57 |
|
72 | | - - name: Get pnpm store directory |
73 | | - id: pnpm-cache |
74 | | - shell: bash |
75 | | - run: | |
76 | | - echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT |
77 | | -
|
78 | | - - name: Setup pnpm cache |
| 58 | + - name: Cache pnpm |
79 | 59 | uses: actions/cache@v4 |
80 | 60 | with: |
81 | | - path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} |
82 | | - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} |
83 | | - restore-keys: | |
84 | | - ${{ runner.os }}-pnpm-store- |
85 | | -
|
86 | | - - name: Install dependencies |
87 | | - run: pnpm install --frozen-lockfile |
88 | | - |
89 | | - - name: Create .env.local for build |
90 | | - run: | |
91 | | - cat > .env.local << EOF |
92 | | - NEXT_PUBLIC_SUPABASE_URL=https://placeholder.supabase.co |
93 | | - NEXT_PUBLIC_SUPABASE_ANON_KEY=placeholder-key |
94 | | - OLLAMA_URL=http://localhost:11434 |
95 | | - OLLAMA_MODEL=deepseek-r1:7b |
96 | | - EOF |
97 | | -
|
98 | | - - name: Build Next.js app |
| 61 | + path: ~/.pnpm-store |
| 62 | + key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} |
| 63 | + restore-keys: ${{ runner.os }}-pnpm- |
| 64 | + |
| 65 | + - run: pnpm install --frozen-lockfile |
| 66 | + |
| 67 | + - name: Build |
99 | 68 | run: pnpm build |
100 | 69 | env: |
101 | 70 | NEXT_PUBLIC_SUPABASE_URL: https://placeholder.supabase.co |
102 | 71 | NEXT_PUBLIC_SUPABASE_ANON_KEY: placeholder-key |
103 | | - |
104 | | - check-format: |
105 | | - name: Check Code Formatting |
106 | | - runs-on: ubuntu-latest |
107 | | - |
108 | | - steps: |
109 | | - - name: Checkout code |
110 | | - uses: actions/checkout@v4 |
111 | | - |
112 | | - - name: Setup Node.js |
113 | | - uses: actions/setup-node@v4 |
114 | | - with: |
115 | | - node-version: '20' |
116 | | - |
117 | | - - name: Setup pnpm |
118 | | - uses: pnpm/action-setup@v2 |
119 | | - with: |
120 | | - version: 8 |
121 | | - |
122 | | - - name: Install dependencies |
123 | | - run: pnpm install --frozen-lockfile |
124 | | - |
125 | | - - name: Check formatting (if prettier is configured) |
126 | | - run: | |
127 | | - if command -v prettier &> /dev/null; then |
128 | | - echo "Prettier found, checking formatting..." |
129 | | - pnpm prettier --check . || echo "Formatting issues found but continuing..." |
130 | | - else |
131 | | - echo "Prettier not installed, skipping format check" |
132 | | - fi |
133 | | - shell: bash |
134 | | - continue-on-error: true |
135 | | - |
136 | | - security-scan: |
137 | | - name: Security Scan |
138 | | - runs-on: ubuntu-latest |
139 | | - |
140 | | - steps: |
141 | | - - name: Checkout code |
142 | | - uses: actions/checkout@v4 |
143 | | - |
144 | | - - name: Setup Node.js |
145 | | - uses: actions/setup-node@v4 |
146 | | - with: |
147 | | - node-version: '20' |
148 | | - |
149 | | - - name: Setup pnpm |
150 | | - uses: pnpm/action-setup@v2 |
151 | | - with: |
152 | | - version: 8 |
153 | | - |
154 | | - - name: Install dependencies |
155 | | - run: pnpm install --frozen-lockfile |
156 | | - |
157 | | - - name: Run security audit |
158 | | - run: pnpm audit --audit-level=high |
159 | | - continue-on-error: true |
160 | | - |
161 | | - status-check: |
162 | | - name: All Checks Passed |
163 | | - runs-on: ubuntu-latest |
164 | | - needs: [lint-and-type-check, build, check-format, security-scan] |
165 | | - if: always() |
166 | | - |
167 | | - steps: |
168 | | - - name: Check status |
169 | | - run: | |
170 | | - echo "Lint and Type Check: ${{ needs.lint-and-type-check.result }}" |
171 | | - echo "Build: ${{ needs.build.result }}" |
172 | | - echo "Check Format: ${{ needs.check-format.result }}" |
173 | | - echo "Security Scan: ${{ needs.security-scan.result }}" |
174 | | - |
175 | | - if [ "${{ needs.build.result }}" != "success" ]; then |
176 | | - echo "Build failed! This is required." |
177 | | - exit 1 |
178 | | - fi |
179 | | - |
180 | | - if [ "${{ needs.lint-and-type-check.result }}" != "success" ]; then |
181 | | - echo "Lint/Type check had issues (non-blocking)" |
182 | | - fi |
183 | | - |
184 | | - echo "All required checks passed!" |
0 commit comments