Skip to content

Commit 07ac940

Browse files
committed
add ci workflow
1 parent 5fc52ab commit 07ac940

File tree

1 file changed

+112
-0
lines changed

1 file changed

+112
-0
lines changed

.github/workflows/ci.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ci]
6+
pull_request:
7+
branches: [main]
8+
9+
concurrency:
10+
group: ci-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
permissions:
14+
contents: read
15+
pull-requests: write
16+
17+
jobs:
18+
backend:
19+
name: Backend — Build & Test (Go)
20+
runs-on: ubuntu-latest
21+
22+
defaults:
23+
run:
24+
working-directory: backend
25+
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- name: Setup Go
30+
uses: actions/setup-go@v4
31+
with:
32+
go-version: '1.22'
33+
cache: true
34+
35+
- name: Install dependencies
36+
run: go mod download
37+
38+
- name: Lint
39+
uses: golangci/golangci-lint-action@v6
40+
with:
41+
version: latest
42+
working-directory: backend
43+
44+
- name: Run tests
45+
run: go test ./... -v -coverprofile=coverage.out
46+
47+
- name: Upload coverage
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: backend-coverage
51+
path: backend/coverage.out
52+
53+
- name: Build production binary
54+
run: |
55+
mkdir -p ../build
56+
go build -o ../build/aran-mcp ./cmd/server
57+
58+
- name: Upload backend artifact
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: backend-build
62+
path: build/aran-mcp
63+
64+
frontend:
65+
name: Frontend — Build & Test (Next.js)
66+
runs-on: ubuntu-latest
67+
needs: backend
68+
69+
steps:
70+
- uses: actions/checkout@v4
71+
72+
- name: Setup Node
73+
uses: actions/setup-node@v4
74+
with:
75+
node-version: '18'
76+
cache: 'npm'
77+
cache-dependency-path: frontend/package-lock.json
78+
79+
- name: Install dependencies
80+
working-directory: frontend
81+
run: npm ci
82+
83+
- name: Lint
84+
working-directory: frontend
85+
run: npm run lint
86+
87+
- name: Type-check
88+
working-directory: frontend
89+
run: npm run type-check
90+
91+
- name: Cache Next.js build
92+
uses: actions/cache@v3
93+
with:
94+
path: frontend/.next/cache
95+
key: frontend-build-${{ runner.os }}-${{ hashFiles('frontend/package-lock.json') }}
96+
97+
- name: Build
98+
working-directory: frontend
99+
run: npm run build
100+
101+
- name: Run tests (if any)
102+
working-directory: frontend
103+
run: |
104+
if [ -n "$(find frontend -type f -name '*.test.*')" ]; then
105+
npm test
106+
fi
107+
108+
- name: Upload frontend artifact
109+
uses: actions/upload-artifact@v4
110+
with:
111+
name: frontend-build
112+
path: frontend/.next

0 commit comments

Comments
 (0)