Skip to content

Commit baad9cb

Browse files
committed
πŸŽ› ci: Add frontend CI
1 parent 07b83e5 commit baad9cb

6 files changed

Lines changed: 378 additions & 342 deletions

File tree

β€Ž.github/workflows/ci-pipeline.ymlβ€Ž

Lines changed: 81 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,21 @@ on:
1212
pull_request:
1313
workflow_dispatch:
1414

15-
defaults:
16-
run:
17-
working-directory: "./backend"
18-
1915
jobs:
20-
test:
21-
name: "πŸ§ͺ Testing"
16+
backend-test:
17+
name: "πŸ§ͺ Backend Testing"
2218
runs-on: ubuntu-latest
19+
defaults:
20+
run:
21+
working-directory: "backend"
2322
steps:
2423
- name: "πŸ›’ Checkout"
2524
uses: actions/checkout@v4
2625

2726
- name: "🐍 Set up Poetry"
2827
uses: tomy0000000/actions/python-poetry-install@main
2928
with:
30-
working_directory: "./backend"
29+
working_directory: "backend"
3130
python_version: "3.12"
3231

3332
- name: "πŸ§ͺ Testing"
@@ -40,23 +39,55 @@ jobs:
4039
fail_ci_if_error: true
4140
token: ${{ secrets.CODECOV_TOKEN }}
4241

43-
lint:
44-
name: "πŸ” Linting"
42+
backend-lint:
43+
name: "πŸ” Backend Linting"
4544
runs-on: ubuntu-latest
45+
defaults:
46+
run:
47+
working-directory: "backend"
4648
steps:
4749
- name: "πŸ›’ Checkout"
4850
uses: actions/checkout@v4
4951

5052
- name: "🐍 Set up Poetry"
5153
uses: tomy0000000/actions/python-poetry-install@main
5254
with:
53-
working_directory: "./backend"
55+
working_directory: "backend"
5456
python_version: "3.12"
5557

5658
- name: "πŸ” Linting"
5759
run: |
5860
poetry run scripts/lint.sh
5961
62+
frontend-lint:
63+
name: "πŸ” Frontend Linting"
64+
runs-on: ubuntu-latest
65+
defaults:
66+
run:
67+
working-directory: "frontend"
68+
steps:
69+
- name: "πŸ›’ Checkout"
70+
uses: actions/checkout@v4
71+
72+
- name: "βš™οΈ Setup pnpm"
73+
uses: pnpm/action-setup@v4
74+
with:
75+
package_json_file: "frontend/package.json"
76+
run_install: false
77+
78+
- name: "βš™οΈ Setup Node.js"
79+
uses: actions/setup-node@v4
80+
with:
81+
node-version-file: "frontend/package.json"
82+
cache: "pnpm"
83+
cache-dependency-path: "frontend/pnpm-lock.yaml"
84+
85+
- name: "πŸ“¦ Install dependencies"
86+
run: pnpm install --frozen-lockfile
87+
88+
- name: "πŸ” Linting"
89+
run: pnpm lint
90+
6091
license:
6192
name: "πŸͺͺ License Scan"
6293
runs-on: ubuntu-latest
@@ -70,10 +101,13 @@ jobs:
70101
with:
71102
api-key: 2d7865a44aa575d857521faaee1a57f8
72103

73-
build:
104+
build-backend:
74105
name: "πŸ—οΈ Build Backend Image"
75106
runs-on: ubuntu-latest
76-
needs: [test, lint, license]
107+
defaults:
108+
run:
109+
working-directory: "backend"
110+
needs: [backend-test, backend-lint, license]
77111
if: success() && github.ref == 'refs/heads/develop'
78112
steps:
79113
- name: "πŸ›’ Checkout"
@@ -99,4 +133,38 @@ jobs:
99133
docker_password: ${{ secrets.DOCKER_PASSWORD }}
100134
tags: ${{ steps.meta.outputs.tags }}
101135
labels: ${{ steps.meta.outputs.labels }}
102-
context: "./backend"
136+
context: "backend"
137+
138+
build-frontend:
139+
name: "πŸ—οΈ Build Frontend Image"
140+
runs-on: ubuntu-latest
141+
defaults:
142+
run:
143+
working-directory: "frontend"
144+
needs: [frontend-lint, license]
145+
if: success() && github.ref == 'refs/heads/develop'
146+
steps:
147+
- name: "πŸ›’ Checkout"
148+
uses: actions/checkout@v4
149+
150+
- name: "βš™οΈ Setup Docker Meta"
151+
id: meta
152+
uses: docker/metadata-action@v5
153+
with:
154+
images: |
155+
${{ github.repository }}
156+
ghcr.io/${{ github.repository }}
157+
tags: |
158+
type=edge
159+
labels: |
160+
org.opencontainers.image.title=kayman-frontend
161+
org.opencontainers.image.documentation=${{ github.repository }}/wiki
162+
org.opencontainers.image.authors=tomy0000000
163+
164+
- name: "πŸ— Build and Push Image"
165+
uses: tomy0000000/actions/build-push-image@main
166+
with:
167+
docker_password: ${{ secrets.DOCKER_PASSWORD }}
168+
tags: ${{ steps.meta.outputs.tags }}
169+
labels: ${{ steps.meta.outputs.labels }}
170+
context: "frontend"

