Skip to content

Add the CI

Add the CI #2

Workflow file for this run

name: CI
on:
push:
branches: [Dev-ci]
# pull_request:
# branches: [Dev-ci]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
jobs:
backend:
name: Backend — Build & Test (Go)
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
cache: true
- name: Install dependencies
run: go mod download
- name: Lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
working-directory: backend
- name: Run tests
run: go test ./... -v -coverprofile=coverage.out
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: backend-coverage
path: backend/coverage.out
- name: Build production binary
run: |
mkdir -p ../build
go build -o ../build/aran-mcp ./cmd/server
- name: Upload backend artifact
uses: actions/upload-artifact@v4
with:
name: backend-build
path: build/aran-mcp
frontend:
name: Frontend — Build & Test (Next.js)
runs-on: ubuntu-latest
needs: backend
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
working-directory: frontend
run: npm ci
- name: Lint
working-directory: frontend
run: npm run lint
- name: Type-check
working-directory: frontend
run: npm run type-check
- name: Cache Next.js build
uses: actions/cache@v3
with:
path: frontend/.next/cache
key: frontend-build-${{ runner.os }}-${{ hashFiles('frontend/package-lock.json') }}
- name: Build
working-directory: frontend
run: npm run build
- name: Run tests (if any)
working-directory: frontend
run: |
if [ -n "$(find frontend -type f -name '*.test.*')" ]; then
npm test
fi
- name: Upload frontend artifact
uses: actions/upload-artifact@v4
with:
name: frontend-build
path: frontend/.next