154 lines
3.3 KiB
YAML
154 lines
3.3 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags: ['v*']
|
|
pull_request:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
# ────── Backend (Go) ──────
|
|
server:
|
|
name: Server (Go)
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: server
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.22'
|
|
cache-dependency-path: server/go.sum
|
|
|
|
- run: go vet ./...
|
|
name: Lint (go vet)
|
|
|
|
- run: go build ./cmd/api
|
|
name: Build
|
|
|
|
- run: go test ./... -v -count=1
|
|
name: Test
|
|
|
|
# ────── Web (Next.js) ──────
|
|
web:
|
|
name: Web (Next.js)
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: web
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: latest
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: pnpm
|
|
cache-dependency-path: web/pnpm-lock.yaml
|
|
|
|
- run: pnpm install --frozen-lockfile
|
|
name: Install
|
|
|
|
- run: npx tsc --noEmit
|
|
name: Type Check
|
|
|
|
- run: npx next lint --max-warnings 0
|
|
name: Lint
|
|
continue-on-error: true
|
|
|
|
- run: npx vitest run
|
|
name: Test
|
|
|
|
- run: pnpm build
|
|
name: Build
|
|
continue-on-error: true
|
|
|
|
# ────── Mobile (React Native / Expo) ──────
|
|
mobile:
|
|
name: Mobile (React Native)
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: mobile
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: latest
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: pnpm
|
|
cache-dependency-path: mobile/pnpm-lock.yaml
|
|
|
|
- run: pnpm install --frozen-lockfile
|
|
name: Install
|
|
|
|
- run: npx tsc --noEmit
|
|
name: Type Check
|
|
|
|
# ────── Admin (React / Vite) ──────
|
|
admin:
|
|
name: Admin (React)
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: admin
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: latest
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: pnpm
|
|
cache-dependency-path: admin/pnpm-lock.yaml
|
|
|
|
- run: pnpm install --frozen-lockfile
|
|
name: Install
|
|
|
|
- run: npx tsc --noEmit
|
|
name: Type Check
|
|
|
|
- run: pnpm build
|
|
name: Build
|
|
|
|
# ────── Docker Build ──────
|
|
docker:
|
|
name: Docker Build
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- uses: docker/build-push-action@v6
|
|
with:
|
|
context: server
|
|
push: true
|
|
tags: ghcr.io/${{ github.repository }}/server:${{ github.ref_name }}
|