β€Žfrontend/eslint.config.mjsβ€Ž

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
import { FlatCompat } from "@eslint/eslintrc"
1+
import { FlatCompat } from '@eslint/eslintrc'
22

33
const compat = new FlatCompat({
4+
// import.meta.dirname is available after Node.js v20.11.0
45
baseDirectory: import.meta.dirname,
56
})
67

78
const eslintConfig = [
8-
...compat.extends("next/core-web-vitals", "next/typescript"),
9+
...compat.config({
10+
extends: ['next/core-web-vitals', 'next/typescript'],
11+
}),
912
]
1013

1114
export default eslintConfig

β€Žfrontend/next.config.mjsβ€Ž

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const nextConfig = {
66
{
77
protocol: "https",
88
hostname: "img.tomy.me",
9-
port: "",
109
},
1110
],
1211
},

β€Žfrontend/package.jsonβ€Ž

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,37 @@
11
{
22
"name": "kayman",
33
"version": "0.10.0",
4-
"private": true,
4+
"description": "🏝🏦 The one-stop solution for personal finance",
5+
"homepage": "https://github.com/tomy0000000/kayman",
6+
"bugs": {
7+
"url": "https://github.com/tomy0000000/kayman/issues"
8+
},
9+
"license": "MIT",
10+
"author": {
11+
"name": "Tomy Hsieh (tomy0000000)",
12+
"url": "https://github.com/tomy0000000"
13+
},
514
"scripts": {
615
"dev": "next dev",
716
"build": "next build",
817
"start": "next start",
918
"lint": "next lint",
1019
"generate-client": "openapi-ts"
1120
},
21+
"packageManager": "pnpm@10.12.1",
1222
"engines": {
1323
"node": ">=22"
1424
},
25+
"devEngines": {
26+
"runtime": {
27+
"name": "node",
28+
"onFail": "error"
29+
},
30+
"packageManager": {
31+
"name": "pnpm",
32+
"onFail": "error"
33+
}
34+
},
1535
"dependencies": {
1636
"@hey-api/client-axios": "^0.5.2",
1737
"@hookform/resolvers": "^3.10.0",
@@ -30,7 +50,7 @@
3050
"date-fns": "^4.1.0",
3151
"framer-motion": "^11.17.0",
3252
"lucide-react": "^0.471.0",
33-
"next": "14.2.16",
53+
"next": "15.3.4",
3454
"react": "^18",
3555
"react-day-picker": "8.10.1",
3656
"react-dom": "^18",
@@ -41,17 +61,21 @@
4161
"zod": "^3.24.1"
4262
},
4363
"devDependencies": {
44-
"@eslint/eslintrc": "^3.2.0",
64+
"@eslint/eslintrc": "^3.3.1",
4565
"@hey-api/openapi-ts": "^0.63.0",
4666
"@types/eslint": "^9.6.1",
4767
"@types/node": "^20",
4868
"@types/react": "^18",
4969
"@types/react-dom": "^18",
50-
"eslint": "^8",
51-
"eslint-config-next": "15.1.6",
70+
"eslint": "^9.29.0",
71+
"eslint-config-next": "15.3.4",
5272
"postcss": "^8",
5373
"prettier": "^3.4.2",
5474
"tailwindcss": "^3.4.1",
5575
"typescript": "^5"
76+
},
77+
"volta": {
78+
"node": "22.16.0",
79+
"pnpm": "10.12.1"
5680
}
5781
}

0 commit comments

Comments
Β (0)